summaryrefslogtreecommitdiffstats
path: root/meta/classes/update-rc.d.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/update-rc.d.bbclass')
-rw-r--r--meta/classes/update-rc.d.bbclass70
1 files changed, 37 insertions, 33 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index 0bfba467c1..df0d62c2c5 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -26,44 +26,48 @@ updatercd_postrm() {
26update-rc.d $D ${INITSCRIPT_NAME} remove 26update-rc.d $D ${INITSCRIPT_NAME} remove
27} 27}
28 28
29def update_rc_after_parse(d):
30 import bb
31 if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None:
32 if bb.data.getVar('INITSCRIPT_NAME', d) == None:
33 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d)
34 if bb.data.getVar('INITSCRIPT_PARAMS', d) == None:
35 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % bb.data.getVar('FILE', d)
36
29python __anonymous() { 37python __anonymous() {
30 if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None: 38 update_rc_after_parse(d)
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} 39}
36 40
37python populate_packages_prepend () { 41python populate_packages_prepend () {
38 def update_rcd_package(pkg): 42 def update_rcd_package(pkg):
39 bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg) 43 bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
40 localdata = bb.data.createCopy(d) 44 localdata = bb.data.createCopy(d)
41 overrides = bb.data.getVar("OVERRIDES", localdata, 1) 45 overrides = bb.data.getVar("OVERRIDES", localdata, 1)
42 bb.data.setVar("OVERRIDES", "%s:%s" % (pkg, overrides), localdata) 46 bb.data.setVar("OVERRIDES", "%s:%s" % (pkg, overrides), localdata)
43 bb.data.update_data(localdata) 47 bb.data.update_data(localdata)
44 48
45 postinst = bb.data.getVar('pkg_postinst', localdata, 1) 49 postinst = bb.data.getVar('pkg_postinst', localdata, 1)
46 if not postinst: 50 if not postinst:
47 postinst = '#!/bin/sh\n' 51 postinst = '#!/bin/sh\n'
48 postinst += bb.data.getVar('updatercd_postinst', localdata, 1) 52 postinst += bb.data.getVar('updatercd_postinst', localdata, 1)
49 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) 53 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
50 prerm = bb.data.getVar('pkg_prerm', localdata, 1) 54 prerm = bb.data.getVar('pkg_prerm', localdata, 1)
51 if not prerm: 55 if not prerm:
52 prerm = '#!/bin/sh\n' 56 prerm = '#!/bin/sh\n'
53 prerm += bb.data.getVar('updatercd_prerm', localdata, 1) 57 prerm += bb.data.getVar('updatercd_prerm', localdata, 1)
54 bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d) 58 bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d)
55 postrm = bb.data.getVar('pkg_postrm', localdata, 1) 59 postrm = bb.data.getVar('pkg_postrm', localdata, 1)
56 if not postrm: 60 if not postrm:
57 postrm = '#!/bin/sh\n' 61 postrm = '#!/bin/sh\n'
58 postrm += bb.data.getVar('updatercd_postrm', localdata, 1) 62 postrm += bb.data.getVar('updatercd_postrm', localdata, 1)
59 bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) 63 bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
60 64
61 pkgs = bb.data.getVar('INITSCRIPT_PACKAGES', d, 1) 65 pkgs = bb.data.getVar('INITSCRIPT_PACKAGES', d, 1)
62 if pkgs == None: 66 if pkgs == None:
63 pkgs = bb.data.getVar('PN', d, 1) 67 pkgs = bb.data.getVar('PN', d, 1)
64 packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() 68 packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
65 if not pkgs in packages and packages != []: 69 if not pkgs in packages and packages != []:
66 pkgs = packages[0] 70 pkgs = packages[0]
67 for pkg in pkgs.split(): 71 for pkg in pkgs.split():
68 update_rcd_package(pkg) 72 update_rcd_package(pkg)
69} 73}