Author: kelmo-guest
Date: Sat May 16 12:23:11 2009
New Revision: 883

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=883
Log:
Improve the way in which update-rc.d disable/enable function
determines index of S or K bit of runlevel symlink by using rindex
instead of a harcoded index.

Modified:
    trunk/src/insserv/debian/changelog
    trunk/src/insserv/debian/update-rc.d-insserv

Modified: trunk/src/insserv/debian/changelog
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=883&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Sat May 16 12:23:11 2009
@@ -31,8 +31,11 @@
   * When arguments to start/stop/defaults action are given to update-
     rc.d wrapper, emit a warning that the LSB information of script
     overrides the given arguments.
-
- -- Kel Modderman <[email protected]>  Sat, 16 May 2009 21:47:19 +1000
+  * Improve the way in which update-rc.d disable/enable function
+    determines index of S or K bit of runlevel symlink by using rindex
+    instead of a harcoded index.
+
+ -- Kel Modderman <[email protected]>  Sat, 16 May 2009 22:22:12 +1000
 
 insserv (1.12.0-4) unstable; urgency=low
 

Modified: trunk/src/insserv/debian/update-rc.d-insserv
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/update-rc.d-insserv?rev=883&op=diff
==============================================================================
--- trunk/src/insserv/debian/update-rc.d-insserv (original)
+++ trunk/src/insserv/debian/update-rc.d-insserv Sat May 16 12:23:11 2009
@@ -132,17 +132,24 @@
 
     # Toggle S/K bit of script symlink.
     for my $cur_lnk (@symlinks) {
+       my $sk;
        my @new_lnk = split(//, $cur_lnk);
 
        if ("disable" eq $act) {
-           next if $new_lnk[11] eq 'K';
-           $new_lnk[11] = 'K';
+           $sk = rindex($cur_lnk, '/S') + 1;
+           next if $sk < 1;
+           $new_lnk[$sk] = 'K';
        } else {
-           next if $new_lnk[11] eq 'S';
-           $new_lnk[11] = 'S';
+           $sk = rindex($cur_lnk, '/K') + 1;
+           next if $sk < 1;
+           $new_lnk[$sk] = 'S';
        }
 
-       next if $dryrun;
+       if ($dryrun) {
+           printf("rename(%s, %s)\n", $cur_lnk, join('', @new_lnk));
+           next;
+       }
+
        rename($cur_lnk, join('', @new_lnk)) or error($!);
     }
 }


_______________________________________________
Initscripts-ng-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/initscripts-ng-commits

Reply via email to