summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadu Moisan <radu.moisan@intel.com>2013-01-19 22:47:10 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-20 12:58:55 +0000
commitb94227f7290796f6ebbe5c5ff1680b9b689022b1 (patch)
tree5bab234508458161e57552a863433fccdf1083dd
parent5b2e201736325ffc7c68e3659448d032bd1968d0 (diff)
downloadpoky-b94227f7290796f6ebbe5c5ff1680b9b689022b1.tar.gz
update-rc.d: disable update-rc.d.bbclass when systemd enabled
update-rc.d is not necessary when systemd is enabled, systemctl is the replacement (From OE-Core rev: eaa82c842d3197e0251a887ba16028c22f9d8d94) Signed-off-by: Radu Moisan <radu.moisan@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/update-rc.d.bbclass90
-rw-r--r--meta/classes/update-rc.d_real.bbclass89
2 files changed, 90 insertions, 89 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index 83816d6ad6..34f9838084 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -1,89 +1 @@
1UPDATERCPN ?= "${PN}" inherit ${@base_contains('DISTRO_FEATURES','sysvinit','update-rc.d_real','',d)}
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
50python populate_packages_prepend () {
51 def update_rcd_package(pkg):
52 bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
53 localdata = bb.data.createCopy(d)
54 overrides = localdata.getVar("OVERRIDES", True)
55 localdata.setVar("OVERRIDES", "%s:%s" % (pkg, overrides))
56 bb.data.update_data(localdata)
57
58 """
59 update_rc.d postinst is appended here because pkg_postinst may require to
60 execute on the target. Not doing so may cause update_rc.d postinst invoked
61 twice to cause unwanted warnings.
62 """
63 postinst = localdata.getVar('pkg_postinst', True)
64 if not postinst:
65 postinst = '#!/bin/sh\n'
66 postinst += localdata.getVar('updatercd_postinst', True)
67 d.setVar('pkg_postinst_%s' % pkg, postinst)
68
69 prerm = localdata.getVar('pkg_prerm', True)
70 if not prerm:
71 prerm = '#!/bin/sh\n'
72 prerm += localdata.getVar('updatercd_prerm', True)
73 d.setVar('pkg_prerm_%s' % pkg, prerm)
74
75 postrm = localdata.getVar('pkg_postrm', True)
76 if not postrm:
77 postrm = '#!/bin/sh\n'
78 postrm += localdata.getVar('updatercd_postrm', True)
79 d.setVar('pkg_postrm_%s' % pkg, postrm)
80
81 pkgs = d.getVar('INITSCRIPT_PACKAGES', True)
82 if pkgs == None:
83 pkgs = d.getVar('UPDATERCPN', True)
84 packages = (d.getVar('PACKAGES', True) or "").split()
85 if not pkgs in packages and packages != []:
86 pkgs = packages[0]
87 for pkg in pkgs.split():
88 update_rcd_package(pkg)
89}
diff --git a/meta/classes/update-rc.d_real.bbclass b/meta/classes/update-rc.d_real.bbclass
new file mode 100644
index 0000000000..83816d6ad6
--- /dev/null
+++ b/meta/classes/update-rc.d_real.bbclass
@@ -0,0 +1,89 @@
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
50python populate_packages_prepend () {
51 def update_rcd_package(pkg):
52 bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
53 localdata = bb.data.createCopy(d)
54 overrides = localdata.getVar("OVERRIDES", True)
55 localdata.setVar("OVERRIDES", "%s:%s" % (pkg, overrides))
56 bb.data.update_data(localdata)
57
58 """
59 update_rc.d postinst is appended here because pkg_postinst may require to
60 execute on the target. Not doing so may cause update_rc.d postinst invoked
61 twice to cause unwanted warnings.
62 """
63 postinst = localdata.getVar('pkg_postinst', True)
64 if not postinst:
65 postinst = '#!/bin/sh\n'
66 postinst += localdata.getVar('updatercd_postinst', True)
67 d.setVar('pkg_postinst_%s' % pkg, postinst)
68
69 prerm = localdata.getVar('pkg_prerm', True)
70 if not prerm:
71 prerm = '#!/bin/sh\n'
72 prerm += localdata.getVar('updatercd_prerm', True)
73 d.setVar('pkg_prerm_%s' % pkg, prerm)
74
75 postrm = localdata.getVar('pkg_postrm', True)
76 if not postrm:
77 postrm = '#!/bin/sh\n'
78 postrm += localdata.getVar('updatercd_postrm', True)
79 d.setVar('pkg_postrm_%s' % pkg, postrm)
80
81 pkgs = d.getVar('INITSCRIPT_PACKAGES', True)
82 if pkgs == None:
83 pkgs = d.getVar('UPDATERCPN', True)
84 packages = (d.getVar('PACKAGES', True) or "").split()
85 if not pkgs in packages and packages != []:
86 pkgs = packages[0]
87 for pkg in pkgs.split():
88 update_rcd_package(pkg)
89}