Squashed 'import-layers/yocto-poky/' changes from dc8508f6099..67491b0c104
Yocto 2.2.2 (Morty)
Change-Id: Id9a452e28940d9f166957de243d9cb1d8818704e
git-subtree-dir: import-layers/yocto-poky
git-subtree-split: 67491b0c104101bb9f366d697edd23c895be4302
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/import-layers/yocto-poky/meta/classes/update-rc.d.bbclass b/import-layers/yocto-poky/meta/classes/update-rc.d.bbclass
index 321924b..18df2dc 100644
--- a/import-layers/yocto-poky/meta/classes/update-rc.d.bbclass
+++ b/import-layers/yocto-poky/meta/classes/update-rc.d.bbclass
@@ -26,6 +26,7 @@
}
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 @@
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 @@
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)