diff options
author | Jacob Stiffler <j-stiffler@ti.com> | 2015-02-05 21:28:28 +0000 |
---|---|---|
committer | Denys Dmytriyenko <denys@ti.com> | 2015-02-20 12:27:30 -0500 |
commit | b06623fa2a2245f7914a120b99edf4152ec7aea5 (patch) | |
tree | dce61bd37309830792237b5f35f74670f04e06b8 /recipes-ti/includes/ti-eula-unpack.inc | |
parent | 7f762b9fe5324b01864685a870b6eab7c34e5eb9 (diff) | |
download | meta-ti-b06623fa2a2245f7914a120b99edf4152ec7aea5.tar.gz |
ti-eula-unpack: Add support for general binary installers.
* ti-unpack.inc has been created to allow support for general binary
installers by creating a variable which is used to pass arbitrary
arguments to the executable.
* ti-eula-unpack.inc sets the default arguments to retain support for
recipes which still use this feature.
Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Diffstat (limited to 'recipes-ti/includes/ti-eula-unpack.inc')
-rw-r--r-- | recipes-ti/includes/ti-eula-unpack.inc | 67 |
1 files changed, 2 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 | ||