[Pkg-sysvinit-commits] r841 - in sysvinit/trunk/debian: .
sysv-rc/sbin
Petter Reinholdtsen
pere at costa.debian.org
Wed Sep 6 06:57:27 UTC 2006
Author: pere
Date: 2006-09-06 06:57:25 +0000 (Wed, 06 Sep 2006)
New Revision: 841
Modified:
sysvinit/trunk/debian/changelog
sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
Log:
* Modify update-rc.d to run properly with perl error checking enabled.
Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog 2006-09-05 23:09:19 UTC (rev 840)
+++ sysvinit/trunk/debian/changelog 2006-09-06 06:57:25 UTC (rev 841)
@@ -41,6 +41,7 @@
Scott James Remnant and Ubuntu.
* Add empty functions pre_mountall and post_mountall to reduce the
difference between the Ubuntu version
+ * Modify update-rc.d to run properly with perl error checking enabled.
-- Petter Reinholdtsen <pere at debian.org> Wed, 26 Jul 2006 11:37:23 +0200
Modified: sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
===================================================================
--- sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d 2006-09-05 23:09:19 UTC (rev 840)
+++ sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d 2006-09-06 06:57:25 UTC (rev 841)
@@ -3,10 +3,13 @@
# update-rc.d Update the links in /etc/rc[0-9S].d/
#
-$initd = "/etc/init.d";
-$etcd = "/etc/rc";
-$notreally = 0;
+use strict;
+use warnings;
+my $initd = "/etc/init.d";
+my $etcd = "/etc/rc";
+my $notreally = 0;
+
# Print usage message and die.
sub usage {
@@ -22,6 +25,7 @@
}
# Check out options.
+my $force;
while($#ARGV >= 0 && ($_ = $ARGV[0]) =~ /^-/) {
shift @ARGV;
@@ -34,7 +38,7 @@
# Action.
&usage() if ($#ARGV < 1);
-$bn = shift @ARGV;
+my $bn = shift @ARGV;
if ($ARGV[0] ne 'remove') {
if (! -f "$initd/$bn") {
print STDERR "update-rc.d: $initd/$bn: file does not exist\n";
@@ -47,6 +51,9 @@
}
}
+my @startlinks;
+my @stoplinks;
+
$_ = $ARGV[0];
if (/^remove$/) { &checklinks ("remove"); }
elsif (/^defaults$/) { &defaults; &makelinks }
@@ -65,7 +72,7 @@
print STDERR "update-rc.d: warning: $fn is not a symbolic link\n";
return 0;
} else {
- $linkdst = readlink ($fn);
+ my $linkdst = readlink ($fn);
if (! defined $linkdst) {
die ("update-rc.d: error reading symbolic link: $!\n");
}
@@ -81,7 +88,7 @@
my ($i, $found, $fn, $islnk);
print " Removing any system startup links for $initd/$bn ...\n"
- if ($_[0] eq 'remove');
+ if (defined $_[0] && $_[0] eq 'remove');
$found = 0;
@@ -96,7 +103,7 @@
$fn = "$etcd$i.d/$_";
$found = 1;
$islnk = &is_link ($_[0], $fn, $bn);
- next if ($_[0] ne 'remove');
+ next if (defined $_[0] and $_[0] ne 'remove');
if (! $islnk) {
print " $fn is not a link to ../init.d/$bn; not removing\n";
next;
@@ -189,9 +196,9 @@
for($t = 0; $t < 2; $t++) {
@links = $t ? @startlinks : @stoplinks;
for($i = 0; $i <= $#links; $i++) {
- $lvl = $i;
+ my $lvl = $i;
$lvl = 'S' if ($i == 99);
- next if ($links[$i] eq '');
+ next if (!defined $links[$i] or $links[$i] eq '');
print " $etcd$lvl.d/$links[$i]$bn -> ../init.d/$bn\n";
next if ($notreally);
symlink("../init.d/$bn", "$etcd$lvl.d/$links[$i]$bn")
More information about the Pkg-sysvinit-commits
mailing list