diff options
Diffstat (limited to 'recipes-ti')
-rw-r--r-- | recipes-ti/includes/ti-eula-unpack.inc | 67 | ||||
-rw-r--r-- | recipes-ti/includes/ti-unpack.inc | 83 |
2 files changed, 85 insertions, 65 deletions
diff --git a/recipes-ti/includes/ti-eula-unpack.inc b/recipes-ti/includes/ti-eula-unpack.inc index aee88f16..912cd18a 100644 --- a/recipes-ti/includes/ti-eula-unpack.inc +++ b/recipes-ti/includes/ti-eula-unpack.inc | |||
@@ -9,70 +9,7 @@ | |||
9 | # TI_BIN_UNPK_WDEXT - This variable extends workdir path, if user wants to put | 9 | # TI_BIN_UNPK_WDEXT - This variable extends workdir path, if user wants to put |
10 | # the output in some internal directory | 10 | # the output in some internal directory |
11 | 11 | ||
12 | python do_unpack () { | 12 | require ../includes/ti-unpack.inc |
13 | bb.build.exec_func('base_do_unpack', d) | ||
14 | bb.build.exec_func('ti_bin_do_unpack', d) | ||
15 | } | ||
16 | 13 | ||
17 | TI_BIN_UNPK_WDEXT ?= "" | 14 | TI_BIN_UNPK_ARGS = "--mode console" |
18 | python ti_bin_do_unpack() { | ||
19 | |||
20 | import os | ||
21 | |||
22 | # InstallJammer requires 32bit version of glibc | ||
23 | lib32path = '/lib' | ||
24 | if os.path.exists('/lib64') and (os.path.islink('/lib64') or os.path.islink('/lib') or os.path.exists('/lib32')): | ||
25 | lib32path = '/lib32' | ||
26 | if not os.path.exists('%s/libc.so.6' % lib32path): | ||
27 | bb.warn("TI installer requires 32bit glibc libraries for proper operation\nrun 'yum install glibc.i686' on Fedora or 'apt-get install ia32-libs' on Ubuntu/Debian") | ||
28 | |||
29 | localdata = bb.data.createCopy(d) | ||
30 | bb.data.update_data(localdata) | ||
31 | |||
32 | binfile = bb.data.getVar('BINFILE', localdata) | ||
33 | binfile = bb.data.expand(binfile, localdata) | ||
34 | |||
35 | # Change to the working directory | ||
36 | save_cwd = os.getcwd() | ||
37 | workdir = bb.data.getVar('WORKDIR', localdata) | ||
38 | workdir = bb.data.expand(workdir, localdata) | ||
39 | os.chdir(workdir) | ||
40 | |||
41 | # Get unpack commands | ||
42 | cmd_string = bb.data.getVar('TI_BIN_UNPK_CMDS', localdata) | ||
43 | cmd_list = cmd_string.split( ":" ) | ||
44 | |||
45 | # Make the InstallJammer binary executable so we can run it | ||
46 | os.chmod(binfile, 0755) | ||
47 | |||
48 | # Run the InstallJammer binary and accept the EULA | ||
49 | filename = "HOME=%s ./%s --mode console" % (workdir, binfile) | ||
50 | |||
51 | # Test executable by printing installer version or help screen (--version currently broken for some installers) | ||
52 | # - this is currently broken in some IJ installers - comment out for now | ||
53 | #if os.system(filename + " --version") != 0: | ||
54 | # print "ERROR: ti-eula-unpack: failed to execute binary installer" | ||
55 | # raise bb.build.FuncFailed() | ||
56 | |||
57 | f = os.popen(filename,'w') | ||
58 | for cmd in cmd_list: | ||
59 | if cmd == "workdir": | ||
60 | wdext = bb.data.getVar('TI_BIN_UNPK_WDEXT', localdata) | ||
61 | wdext = bb.data.expand(wdext, localdata) | ||
62 | cmd = workdir+wdext | ||
63 | f.write(cmd+'\n'); | ||
64 | f.close() | ||
65 | |||
66 | # Expand the tarball that was created if required | ||
67 | tarfile = bb.data.getVar('TARFILE', localdata) | ||
68 | if bool(tarfile) == True: | ||
69 | tarfile = bb.data.expand(tarfile, localdata) | ||
70 | tcmd = 'tar x --no-same-owner -f %s -C %s' % (tarfile, workdir) | ||
71 | if os.system(tcmd) != 0: | ||
72 | print "ERROR: ti-eula-unpack: failed to extract tarfile" | ||
73 | raise bb.build.FuncFailed() | ||
74 | |||
75 | # Return to the previous directory | ||
76 | os.chdir(save_cwd) | ||
77 | } | ||
78 | 15 | ||
diff --git a/recipes-ti/includes/ti-unpack.inc b/recipes-ti/includes/ti-unpack.inc new file mode 100644 index 00000000..c19c78ca --- /dev/null +++ b/recipes-ti/includes/ti-unpack.inc | |||
@@ -0,0 +1,83 @@ | |||
1 | # This file defines function used for unpacking the .bin file downloaded over | ||
2 | # the http. | ||
3 | # BINFILE - name of the install jammer .bin file | ||
4 | # TARFILE - name of the tar file inside the install jammer | ||
5 | # TI_BIN_UNPK_ARGS - contains the arguments to be passed to the bin file. | ||
6 | # TI_BIN_UNPK_CMDS - contains list of commands separated with colon to be | ||
7 | # passed while unpacking the bin file. The keyword | ||
8 | # workdir expands to WORKDIR and commands are appendded | ||
9 | # with '\n'. Eg. TI_BIN_UNPK_CMDS="Y:Y: qY:workdir" | ||
10 | # TI_BIN_UNPK_WDEXT - This variable extends workdir path, if user wants to put | ||
11 | # the output in some internal directory | ||
12 | |||
13 | python do_unpack () { | ||
14 | bb.build.exec_func('base_do_unpack', d) | ||
15 | bb.build.exec_func('ti_bin_do_unpack', d) | ||
16 | } | ||
17 | |||
18 | TI_BIN_UNPK_WDEXT ?= "" | ||
19 | python ti_bin_do_unpack() { | ||
20 | |||
21 | import os | ||
22 | |||
23 | # InstallJammer requires 32bit version of glibc | ||
24 | lib32path = '/lib' | ||
25 | if os.path.exists('/lib64') and (os.path.islink('/lib64') or os.path.islink('/lib') or os.path.exists('/lib32')): | ||
26 | lib32path = '/lib32' | ||
27 | if not os.path.exists('%s/libc.so.6' % lib32path): | ||
28 | bb.warn("TI installer requires 32bit glibc libraries for proper operation\nrun 'yum install glibc.i686' on Fedora or 'apt-get install ia32-libs' on Ubuntu/Debian") | ||
29 | |||
30 | localdata = bb.data.createCopy(d) | ||
31 | bb.data.update_data(localdata) | ||
32 | |||
33 | binfile = bb.data.getVar('BINFILE', localdata) | ||
34 | binfile = bb.data.expand(binfile, localdata) | ||
35 | |||
36 | # Change to the working directory | ||
37 | save_cwd = os.getcwd() | ||
38 | workdir = bb.data.getVar('WORKDIR', localdata) | ||
39 | workdir = bb.data.expand(workdir, localdata) | ||
40 | os.chdir(workdir) | ||
41 | |||
42 | # Get unpack args | ||
43 | arg_string = bb.data.getVar('TI_BIN_UNPK_ARGS', localdata) | ||
44 | arg_string = bb.data.expand(arg_string, localdata) | ||
45 | |||
46 | # Get unpack commands | ||
47 | cmd_string = bb.data.getVar('TI_BIN_UNPK_CMDS', localdata) | ||
48 | cmd_list = cmd_string.split( ":" ) | ||
49 | |||
50 | # Make the InstallJammer binary executable so we can run it | ||
51 | os.chmod(binfile, 0755) | ||
52 | |||
53 | # Run the InstallJammer binary and accept the EULA | ||
54 | filename = "HOME=%s ./%s %s" % (workdir, binfile, arg_string) | ||
55 | |||
56 | # Test executable by printing installer version or help screen (--version currently broken for some installers) | ||
57 | # - this is currently broken in some IJ installers - comment out for now | ||
58 | #if os.system(filename + " --version") != 0: | ||
59 | # print "ERROR: ti-eula-unpack: failed to execute binary installer" | ||
60 | # raise bb.build.FuncFailed() | ||
61 | |||
62 | f = os.popen(filename,'w') | ||
63 | for cmd in cmd_list: | ||
64 | if cmd == "workdir": | ||
65 | wdext = bb.data.getVar('TI_BIN_UNPK_WDEXT', localdata) | ||
66 | wdext = bb.data.expand(wdext, localdata) | ||
67 | cmd = workdir+wdext | ||
68 | f.write(cmd+'\n'); | ||
69 | f.close() | ||
70 | |||
71 | # Expand the tarball that was created if required | ||
72 | tarfile = bb.data.getVar('TARFILE', localdata) | ||
73 | if bool(tarfile) == True: | ||
74 | tarfile = bb.data.expand(tarfile, localdata) | ||
75 | tcmd = 'tar x --no-same-owner -f %s -C %s' % (tarfile, workdir) | ||
76 | if os.system(tcmd) != 0: | ||
77 | print "ERROR: ti-eula-unpack: failed to extract tarfile" | ||
78 | raise bb.build.FuncFailed() | ||
79 | |||
80 | # Return to the previous directory | ||
81 | os.chdir(save_cwd) | ||
82 | } | ||
83 | |||