diff options
author | Koen Kooi <koen@dominion.thruhere.net> | 2011-03-14 19:10:15 +0100 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-03-14 19:10:15 +0100 |
commit | c1af7e34f0f780e7fdd93a529445fedb3057c5f3 (patch) | |
tree | 5c5d1a77cd2d492cbce4f2bf7823bf02b3764474 /recipes-ti/includes/ti-eula-unpack.inc | |
parent | 4884692d7f6b9cc76ab3535fc0790a148b1137f6 (diff) | |
download | meta-ti-c1af7e34f0f780e7fdd93a529445fedb3057c5f3.tar.gz |
recipes-ti: initial check in of dsplink stack
* the focus was on to get it to build, not to make the recipes perfect
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'recipes-ti/includes/ti-eula-unpack.inc')
-rw-r--r-- | recipes-ti/includes/ti-eula-unpack.inc | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/recipes-ti/includes/ti-eula-unpack.inc b/recipes-ti/includes/ti-eula-unpack.inc new file mode 100644 index 00000000..3b79c243 --- /dev/null +++ b/recipes-ti/includes/ti-eula-unpack.inc | |||
@@ -0,0 +1,71 @@ | |||
1 | # This file defines function used for unpacking the .bin file downloaded over | ||
2 | # the http and display EULA. | ||
3 | # BINFILE - name of the install jammer .bin file | ||
4 | # TARFILE - name of the tar file inside the install jammer | ||
5 | # TI_BIN_UNPK_CMDS - contains list of commands separated with colon to be | ||
6 | # passed while unpacking the bin file. The keyword | ||
7 | # workdir expands to WORKDIR and commands are appendded | ||
8 | # with '\n'. Eg. TI_BIN_UNPK_CMDS="Y:Y: qY:workdir" | ||
9 | # TI_BIN_UNPK_WDEXT - This variable extends workdir path, if user wants to put | ||
10 | # the output in some internal directory | ||
11 | |||
12 | python do_unpack () { | ||
13 | bb.build.exec_func('base_do_unpack', d) | ||
14 | bb.build.exec_func('ti_bin_do_unpack', d) | ||
15 | } | ||
16 | |||
17 | TI_BIN_UNPK_WDEXT += "" | ||
18 | python ti_bin_do_unpack() { | ||
19 | |||
20 | import os | ||
21 | |||
22 | localdata = bb.data.createCopy(d) | ||
23 | bb.data.update_data(localdata) | ||
24 | |||
25 | binfile = bb.data.getVar('BINFILE', localdata) | ||
26 | binfile = bb.data.expand(binfile, localdata) | ||
27 | |||
28 | # Change to the working directory | ||
29 | save_cwd = os.getcwd() | ||
30 | workdir = bb.data.getVar('WORKDIR', localdata) | ||
31 | workdir = bb.data.expand(workdir, localdata) | ||
32 | os.chdir(workdir) | ||
33 | |||
34 | # Get unpack commands | ||
35 | cmd_string = bb.data.getVar('TI_BIN_UNPK_CMDS', localdata) | ||
36 | cmd_list = cmd_string.split( ":" ) | ||
37 | |||
38 | # Make the InstallJammer binary executable so we can run it | ||
39 | os.chmod(binfile, 0755) | ||
40 | |||
41 | # Run the InstallJammer binary and accept the EULA | ||
42 | filename = "HOME=%s ./%s --mode console" % (workdir, binfile) | ||
43 | |||
44 | # Test executable by printing installer version or help screen (--version currently broken for some installers) | ||
45 | # - this is currently broken in some IJ installers - comment out for now | ||
46 | #if os.system(filename + " --version") != 0: | ||
47 | # print "ERROR: ti-eula-unpack: failed to execute binary installer" | ||
48 | # raise bb.build.FuncFailed() | ||
49 | |||
50 | f = os.popen(filename,'w') | ||
51 | for cmd in cmd_list: | ||
52 | if cmd == "workdir": | ||
53 | wdext = bb.data.getVar('TI_BIN_UNPK_WDEXT', localdata) | ||
54 | wdext = bb.data.expand(wdext, localdata) | ||
55 | cmd = workdir+wdext | ||
56 | print >>f, "%s\n" % cmd | ||
57 | f.close() | ||
58 | |||
59 | # Expand the tarball that was created if required | ||
60 | tarfile = bb.data.getVar('TARFILE', localdata) | ||
61 | if bool(tarfile) == True: | ||
62 | tarfile = bb.data.expand(tarfile, localdata) | ||
63 | tcmd = 'tar x --no-same-owner -f %s -C %s' % (tarfile, workdir) | ||
64 | if os.system(tcmd) != 0: | ||
65 | print "ERROR: ti-eula-unpack: failed to extract tarfile" | ||
66 | raise bb.build.FuncFailed() | ||
67 | |||
68 | # Return to the previous directory | ||
69 | os.chdir(save_cwd) | ||
70 | } | ||
71 | |||