Here is Kel's patch updated against current sources.

diff --git i/debian/src/sysv-rc/man8/update-rc.d.8 w/debian/src/sysv-rc/man8/update-rc.d.8
index 2562a53..b750ddb 100644
--- i/debian/src/sysv-rc/man8/update-rc.d.8
+++ w/debian/src/sysv-rc/man8/update-rc.d.8
@@ -5,16 +5,19 @@
 update\-rc.d \- install and remove System\-V style init script links
 .SH "SYNOPSIS"
 .B update\-rc.d
+.RI [ "\-d dir" ]
 .RI [ \-n ]
 .RI [ \-f ]
 .IB name " remove"
 .HP
 .B update\-rc.d
+.RI [ "\-d dir" ]
 .RI [ \-n ]
 .IB name " defaults"
 .RI [ NN " | " SS " " KK ]
 .HP
 .B update\-rc.d
+.RI [ "\-d dir" ]
 .RI [ \-n ]
 .I name
 .BR start | stop
@@ -25,6 +28,7 @@ update\-rc.d \- install and remove System\-V style init script links
 .BR . " ..."
 .HP
 .B update\-rc.d
+.RI [ "\-d dir" ]
 .RI [ \-n ]
 .IB name " disable|enable "
 .RI [ " S|2|3|4|5 " ]
@@ -239,6 +243,11 @@ keywords, the script will attempt to modify links in all start runlevels.
 
 .SH "OPTIONS"
 .TP 
+.I -d dir
+Path to alternative root directory (instead of /).  Actions are
+performed on init scripts and runlevel directories relative to this
+directory.
+.TP 
 .I \-n
 Don't do anything, just show what we would do.
 .TP 
diff --git i/debian/src/sysv-rc/sbin/update-rc.d w/debian/src/sysv-rc/sbin/update-rc.d
index 96bb41f..4723852 100755
--- i/debian/src/sysv-rc/sbin/update-rc.d
+++ w/debian/src/sysv-rc/sbin/update-rc.d
@@ -6,8 +6,9 @@
 use strict;
 use warnings;
 
-my $initd = "/etc/init.d";
-my $etcd  = "/etc/rc";
+my $dir = "/";
+my $initd = "etc/init.d";
+my $etcd  = "etc/rc";
 my $notreally = 0;
 
 # Save last action to this directory
@@ -18,10 +19,11 @@ my $archive = "/var/lib/update-rc.d";
 sub usage {
 	print STDERR "update-rc.d: error: @_\n" if ($#_ >= 0);
 	print STDERR <<EOF;
-usage: update-rc.d [-n] [-f] <basename> remove
-       update-rc.d [-n] <basename> defaults [NN | SS KK]
-       update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] .
-       update-rc.d [-n] <basename> disable|enable [S|2|3|4|5]
+usage: update-rc.d [-d <dir>] [-n] [-f] <basename> remove
+       update-rc.d [-d <dir>] [-n] <basename> defaults [NN | SS KK]
+       update-rc.d [-d <dir>] [-n] <basename> start|stop NN runlvl [runlvl] [...] .
+       update-rc.d [-d <dir>] [-n] <basename> disable|enable [S|2|3|4|5]
+		-d: alternative root directory
 		-n: not really
 		-f: force
 
@@ -45,6 +47,7 @@ my @orig_argv = @ARGV;
 
 while($#ARGV >= 0 && ($_ = $ARGV[0]) =~ /^-/) {
 	shift @ARGV;
+	if (/^-d$/) { $dir = shift @ARGV; next }
 	if (/^-n$/) { $notreally++; next }
 	if (/^-f$/) { $force++; next }
 	if (/^-h|--help$/) { &usage; }
@@ -70,6 +73,16 @@ sub remove_last_action {
 # Action.
 
 &usage() if ($#ARGV < 1);
+
+if (-d $dir) {
+    $dir =~ s/\/$//;
+    $initd = "$dir/$initd";
+    $etcd  = "$dir/$etcd";
+} else {
+    print STDERR "update-rc.d: directory does not exist '$dir'\n";
+    exit (1)
+}
+
 my $bn = shift @ARGV;
 
 unless ($bn =~ m/[a-zA-Z0-9+.-]+/) {

Reply via email to