diff options
Diffstat (limited to 'meta/classes/update-rc.d.bbclass')
-rw-r--r-- | meta/classes/update-rc.d.bbclass | 20 |
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 | ||
28 | updatercd_postinst() { | 28 | updatercd_postinst() { |
29 | # Begin section update-rc.d | ||
29 | if type update-rc.d >/dev/null 2>/dev/null; then | 30 | if 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} |
36 | fi | 37 | fi |
38 | # End section update-rc.d | ||
37 | } | 39 | } |
38 | 40 | ||
39 | updatercd_prerm() { | 41 | updatercd_prerm() { |
42 | # Begin section update-rc.d | ||
40 | if [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then | 43 | if [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then |
41 | ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : | 44 | ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : |
42 | fi | 45 | fi |
46 | # End section update-rc.d | ||
43 | } | 47 | } |
44 | 48 | ||
45 | updatercd_postrm() { | 49 | updatercd_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) |