diff options
Diffstat (limited to 'meta/classes/update-rc.d.bbclass')
-rw-r--r-- | meta/classes/update-rc.d.bbclass | 76 |
1 files changed, 20 insertions, 56 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass index 9ba3daccaf..0a3a608662 100644 --- a/meta/classes/update-rc.d.bbclass +++ b/meta/classes/update-rc.d.bbclass @@ -1,11 +1,11 @@ UPDATERCPN ?= "${PN}" -DEPENDS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', ' update-rc.d initscripts', '', d)}" +DEPENDS:append:class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', ' update-rc.d initscripts', '', d)}" UPDATERCD = "update-rc.d" -UPDATERCD_class-cross = "" -UPDATERCD_class-native = "" -UPDATERCD_class-nativesdk = "" +UPDATERCD:class-cross = "" +UPDATERCD:class-native = "" +UPDATERCD:class-nativesdk = "" INITSCRIPT_PARAMS ?= "defaults" @@ -20,24 +20,9 @@ def use_updatercd(d): return '[ -n "$D" -o ! -d /run/systemd/system ]' return 'true' -updatercd_preinst() { -if ${@use_updatercd(d)} && [ -z "$D" -a -f "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then - ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : -fi -if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then - if [ -n "$D" ]; then - OPT="-f -r $D" - else - OPT="-f" - fi - update-rc.d $OPT ${INITSCRIPT_NAME} remove -fi -} - PACKAGE_WRITE_DEPS += "update-rc.d-native" updatercd_postinst() { -# Begin section update-rc.d if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then if [ -n "$D" ]; then OPT="-r $D" @@ -46,15 +31,12 @@ if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then fi update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} fi -# End section update-rc.d } updatercd_prerm() { -# Begin section update-rc.d if ${@use_updatercd(d)} && [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : fi -# End section update-rc.d } updatercd_postrm() { @@ -80,10 +62,10 @@ python __anonymous() { update_rc_after_parse(d) } -PACKAGESPLITFUNCS_prepend = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'populate_packages_updatercd ', '', d)}" -PACKAGESPLITFUNCS_remove_class-nativesdk = "populate_packages_updatercd " +PACKAGESPLITFUNCS:prepend = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'populate_packages_updatercd ', '', d)}" +PACKAGESPLITFUNCS:remove:class-nativesdk = "populate_packages_updatercd " -populate_packages_updatercd[vardeps] += "updatercd_prerm updatercd_postrm updatercd_preinst updatercd_postinst" +populate_packages_updatercd[vardeps] += "updatercd_prerm updatercd_postrm updatercd_postinst" populate_packages_updatercd[vardepsexclude] += "OVERRIDES" python populate_packages_updatercd () { @@ -96,10 +78,10 @@ python populate_packages_updatercd () { statement = "grep -q -w '/etc/init.d/functions' %s" % path if subprocess.call(statement, shell=True) == 0: mlprefix = d.getVar('MLPREFIX') or "" - d.appendVar('RDEPENDS_' + pkg, ' %sinitscripts-functions' % (mlprefix)) + d.appendVar('RDEPENDS:' + pkg, ' %sinitd-functions' % (mlprefix)) def update_rcd_package(pkg): - bb.debug(1, 'adding update-rc.d calls to preinst/postinst/prerm/postrm for %s' % pkg) + bb.debug(1, 'adding update-rc.d calls to postinst/prerm/postrm for %s' % pkg) localdata = bb.data.createCopy(d) overrides = localdata.getVar("OVERRIDES") @@ -107,43 +89,25 @@ python populate_packages_updatercd () { update_rcd_auto_depend(pkg) - preinst = d.getVar('pkg_preinst_%s' % pkg) - if not preinst: - preinst = '#!/bin/sh\n' - preinst += localdata.getVar('updatercd_preinst') - d.setVar('pkg_preinst_%s' % pkg, preinst) - - postinst = d.getVar('pkg_postinst_%s' % pkg) + postinst = d.getVar('pkg_postinst:%s' % pkg) if not postinst: postinst = '#!/bin/sh\n' - postinst = postinst.splitlines(True) - try: - index = postinst.index('# End section update-alternatives\n') - postinst.insert(index + 1, localdata.getVar('updatercd_postinst')) - except ValueError: - postinst.append(localdata.getVar('updatercd_postinst')) - postinst = ''.join(postinst) - d.setVar('pkg_postinst_%s' % pkg, postinst) - - prerm = d.getVar('pkg_prerm_%s' % pkg) + postinst += localdata.getVar('updatercd_postinst') + d.setVar('pkg_postinst:%s' % pkg, postinst) + + prerm = d.getVar('pkg_prerm:%s' % pkg) if not prerm: prerm = '#!/bin/sh\n' - prerm = prerm.splitlines(True) - try: - index = prerm.index('# Begin section update-alternatives\n') - prerm.insert(index, localdata.getVar('updatercd_prerm')) - except ValueError: - prerm.append(localdata.getVar('updatercd_prerm')) - prerm = ''.join(prerm) - d.setVar('pkg_prerm_%s' % pkg, prerm) - - postrm = d.getVar('pkg_postrm_%s' % pkg) + prerm += localdata.getVar('updatercd_prerm') + d.setVar('pkg_prerm:%s' % pkg, prerm) + + postrm = d.getVar('pkg_postrm:%s' % pkg) if not postrm: postrm = '#!/bin/sh\n' postrm += localdata.getVar('updatercd_postrm') - d.setVar('pkg_postrm_%s' % pkg, postrm) + d.setVar('pkg_postrm:%s' % pkg, postrm) - d.appendVar('RRECOMMENDS_' + pkg, " ${MLPREFIX}${UPDATERCD}") + d.appendVar('RRECOMMENDS:' + pkg, " ${MLPREFIX}${UPDATERCD}") # Check that this class isn't being inhibited (generally, by # systemd.bbclass) before doing any work. |