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
26} 26}
27 27
28updatercd_postinst() { 28updatercd_postinst() {
29# Begin section update-rc.d
29if type update-rc.d >/dev/null 2>/dev/null; then 30if type update-rc.d >/dev/null 2>/dev/null; then
30 if [ -n "$D" ]; then 31 if [ -n "$D" ]; then
31 OPT="-r $D" 32 OPT="-r $D"
@@ -34,12 +35,15 @@ if type update-rc.d >/dev/null 2>/dev/null; then
34 fi 35 fi
35 update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} 36 update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
36fi 37fi
38# End section update-rc.d
37} 39}
38 40
39updatercd_prerm() { 41updatercd_prerm() {
42# Begin section update-rc.d
40if [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then 43if [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
41 ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : 44 ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || :
42fi 45fi
46# End section update-rc.d
43} 47}
44 48
45updatercd_postrm() { 49updatercd_postrm() {
@@ -102,13 +106,25 @@ python populate_packages_updatercd () {
102 postinst = d.getVar('pkg_postinst_%s' % pkg, True) 106 postinst = d.getVar('pkg_postinst_%s' % pkg, True)
103 if not postinst: 107 if not postinst:
104 postinst = '#!/bin/sh\n' 108 postinst = '#!/bin/sh\n'
105 postinst += localdata.getVar('updatercd_postinst', True) 109 postinst = postinst.splitlines(True)
110 try:
111 index = postinst.index('# End section update-alternatives\n')
112 postinst.insert(index + 1, localdata.getVar('updatercd_postinst', True))
113 except ValueError:
114 postinst.append(localdata.getVar('updatercd_postinst', True))
115 postinst = ''.join(postinst)
106 d.setVar('pkg_postinst_%s' % pkg, postinst) 116 d.setVar('pkg_postinst_%s' % pkg, postinst)
107 117
108 prerm = d.getVar('pkg_prerm_%s' % pkg, True) 118 prerm = d.getVar('pkg_prerm_%s' % pkg, True)
109 if not prerm: 119 if not prerm:
110 prerm = '#!/bin/sh\n' 120 prerm = '#!/bin/sh\n'
111 prerm += localdata.getVar('updatercd_prerm', True) 121 prerm = prerm.splitlines(True)
122 try:
123 index = prerm.index('# Begin section update-alternatives\n')
124 prerm.insert(index, localdata.getVar('updatercd_prerm', True))
125 except ValueError:
126 prerm.append(localdata.getVar('updatercd_prerm', True))
127 prerm = ''.join(prerm)
112 d.setVar('pkg_prerm_%s' % pkg, prerm) 128 d.setVar('pkg_prerm_%s' % pkg, prerm)
113 129
114 postrm = d.getVar('pkg_postrm_%s' % pkg, True) 130 postrm = d.getVar('pkg_postrm_%s' % pkg, True)