diff options
Diffstat (limited to 'meta')
| -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 0460bf0241..a90ef19e45 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') | 195 | pkgdest = d.getVar('PKGD') |
| 196 | for pkg in (d.getVar('PACKAGES') or "").split(): | 196 | for pkg in (d.getVar('PACKAGES') 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) or "").split(): | 200 | for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split(): |
| 201 | alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name) | 201 | alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name) |
| 202 | alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name) | 202 | alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name) |
| @@ -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') | 230 | provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives') |
| 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) or '#!/bin/sh\n' | 237 | postinst = d.getVar('pkg_postinst_%s' % pkg) 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) or '#!/bin/sh\n' | 248 | prerm = d.getVar('pkg_prerm_%s' % pkg) 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 2746c360fe..9d3a7bc0c7 100644 --- a/meta/classes/update-rc.d.bbclass +++ b/meta/classes/update-rc.d.bbclass | |||
| @@ -35,6 +35,7 @@ fi | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | updatercd_postinst() { | 37 | updatercd_postinst() { |
| 38 | # Begin section update-rc.d | ||
| 38 | if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then | 39 | if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then |
| 39 | if [ -n "$D" ]; then | 40 | if [ -n "$D" ]; then |
| 40 | OPT="-r $D" | 41 | OPT="-r $D" |
| @@ -43,12 +44,15 @@ if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then | |||
| 43 | fi | 44 | fi |
| 44 | update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} | 45 | update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} |
| 45 | fi | 46 | fi |
| 47 | # End section update-rc.d | ||
| 46 | } | 48 | } |
| 47 | 49 | ||
| 48 | updatercd_prerm() { | 50 | updatercd_prerm() { |
| 51 | # Begin section update-rc.d | ||
| 49 | if ${@use_updatercd(d)} && [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then | 52 | if ${@use_updatercd(d)} && [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then |
| 50 | ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : | 53 | ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : |
| 51 | fi | 54 | fi |
| 55 | # End section update-rc.d | ||
| 52 | } | 56 | } |
| 53 | 57 | ||
| 54 | updatercd_postrm() { | 58 | updatercd_postrm() { |
| @@ -111,13 +115,25 @@ python populate_packages_updatercd () { | |||
| 111 | postinst = d.getVar('pkg_postinst_%s' % pkg) | 115 | postinst = d.getVar('pkg_postinst_%s' % pkg) |
| 112 | if not postinst: | 116 | if not postinst: |
| 113 | postinst = '#!/bin/sh\n' | 117 | postinst = '#!/bin/sh\n' |
| 114 | postinst += localdata.getVar('updatercd_postinst') | 118 | postinst = postinst.splitlines(True) |
| 119 | try: | ||
| 120 | index = postinst.index('# End section update-alternatives\n') | ||
| 121 | postinst.insert(index + 1, localdata.getVar('updatercd_postinst')) | ||
| 122 | except ValueError: | ||
| 123 | postinst.append(localdata.getVar('updatercd_postinst')) | ||
| 124 | postinst = ''.join(postinst) | ||
| 115 | d.setVar('pkg_postinst_%s' % pkg, postinst) | 125 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
| 116 | 126 | ||
| 117 | prerm = d.getVar('pkg_prerm_%s' % pkg) | 127 | prerm = d.getVar('pkg_prerm_%s' % pkg) |
| 118 | if not prerm: | 128 | if not prerm: |
| 119 | prerm = '#!/bin/sh\n' | 129 | prerm = '#!/bin/sh\n' |
| 120 | prerm += localdata.getVar('updatercd_prerm') | 130 | prerm = prerm.splitlines(True) |
| 131 | try: | ||
| 132 | index = prerm.index('# Begin section update-alternatives\n') | ||
| 133 | prerm.insert(index, localdata.getVar('updatercd_prerm')) | ||
| 134 | except ValueError: | ||
| 135 | prerm.append(localdata.getVar('updatercd_prerm')) | ||
| 136 | prerm = ''.join(prerm) | ||
| 121 | d.setVar('pkg_prerm_%s' % pkg, prerm) | 137 | d.setVar('pkg_prerm_%s' % pkg, prerm) |
| 122 | 138 | ||
| 123 | postrm = d.getVar('pkg_postrm_%s' % pkg) | 139 | postrm = d.getVar('pkg_postrm_%s' % pkg) |
