summaryrefslogtreecommitdiffstats
path: root/meta/classes/update-rc.d.bbclass
diff options
context:
space:
mode:
authorSaul Wold <sgw@linux.intel.com>2013-02-07 14:54:13 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-08 14:50:36 +0000
commitd69d193a962e65c1ef8d22350d899431cde434ef (patch)
treef9ef610dbcab4cc903afceaa6ec37d24dd434373 /meta/classes/update-rc.d.bbclass
parent2d35828af073fcf7735234a03bd23d2f80f4c16e (diff)
downloadpoky-d69d193a962e65c1ef8d22350d899431cde434ef.tar.gz
Revert: update-rc.d: disable update-rc.d.bbclass when systemd enabled
This was just wrong - when systemd is being used there'll still be packages that use SysV-style init scripts, which systemd supports fine. This reverts commit b94227f7290796f6ebbe5c5ff1680b9b689022b1. (From OE-Core rev: 3f50b61c77406f87d36437cca53573f86f314641) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/update-rc.d.bbclass')
-rw-r--r--meta/classes/update-rc.d.bbclass87
1 files changed, 86 insertions, 1 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index 34f9838084..f9d55fbec8 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -1 +1,86 @@
1inherit ${@base_contains('DISTRO_FEATURES','sysvinit','update-rc.d_real','',d)} 1UPDATERCPN ?= "${PN}"
2
3DEPENDS_append = " update-rc.d-native"
4UPDATERCD = "update-rc.d"
5UPDATERCD_virtclass-cross = ""
6UPDATERCD_class-native = ""
7UPDATERCD_class-nativesdk = ""
8
9RDEPENDS_${UPDATERCPN}_append = " ${UPDATERCD}"
10
11INITSCRIPT_PARAMS ?= "defaults"
12
13INIT_D_DIR = "${sysconfdir}/init.d"
14
15updatercd_postinst() {
16if test "x$D" != "x"; then
17 OPT="-r $D"
18else
19 OPT="-s"
20fi
21update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
22}
23
24updatercd_prerm() {
25if test "x$D" = "x"; then
26 ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
27fi
28}
29
30updatercd_postrm() {
31if [ "$D" != "" ]; then
32 update-rc.d -f -r $D ${INITSCRIPT_NAME} remove
33else
34 update-rc.d ${INITSCRIPT_NAME} remove
35fi
36}
37
38
39def update_rc_after_parse(d):
40 if d.getVar('INITSCRIPT_PACKAGES') == None:
41 if d.getVar('INITSCRIPT_NAME') == None:
42 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % d.getVar('FILE')
43 if d.getVar('INITSCRIPT_PARAMS') == None:
44 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % d.getVar('FILE')
45
46python __anonymous() {
47 update_rc_after_parse(d)
48}
49
50PACKAGESPLITFUNCS_prepend = "populate_packages_updatercd "
51
52python populate_packages_updatercd () {
53 def update_rcd_package(pkg):
54 bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
55 """
56 update_rc.d postinst is appended here because pkg_postinst may require to
57 execute on the target. Not doing so may cause update_rc.d postinst invoked
58 twice to cause unwanted warnings.
59 """
60 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
61 if not postinst:
62 postinst = '#!/bin/sh\n'
63 postinst += d.getVar('updatercd_postinst', True)
64 d.setVar('pkg_postinst_%s' % pkg, postinst)
65
66 prerm = d.getVar('pkg_prerm_%s' % pkg, True) or d.getVar('pkg_prerm', True)
67 if not prerm:
68 prerm = '#!/bin/sh\n'
69 prerm += d.getVar('updatercd_prerm', True)
70 d.setVar('pkg_prerm_%s' % pkg, prerm)
71
72 postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True)
73 if not postrm:
74 postrm = '#!/bin/sh\n'
75 postrm += d.getVar('updatercd_postrm', True)
76 d.setVar('pkg_postrm_%s' % pkg, postrm)
77
78 pkgs = d.getVar('INITSCRIPT_PACKAGES', True)
79 if pkgs == None:
80 pkgs = d.getVar('UPDATERCPN', True)
81 packages = (d.getVar('PACKAGES', True) or "").split()
82 if not pkgs in packages and packages != []:
83 pkgs = packages[0]
84 for pkg in pkgs.split():
85 update_rcd_package(pkg)
86}