summaryrefslogtreecommitdiff
path: root/classes/update-rc.d.bbclass
diff options
context:
space:
mode:
authornslu2-linux.adm@bkbits.net <nslu2-linux.adm@bkbits.net>2004-12-29 18:41:41 +0000
committernslu2-linux.adm@bkbits.net <nslu2-linux.adm@bkbits.net>2004-12-29 18:41:41 +0000
commit3775cf9797fe57174a9e841f5d42c2928c4022b3 (patch)
tree9e1822cf5beba60152a9c50576d26ecdbedab71f /classes/update-rc.d.bbclass
parent78475fad86b12b2a7d754910d915d30b522b6402 (diff)
Merge bk://oe-devel.bkbits.net/openembedded
into bkbits.net:/repos/n/nslu2-linux/openembedded 2004/12/29 13:22:16-05:00 handhelds.org!kergoth Demote the 'adding update-rc.d calls' message to debug(1,...). BKrev: 41d2fa65mMyXYfoMDBBDJZtV-8S7dA
Diffstat (limited to 'classes/update-rc.d.bbclass')
-rw-r--r--classes/update-rc.d.bbclass47
1 files changed, 47 insertions, 0 deletions
diff --git a/classes/update-rc.d.bbclass b/classes/update-rc.d.bbclass
index e69de29bb2..894db65f93 100644
--- a/classes/update-rc.d.bbclass
+++ b/classes/update-rc.d.bbclass
@@ -0,0 +1,47 @@
+DEPENDS_append = " update-rc.d"
+RDEPENDS_append = " update-rc.d"
+
+INIT_D_DIR = "${sysconfdir}/init.d"
+
+updatercd_postinst() {
+if test "x$D" != "x"; then
+ D="-r $D"
+else
+ D="-s"
+fi
+update-rc.d $D ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
+}
+
+updatercd_postrm() {
+if test "x$D" != "x"; then
+ D="-r $D"
+else
+ ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
+fi
+update-rc.d $D ${INITSCRIPT_NAME} remove
+}
+
+python __anonymous() {
+ if bb.data.getVar('INITSCRIPT_NAME', d) == None:
+ raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d)
+ if bb.data.getVar('INITSCRIPT_PARAMS', d) == None:
+ raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % bb.data.getVar('FILE', d)
+}
+
+python populate_packages_prepend () {
+ pkg = bb.data.getVar('PN', d, 1)
+ packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
+ if not pkg in packages:
+ pkg = packages[0]
+ bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
+ postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
+ if not postinst:
+ postinst = '#!/bin/sh\n'
+ postinst += bb.data.getVar('updatercd_postinst', d, 1)
+ bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
+ postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1)
+ if not postrm:
+ postrm = '#!/bin/sh\n'
+ postrm += bb.data.getVar('updatercd_postrm', d, 1)
+ bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
+}