Hello, now the default behaviour for update-rc.d with option "defaults" is parse the LSB Headers, therefore we can leave blank the options for dh_installlinit and it will pass the option "defaults" to update-rc.d, but when update-rc.d works in legacy mode, dh_installinit should write the start and stop values, obtained from parsing the LSB headers.
we can allways leave blank the dh_installinit "start and stop" options and it will parse LSB headers and pass the correct options when using the attached patch. patch ****************** --- debhelper-8.0.0/dh_installinit 2010-06-24 02:35:34.000000000 +0200 +++ debhelper-8.0.0.lnet.1/dh_installinit 2010-12-27 15:40:32.000000000 +0100 @@ -98,8 +98,9 @@ =item B<--> I<params> -Pass "params" to L<update-rc.d(8)>. If not specified, "defaults" will be -passed to L<update-rc.d(8)>. +Pass "params" to L<update-rc.d(8)>. If "defaults" or not specified; the values from +the init script headers "Default-Start:" and "Default-Stop:" will be parsed +and passed to L<update-rc.d(8)>. =item B<--name=>I<name> @@ -138,6 +139,29 @@ =cut +sub defaults{ + my $ifile = $_[0]; + my $begin = ''; + my $start = ''; + my $stop = ''; + open(FILE,$ifile) + || die "cannot open file"; + while(<FILE>) { + if ($begin) { + last if /^### END INIT INFO/; + $start = $_ if $start eq '' && s/^# Default-Start: \s+([S0-6]+.*)\n/start 01 $1 ./; + $stop = $_ if $stop eq '' && s/^# Default-Stop: \s+([S0-6]+.*)\n/stop 01 $1 ./; + } else { + $begin = "y" if /^### BEGIN INIT INFO/; + } + } + close(FILE); + + my $result = "$start $stop"; + s/^\s+|\s+$//, s/\s+/ /g for $result; + return $result; +}; + init(options => { "r" => \$dh{R_FLAG}, "no-restart-on-upgrade" => \$dh{R_FLAG}, @@ -230,8 +254,8 @@ if (defined($dh{U_PARAMS})) { $params=join(' ',@{$dh{U_PARAMS}}); } - if ($params eq '') { - $params="defaults"; + if ($params eq '' || $params =~ /defaults/) { + $params=defaults($init); } if (! $dh{NOSCRIPTS}) { ****************** Regards, Jordi Pujol Live never ending Tale GNU/Linux Live forever! http://livenet.selfip.com
--- debhelper-8.0.0/dh_installinit 2010-06-24 02:35:34.000000000 +0200 +++ debhelper-8.0.0.lnet.1/dh_installinit 2010-12-27 15:40:32.000000000 +0100 @@ -98,8 +98,9 @@ =item B<--> I<params> -Pass "params" to L<update-rc.d(8)>. If not specified, "defaults" will be -passed to L<update-rc.d(8)>. +Pass "params" to L<update-rc.d(8)>. If "defaults" or not specified; the values from +the init script headers "Default-Start:" and "Default-Stop:" will be parsed +and passed to L<update-rc.d(8)>. =item B<--name=>I<name> @@ -138,6 +139,29 @@ =cut +sub defaults{ + my $ifile = $_[0]; + my $begin = ''; + my $start = ''; + my $stop = ''; + open(FILE,$ifile) + || die "cannot open file"; + while(<FILE>) { + if ($begin) { + last if /^### END INIT INFO/; + $start = $_ if $start eq '' && s/^# Default-Start:\s+([S0-6]+.*)\n/start 01 $1 ./; + $stop = $_ if $stop eq '' && s/^# Default-Stop:\s+([S0-6]+.*)\n/stop 01 $1 ./; + } else { + $begin = "y" if /^### BEGIN INIT INFO/; + } + } + close(FILE); + + my $result = "$start $stop"; + s/^\s+|\s+$//, s/\s+/ /g for $result; + return $result; +}; + init(options => { "r" => \$dh{R_FLAG}, "no-restart-on-upgrade" => \$dh{R_FLAG}, @@ -230,8 +254,8 @@ if (defined($dh{U_PARAMS})) { $params=join(' ',@{$dh{U_PARAMS}}); } - if ($params eq '') { - $params="defaults"; + if ($params eq '' || $params =~ /defaults/) { + $params=defaults($init); } if (! $dh{NOSCRIPTS}) {