mirror of
https://git.yoctoproject.org/poky
synced 2026-02-27 11:59:40 +01:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
6bc86e0c57
commit
c0b0f695f5
@@ -239,13 +239,26 @@ python do_package_deb () {
|
||||
scriptvar = localdata.getVar('pkg_%s' % script, True)
|
||||
if not scriptvar:
|
||||
continue
|
||||
scriptvar = scriptvar.strip()
|
||||
try:
|
||||
scriptfile = open(os.path.join(controldir, script), 'w')
|
||||
except OSError:
|
||||
bb.utils.unlockfile(lf)
|
||||
raise bb.build.FuncFailed("unable to open %s script file for writing." % script)
|
||||
scriptfile.write("#!/bin/sh\n")
|
||||
scriptfile.write(scriptvar)
|
||||
|
||||
if scriptvar.startswith("#!"):
|
||||
pos = scriptvar.find("\n") + 1
|
||||
scriptfile.write(scriptvar[:pos])
|
||||
else:
|
||||
pos = 0
|
||||
scriptfile.write("#!/bin/sh\n")
|
||||
|
||||
# Prevent the prerm/postrm scripts from being run during an upgrade
|
||||
if script in ('prerm', 'postrm'):
|
||||
scriptfile.write('[ "$1" != "upgrade" ] || exit 0\n')
|
||||
|
||||
scriptfile.write(scriptvar[pos:])
|
||||
scriptfile.write('\n')
|
||||
scriptfile.close()
|
||||
os.chmod(os.path.join(controldir, script), 0755)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user