blob: 2ea3440f3d680961134155777e9131a07162c4de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
|