summaryrefslogtreecommitdiffstats
path: root/meta/classes/update-rc.d.bbclass
diff options
context:
space:
mode:
authorDavid Vincent <freesilicon@gmail.com>2016-12-20 10:47:45 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-09 13:27:01 +0000
commitaa87b1a4dcc14e4dfe719b6c55045c5662bc59c2 (patch)
tree48b528d02d3397e215bf655b09b5c20e3a09233b /meta/classes/update-rc.d.bbclass
parent9ddcfb51e637acba82089da6430ac77e29f0f1ef (diff)
downloadopenembedded-core-contrib-aa87b1a4dcc14e4dfe719b6c55045c5662bc59c2.tar.gz
classes: Fix alternatives and rc.d ordering
When using an alternative as an initscript, the ordering between update-rc.d and update-alternatives tasks during prerm and postinst tasks must always be the following in order to work: * prerm: - stop daemon - remove alternative * postinst: - add alternative - start daemon This patchset adds comments to the scripts generated by both classes and organize the generated sections based on those comments. [YOCTO #10433] Changes since v5: - Remove boolean in d.getVar() calls Signed-off-by: David Vincent <freesilicon@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes/update-rc.d.bbclass')
-rw-r--r--meta/classes/update-rc.d.bbclass20
1 files changed, 18 insertions, 2 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index 2746c360fe..9d3a7bc0c7 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -35,6 +35,7 @@ fi
}
updatercd_postinst() {
+# Begin section update-rc.d
if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then
if [ -n "$D" ]; then
OPT="-r $D"
@@ -43,12 +44,15 @@ if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then
fi
update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
fi
+# End section update-rc.d
}
updatercd_prerm() {
+# Begin section update-rc.d
if ${@use_updatercd(d)} && [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
${INIT_D_DIR}/${INITSCRIPT_NAME} stop || :
fi
+# End section update-rc.d
}
updatercd_postrm() {
@@ -111,13 +115,25 @@ python populate_packages_updatercd () {
postinst = d.getVar('pkg_postinst_%s' % pkg)
if not postinst:
postinst = '#!/bin/sh\n'
- postinst += localdata.getVar('updatercd_postinst')
+ postinst = postinst.splitlines(True)
+ try:
+ index = postinst.index('# End section update-alternatives\n')
+ postinst.insert(index + 1, localdata.getVar('updatercd_postinst'))
+ except ValueError:
+ postinst.append(localdata.getVar('updatercd_postinst'))
+ postinst = ''.join(postinst)
d.setVar('pkg_postinst_%s' % pkg, postinst)
prerm = d.getVar('pkg_prerm_%s' % pkg)
if not prerm:
prerm = '#!/bin/sh\n'
- prerm += localdata.getVar('updatercd_prerm')
+ prerm = prerm.splitlines(True)
+ try:
+ index = prerm.index('# Begin section update-alternatives\n')
+ prerm.insert(index, localdata.getVar('updatercd_prerm'))
+ except ValueError:
+ prerm.append(localdata.getVar('updatercd_prerm'))
+ prerm = ''.join(prerm)
d.setVar('pkg_prerm_%s' % pkg, prerm)
postrm = d.getVar('pkg_postrm_%s' % pkg)