diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/update-alternatives.bbclass | 29 | ||||
-rw-r--r-- | meta/classes/update-rc.d.bbclass | 20 |
2 files changed, 40 insertions, 9 deletions
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass index 1fdd681315..65929e5555 100644 --- a/meta/classes/update-alternatives.bbclass +++ b/meta/classes/update-alternatives.bbclass | |||
@@ -195,8 +195,8 @@ python populate_packages_updatealternatives () { | |||
195 | pkgdest = d.getVar('PKGD', True) | 195 | pkgdest = d.getVar('PKGD', True) |
196 | for pkg in (d.getVar('PACKAGES', True) or "").split(): | 196 | for pkg in (d.getVar('PACKAGES', True) or "").split(): |
197 | # Create post install/removal scripts | 197 | # Create post install/removal scripts |
198 | alt_setup_links = "" | 198 | alt_setup_links = "# Begin section update-alternatives\n" |
199 | alt_remove_links = "" | 199 | alt_remove_links = "# Begin section update-alternatives\n" |
200 | for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg, True) or "").split(): | 200 | for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg, True) or "").split(): |
201 | alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name, True) | 201 | alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name, True) |
202 | alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name, True) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name, True) | 202 | alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name, True) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name, True) |
@@ -219,10 +219,13 @@ python populate_packages_updatealternatives () { | |||
219 | # Default to generate shell script.. eventually we may want to change this... | 219 | # Default to generate shell script.. eventually we may want to change this... |
220 | alt_target = os.path.normpath(alt_target) | 220 | alt_target = os.path.normpath(alt_target) |
221 | 221 | ||
222 | alt_setup_links += '\tupdate-alternatives --install %s %s %s %s\n' % (alt_link, alt_name, alt_target, alt_priority) | 222 | alt_setup_links += 'update-alternatives --install %s %s %s %s\n' % (alt_link, alt_name, alt_target, alt_priority) |
223 | alt_remove_links += '\tupdate-alternatives --remove %s %s\n' % (alt_name, alt_target) | 223 | alt_remove_links += 'update-alternatives --remove %s %s\n' % (alt_name, alt_target) |
224 | 224 | ||
225 | if alt_setup_links: | 225 | alt_setup_links += "# End section update-alternatives\n" |
226 | alt_remove_links += "# End section update-alternatives\n" | ||
227 | |||
228 | if len(alt_setup_links.splitlines()) > 2: | ||
226 | # RDEPENDS setup | 229 | # RDEPENDS setup |
227 | provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives', True) | 230 | provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives', True) |
228 | if provider: | 231 | if provider: |
@@ -232,12 +235,24 @@ python populate_packages_updatealternatives () { | |||
232 | bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg) | 235 | bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg) |
233 | bb.note('%s' % alt_setup_links) | 236 | bb.note('%s' % alt_setup_links) |
234 | postinst = d.getVar('pkg_postinst_%s' % pkg, True) or '#!/bin/sh\n' | 237 | postinst = d.getVar('pkg_postinst_%s' % pkg, True) or '#!/bin/sh\n' |
235 | postinst += alt_setup_links | 238 | postinst = postinst.splitlines(True) |
239 | try: | ||
240 | index = postinst.index('# Begin section update-rc.d\n') | ||
241 | postinst.insert(index, alt_setup_links) | ||
242 | except ValueError: | ||
243 | postinst.append(alt_setup_links) | ||
244 | postinst = ''.join(postinst) | ||
236 | d.setVar('pkg_postinst_%s' % pkg, postinst) | 245 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
237 | 246 | ||
238 | bb.note('%s' % alt_remove_links) | 247 | bb.note('%s' % alt_remove_links) |
239 | prerm = d.getVar('pkg_prerm_%s' % pkg, True) or '#!/bin/sh\n' | 248 | prerm = d.getVar('pkg_prerm_%s' % pkg, True) or '#!/bin/sh\n' |
240 | prerm += alt_remove_links | 249 | prerm = prerm.splitlines(True) |
250 | try: | ||
251 | index = prerm.index('# End section update-rc.d\n') | ||
252 | prerm.insert(index + 1, alt_remove_links) | ||
253 | except ValueError: | ||
254 | prerm.append(alt_remove_links) | ||
255 | prerm = ''.join(prerm) | ||
241 | d.setVar('pkg_prerm_%s' % pkg, prerm) | 256 | d.setVar('pkg_prerm_%s' % pkg, prerm) |
242 | } | 257 | } |
243 | 258 | ||
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) |