summaryrefslogtreecommitdiff
path: root/dh_installinit
diff options
context:
space:
mode:
authorjoey <joey>1999-08-17 04:34:24 +0000
committerjoey <joey>1999-08-17 04:34:24 +0000
commit1e6dea44772a0c1f57e7cd50ff12e35a1cff0b96 (patch)
tree212e56dc8ea32cf27cd2a33ac901a92a701f063f /dh_installinit
parentface7b5d7df5fb2b8f434bc7135f27b38329a5c5 (diff)
r11: Initial revision
Diffstat (limited to 'dh_installinit')
-rwxr-xr-xdh_installinit58
1 files changed, 58 insertions, 0 deletions
diff --git a/dh_installinit b/dh_installinit
new file mode 100755
index 0000000..2ea3440
--- /dev/null
+++ b/dh_installinit
@@ -0,0 +1,58 @@
+#!/bin/sh -e
+#
+# Install debian/init[.d], and set up the postinst and postrm for init
+# scripts.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+ TMP=`tmpdir $PACKAGE`
+ EXT=`pkgext $PACKAGE`
+
+ if [ -e debian/${EXT}init ]; then
+ if [ ! -d $TMP/etc/init.d ]; then
+ doit "install -d $TMP/etc/init.d"
+ fi
+
+ # Figure out what filename to install it as.
+ if [ "$DH_D_FLAG" ]; then
+ # -d on the command line sets DH_D_FLAG. We will
+ # remove a trailing 'd' from the package name and
+ # use that as the name.
+ script=`expr $PACKAGE : '\(.*\)d$'` || true
+ if [ ! "$script" ]; then
+ echo `basename $0`" warning: \"$PACKAGE\" has no final -d, but -d was specified."
+ script=$PACKAGE
+ fi
+ else
+ script=$PACKAGE
+ fi
+ doit "install -p -m755 debian/${EXT}init $TMP/etc/init.d/$script"
+
+ # This is set by the -u "foo" command line switch, it's
+ # the parameters to pass to update-rc.d. If not set,
+ # we have to say "defaults".
+ if [ "$DH_U_PARAMS" = "" ]; then
+ DH_U_PARAMS="defaults"
+ fi
+
+ # -r on the command line sets DH_R_FLAG. If it's set, there
+ # is no restart on upgrade.
+ if [ ! "$DH_NOSCRIPTS" ]; then
+ if [ "$DH_R_FLAG" ]; then
+ autoscript "postinst" "postinst-init-norestart" \
+ "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+ autoscript "postrm" "postrm-init" \
+ "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+ else
+ autoscript "postinst" "postinst-init" \
+ "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+ autoscript "postrm" "postrm-init" \
+ "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+ autoscript "prerm" "prerm-init" \
+ "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+ fi
+ fi
+ fi
+done