summaryrefslogtreecommitdiffstats
path: root/meta/classes/update-rc.d.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-07-21 10:10:31 +0000
committerRichard Purdie <richard@openedhand.com>2006-07-21 10:10:31 +0000
commitb2f192faabe412adce79534e22efe9fb69ee40e2 (patch)
tree7076c49d4286f8a1733650bd8fbc7161af200d57 /meta/classes/update-rc.d.bbclass
parent2cf0eadf9f730027833af802d7e6c90b44248f80 (diff)
downloadpoky-b2f192faabe412adce79534e22efe9fb69ee40e2.tar.gz
Rename /openembedded/ -> /meta/
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@530 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/update-rc.d.bbclass')
-rw-r--r--meta/classes/update-rc.d.bbclass69
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
new file mode 100644
index 0000000000..0bfba467c1
--- /dev/null
+++ b/meta/classes/update-rc.d.bbclass
@@ -0,0 +1,69 @@
1DEPENDS_append = " update-rc.d"
2RDEPENDS_append = " update-rc.d"
3
4INITSCRIPT_PARAMS ?= "defaults"
5
6INIT_D_DIR = "${sysconfdir}/init.d"
7
8updatercd_postinst() {
9if test "x$D" != "x"; then
10 D="-r $D"
11else
12 D="-s"
13fi
14update-rc.d $D ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
15}
16
17updatercd_prerm() {
18if test "x$D" != "x"; then
19 D="-r $D"
20else
21 ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
22fi
23}
24
25updatercd_postrm() {
26update-rc.d $D ${INITSCRIPT_NAME} remove
27}
28
29python __anonymous() {
30 if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None:
31 if bb.data.getVar('INITSCRIPT_NAME', d) == None:
32 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d)
33 if bb.data.getVar('INITSCRIPT_PARAMS', d) == None:
34 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % bb.data.getVar('FILE', d)
35}
36
37python populate_packages_prepend () {
38 def update_rcd_package(pkg):
39 bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
40 localdata = bb.data.createCopy(d)
41 overrides = bb.data.getVar("OVERRIDES", localdata, 1)
42 bb.data.setVar("OVERRIDES", "%s:%s" % (pkg, overrides), localdata)
43 bb.data.update_data(localdata)
44
45 postinst = bb.data.getVar('pkg_postinst', localdata, 1)
46 if not postinst:
47 postinst = '#!/bin/sh\n'
48 postinst += bb.data.getVar('updatercd_postinst', localdata, 1)
49 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
50 prerm = bb.data.getVar('pkg_prerm', localdata, 1)
51 if not prerm:
52 prerm = '#!/bin/sh\n'
53 prerm += bb.data.getVar('updatercd_prerm', localdata, 1)
54 bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d)
55 postrm = bb.data.getVar('pkg_postrm', localdata, 1)
56 if not postrm:
57 postrm = '#!/bin/sh\n'
58 postrm += bb.data.getVar('updatercd_postrm', localdata, 1)
59 bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
60
61 pkgs = bb.data.getVar('INITSCRIPT_PACKAGES', d, 1)
62 if pkgs == None:
63 pkgs = bb.data.getVar('PN', d, 1)
64 packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
65 if not pkgs in packages and packages != []:
66 pkgs = packages[0]
67 for pkg in pkgs.split():
68 update_rcd_package(pkg)
69}