summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2014-10-10 18:36:42 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-10-11 08:11:03 +0100
commitc0b0f695f537541cf3247afd8bfd19e471ed81d7 (patch)
treefb4f7328e073b0967266831d5929efd23ee319d9 /meta
parent6bc86e0c5795278b2b6b1c4babdf0dd9a8c58827 (diff)
downloadpoky-c0b0f695f537541cf3247afd8bfd19e471ed81d7.tar.gz
package_deb: skip pre/postrm scripts on upgrade, write only one shebang
Trying to upgrade busybox removing symlinks but update-alternatives need these links (sed, cut, tail, etc) in order to work. Adding test to avoid this scripts on upgrade fix the problem, same solution are found in package_rpm class. [YOCTO #6768] (From OE-Core rev: 7b9161dd0c475cca6ea7eb507f7c3c51869eb493) Signed-off-by: Andreas Oberritter <obi@opendreambox.org> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/package_deb.bbclass17
1 files changed, 15 insertions, 2 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 7bc29df165..5b5f7e2c9a 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -239,13 +239,26 @@ python do_package_deb () {
239 scriptvar = localdata.getVar('pkg_%s' % script, True) 239 scriptvar = localdata.getVar('pkg_%s' % script, True)
240 if not scriptvar: 240 if not scriptvar:
241 continue 241 continue
242 scriptvar = scriptvar.strip()
242 try: 243 try:
243 scriptfile = open(os.path.join(controldir, script), 'w') 244 scriptfile = open(os.path.join(controldir, script), 'w')
244 except OSError: 245 except OSError:
245 bb.utils.unlockfile(lf) 246 bb.utils.unlockfile(lf)
246 raise bb.build.FuncFailed("unable to open %s script file for writing." % script) 247 raise bb.build.FuncFailed("unable to open %s script file for writing." % script)
247 scriptfile.write("#!/bin/sh\n") 248
248 scriptfile.write(scriptvar) 249 if scriptvar.startswith("#!"):
250 pos = scriptvar.find("\n") + 1
251 scriptfile.write(scriptvar[:pos])
252 else:
253 pos = 0
254 scriptfile.write("#!/bin/sh\n")
255
256 # Prevent the prerm/postrm scripts from being run during an upgrade
257 if script in ('prerm', 'postrm'):
258 scriptfile.write('[ "$1" != "upgrade" ] || exit 0\n')
259
260 scriptfile.write(scriptvar[pos:])
261 scriptfile.write('\n')
249 scriptfile.close() 262 scriptfile.close()
250 os.chmod(os.path.join(controldir, script), 0755) 263 os.chmod(os.path.join(controldir, script), 0755)
251 264