Package: chkconfig
Version: 11.0-79.1-2
Severity: wishlist
Tags: patch

For when the distribution installation isn't on '/' (e.g. network or a
different partition), It could be useful to have chkconfig an option to use the
different root. 

e.g. to check the services on /mnt/sda3 one could do:

/mnt/sda3/sbin/chkconfig --root=/mnt/sda3 --list

This is basically the same as sysv-rc-conf's "--root" option (I think).

Attached is a patch that seems to do the trick.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'oldstable'), (500, 'unstable'), (500, 
'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.31mos-3 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages chkconfig depends on:
ii  perl                          5.10.1-5   Larry Wall's Practical Extraction 

Versions of packages chkconfig recommends:
ii  insserv                       1.12.0-14  Tool to organize boot sequence usi

chkconfig suggests no packages.

-- no debconf information
--- chkconfig.debian.orig       2009-11-16 10:38:46.454873000 +0200
+++ chkconfig.debian    2009-11-16 11:40:18.642994000 +0200
@@ -479,7 +479,7 @@
 
 my $mode = '';
 my $printdeps;
-
+my $root = '/';
 
 sub addmode {
   die("Please specify only one mode.\n") if $mode;
@@ -500,8 +500,9 @@
         chkconfig -h|--help                     (print usage)
         chkconfig -f|--force ...                (call insserv with -f)
 
-        chkconfig [name]           same as chkconfig -t
-        chkconfig name state...    same as chkconfig -s name state
+        chkconfig [name]             same as chkconfig -t
+        chkconfig name state...      same as chkconfig -s name state
+        chkconfig --root=<root> ...  use <root> as the root file system
 EOF
 }
 
@@ -518,7 +519,8 @@
                 'level=s'  => \$level,
                 'force|f'  => \$force,
                 'allservices|A'  => \$allservices,
-                'deps'     => \$printdeps
+                'deps'     => \$printdeps,
+                'root=s'   => \$root
    )) {
   usage();
   exit 1;
@@ -529,6 +531,10 @@
 }
 my (@services, $s);
 
+$initdir = "$root/etc/init.d";
+$inetddir = "$root/etc/inetd.d";
+$xinetddir = "$root/etc/xinetd.d";
+
 findknown();
 
 if (@ARGV) {

Reply via email to