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
13 if [ -e debian/${EXT}init ]; then
14 if [ ! -d $TMP/etc/init.d ]; then
15 doit "install -d $TMP/etc/init.d"
18 # Figure out what filename to install it as.
19 if [ "$DH_D_FLAG" ]; then
20 # -d on the command line sets DH_D_FLAG. We will
21 # remove a trailing 'd' from the package name and
22 # use that as the name.
23 script=`expr $PACKAGE : '\(.*\)d$'` || true
24 if [ ! "$script" ]; then
25 echo `basename $0`" warning: \"$PACKAGE\" has no final -d, but -d was specified."
31 doit "install -p -m755 debian/${EXT}init $TMP/etc/init.d/$script"
33 # This is set by the -u "foo" command line switch, it's
34 # the parameters to pass to update-rc.d. If not set,
35 # we have to say "defaults".
36 if [ "$DH_U_PARAMS" = "" ]; then
37 DH_U_PARAMS="defaults"
40 # -r on the command line sets DH_R_FLAG. If it's set, there
41 # is no restart on upgrade.
42 if [ ! "$DH_NOSCRIPTS" ]; then
43 if [ "$DH_R_FLAG" ]; then
44 autoscript "postinst" "postinst-init-norestart" \
45 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
46 autoscript "postrm" "postrm-init" \
47 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
49 autoscript "postinst" "postinst-init" \
50 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
51 autoscript "postrm" "postrm-init" \
52 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
53 autoscript "prerm" "prerm-init" \
54 "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"