summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Blundell <philb@gnu.org>2004-07-31 16:40:04 +0000
committerPhil Blundell <philb@gnu.org>2004-07-31 16:40:04 +0000
commitb10166c6424c2a5d231a583131a55491d0e51fdc (patch)
tree29fee6767c9d79d3c56fb28708a4d212c52d021b
parent733890f900f8d01609f6bf00bc4bfe72730306e2 (diff)
use update-rc.d -s
BKrev: 410bcb64j5kCqOlh54G-BnPVqerpww
-rw-r--r--classes/update-rc.d.oeclass42
1 files changed, 42 insertions, 0 deletions
diff --git a/classes/update-rc.d.oeclass b/classes/update-rc.d.oeclass
index e69de29bb2..341eb3c3fb 100644
--- a/classes/update-rc.d.oeclass
+++ b/classes/update-rc.d.oeclass
@@ -0,0 +1,42 @@
+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"
+fi
+update-rc.d -s $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 oe.data.getVar('INITSCRIPT_NAME', d) == None:
+ raise oe.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % oe.data.getVar('FILE', d)
+ if oe.data.getVar('INITSCRIPT_PARAMS', d) == None:
+ raise oe.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % oe.data.getVar('FILE', d)
+}
+
+python populate_packages_prepend () {
+ pkg = oe.data.getVar('PN', d, 1)
+ oe.note('adding update-rc.d calls to postinst/postrm for %s' % pkg)
+ postinst = oe.data.getVar('pkg_postinst_%s' % pkg, d, 1) or oe.data.getVar('pkg_postinst', d, 1)
+ if not postinst:
+ postinst = '#!/bin/sh\n'
+ postinst += oe.data.getVar('updatercd_postinst', d, 1)
+ oe.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
+ postrm = oe.data.getVar('pkg_postrm_%s' % pkg, d, 1) or oe.data.getVar('pkg_postrm', d, 1)
+ if not postrm:
+ postrm = '#!/bin/sh\n'
+ postrm += oe.data.getVar('updatercd_postrm', d, 1)
+ oe.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
+}