summaryrefslogtreecommitdiffstats
path: root/meta/classes/update-rc.d.bbclass
diff options
context:
space:
mode:
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 321924bb3e..18df2dc3f2 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -26,6 +26,7 @@ fi
}
updatercd_postinst() {
+# Begin section update-rc.d
if type update-rc.d >/dev/null 2>/dev/null; then
if [ -n "$D" ]; then
OPT="-r $D"
@@ -34,12 +35,15 @@ if 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 [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
${INIT_D_DIR}/${INITSCRIPT_NAME} stop || :
fi
+# End section update-rc.d
}
updatercd_postrm() {
@@ -102,13 +106,25 @@ python populate_packages_updatercd () {
postinst = d.getVar('pkg_postinst_%s' % pkg, True)
if not postinst:
postinst = '#!/bin/sh\n'
- postinst += localdata.getVar('updatercd_postinst', True)
+ postinst = postinst.splitlines(True)
+ try:
+ index = postinst.index('# End section update-alternatives\n')
+ postinst.insert(index + 1, localdata.getVar('updatercd_postinst', True))
+ except ValueError:
+ postinst.append(localdata.getVar('updatercd_postinst', True))
+ postinst = ''.join(postinst)
d.setVar('pkg_postinst_%s' % pkg, postinst)
prerm = d.getVar('pkg_prerm_%s' % pkg, True)
if not prerm:
prerm = '#!/bin/sh\n'
- prerm += localdata.getVar('updatercd_prerm', True)
+ prerm = prerm.splitlines(True)
+ try:
+ index = prerm.index('# Begin section update-alternatives\n')
+ prerm.insert(index, localdata.getVar('updatercd_prerm', True))
+ except ValueError:
+ prerm.append(localdata.getVar('updatercd_prerm', True))
+ prerm = ''.join(prerm)
d.setVar('pkg_prerm_%s' % pkg, prerm)
postrm = d.getVar('pkg_postrm_%s' % pkg, True)