3 # Install debian/init[.d], and set up the postinst and postrm for init
6 PATH=debian:$PATH:/usr/lib/debhelper
9 for PACKAGE in $DH_DOPACKAGES; do
11 init=`pkgfile $PACKAGE init`
13 # This is for backwards compatability with debstd, which used either
15 if [ ! "$init" ]; then
16 init=`pkgfile $PACKAGE init.d`
20 if [ ! -d $TMP/etc/init.d ]; then
21 doit "install -d $TMP/etc/init.d"
24 # Figure out what filename to install it as.
25 if [ "$DH_D_FLAG" ]; then
26 # -d on the command line sets DH_D_FLAG. We will
27 # remove a trailing 'd' from the package name and
28 # use that as the name.
29 script=`expr $PACKAGE : '\(.*\)d$'` || true
30 if [ ! "$script" ]; then
31 echo `basename $0`" warning: \"$PACKAGE\" has no final -d, but -d was specified."
34 elif [ "$DH_INIT_SCRIPT" != "" ]; then
35 script=$DH_INIT_SCRIPT
39 doit "install -p -m755 $init $TMP/etc/init.d/$script"
41 # This is set by the -u "foo" command line switch, it's
42 # the parameters to pass to update-rc.d. If not set,
43 # we have to say "defaults".
44 if [ "$DH_U_PARAMS" = "" ]; then
45 DH_U_PARAMS="defaults"
48 # -r on the command line sets DH_R_FLAG. If it's set, there
49 # is no restart on upgrade.
50 if [ ! "$DH_NOSCRIPTS" ]; then
51 if [ "$DH_R_FLAG" ]; then
52 autoscript "postinst" "postinst-init-norestart" \
53 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
54 autoscript "postrm" "postrm-init" \
55 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
57 autoscript "postinst" "postinst-init" \
58 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
59 autoscript "postrm" "postrm-init" \
60 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
61 autoscript "prerm" "prerm-init" \
62 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"