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:22:11 +0000 |
| commit | 021129ab0bef2d0a5d3c0377ab1c89a934dec86f (patch) | |
| tree | c93b0fcc5f9f01e8439b224ed75d833fed23902a | |
| parent | 85b3ba930dccbd6df7cbc9ef6e91ea393b3f89d4 (diff) | |
| download | poky-021129ab0bef2d0a5d3c0377ab1c89a934dec86f.tar.gz | |
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.
(From OE-Core rev: de875cb8893fd8372dd77babaef54ab2d790693d)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -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 " | |||
| 71 | populate_packages_updatercd[vardeps] += "updatercd_prerm updatercd_postrm updatercd_preinst updatercd_postinst" | 71 | populate_packages_updatercd[vardeps] += "updatercd_prerm updatercd_postrm updatercd_preinst updatercd_postinst" |
| 72 | 72 | ||
| 73 | python populate_packages_updatercd () { | 73 | python populate_packages_updatercd () { |
| 74 | def update_rcd_auto_depend(pkg): | ||
| 75 | import subprocess | ||
| 76 | import os | ||
| 77 | path = d.expand("${D}${INIT_D_DIR}/${INITSCRIPT_NAME}") | ||
| 78 | if not os.path.exists(path): | ||
| 79 | return | ||
| 80 | statement = "grep -q -w '/etc/init.d/functions' %s" % path | ||
| 81 | if subprocess.call(statement, shell=True) == 0: | ||
| 82 | d.appendVar('RDEPENDS_' + pkg, ' initscripts-functions') | ||
| 83 | |||
| 74 | def update_rcd_package(pkg): | 84 | def update_rcd_package(pkg): |
| 75 | bb.debug(1, 'adding update-rc.d calls to preinst/postinst/prerm/postrm for %s' % pkg) | 85 | bb.debug(1, 'adding update-rc.d calls to preinst/postinst/prerm/postrm for %s' % pkg) |
| 76 | 86 | ||
| @@ -79,6 +89,8 @@ python populate_packages_updatercd () { | |||
| 79 | localdata.setVar("OVERRIDES", "%s:%s" % (pkg, overrides)) | 89 | localdata.setVar("OVERRIDES", "%s:%s" % (pkg, overrides)) |
| 80 | bb.data.update_data(localdata) | 90 | bb.data.update_data(localdata) |
| 81 | 91 | ||
| 92 | update_rcd_auto_depend(pkg) | ||
| 93 | |||
| 82 | preinst = d.getVar('pkg_preinst_%s' % pkg, True) | 94 | preinst = d.getVar('pkg_preinst_%s' % pkg, True) |
| 83 | if not preinst: | 95 | if not preinst: |
| 84 | preinst = '#!/bin/sh\n' | 96 | preinst = '#!/bin/sh\n' |
