3 # Install debian/init[.d], and set up the postinst and postrm for init
6 BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
10 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
11 $TMP=tmpdir($PACKAGE);
12 # Debstd used either name, so do we for back-compatability.
13 $init=pkgfile($PACKAGE,"init") || pkgfile($PACKAGE,"init.d");
16 if (! -d "$TMP/etc/init.d") {
17 doit("install","-d","$TMP/etc/init.d");
20 # Figure out what filename to install it as.
23 # -d on the command line sets D_FLAG. We will
24 # remove a trailing 'd' from the package name and
25 # use that as the name.
27 if ($script=~m/(.*)d$/) {
31 warning("\"$PACKAGE\" has no final `d' in its name, but -d was specified.");
34 elsif ($dh{INIT_SCRIPT}) {
35 $script=$dh{INIT_SCRIPT};
40 doit("install","-p","-m755",$init,"$TMP/etc/init.d/$script");
42 # This is set by the -u "foo" command line switch, it's
43 # the parameters to pass to update-rc.d. If not set,
44 # we have to say "defaults".
46 if (defined($dh{U_PARAMS})) {
47 $params=join(' ',@{$dh{U_PARAMS}});
53 if (! $dh{NOSCRIPTS}) {
54 # -r on the command line sets R_FLAG. If it's set, there
55 # is no restart on upgrade.
57 autoscript($PACKAGE,"postinst","postinst-init-norestart",
58 "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
59 autoscript($PACKAGE,"postrm","postrm-init",
60 "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
63 autoscript($PACKAGE,"postinst","postinst-init",
64 "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
65 autoscript($PACKAGE,"postrm","postrm-init",
66 "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
67 autoscript($PACKAGE,"prerm","prerm-init",
68 "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");