diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2014-01-23 20:12:35 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-02 11:21:55 +0000 |
commit | de875cb8893fd8372dd77babaef54ab2d790693d (patch) | |
tree | f500589e1e96dcd470c40210bc289916856a2a13 | |
parent | f9f193219bd510160b6b09bae652a9dc8ea01e7b (diff) | |
download | openembedded-core-de875cb8893fd8372dd77babaef54ab2d790693d.tar.gz openembedded-core-de875cb8893fd8372dd77babaef54ab2d790693d.tar.bz2 openembedded-core-de875cb8893fd8372dd77babaef54ab2d790693d.zip |
update-rc.d: automatically rdepend on initscripts-funtions
Automatically add 'initscripts-functions' to packages when needed.
This extra dependency is added only when the package's init script
would be used at system start-up. In other words, in a systemd based
image, if the package has already got its service files, it will not
have this extra dependency.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
-rw-r--r-- | meta/classes/update-rc.d.bbclass | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass index c9bf04c4f8..ad803c2d82 100644 --- a/meta/classes/update-rc.d.bbclass +++ b/meta/classes/update-rc.d.bbclass @@ -71,6 +71,16 @@ PACKAGESPLITFUNCS_prepend = "populate_packages_updatercd " populate_packages_updatercd[vardeps] += "updatercd_prerm updatercd_postrm updatercd_preinst updatercd_postinst" python populate_packages_updatercd () { + def update_rcd_auto_depend(pkg): + import subprocess + import os + path = d.expand("${D}${INIT_D_DIR}/${INITSCRIPT_NAME}") + if not os.path.exists(path): + return + statement = "grep -q -w '/etc/init.d/functions' %s" % path + if subprocess.call(statement, shell=True) == 0: + d.appendVar('RDEPENDS_' + pkg, ' initscripts-functions') + def update_rcd_package(pkg): bb.debug(1, 'adding update-rc.d calls to preinst/postinst/prerm/postrm for %s' % pkg) @@ -79,6 +89,8 @@ python populate_packages_updatercd () { localdata.setVar("OVERRIDES", "%s:%s" % (pkg, overrides)) bb.data.update_data(localdata) + update_rcd_auto_depend(pkg) + preinst = d.getVar('pkg_preinst_%s' % pkg, True) if not preinst: preinst = '#!/bin/sh\n' |