Changes to support upstart and ubuntu 10.10
authorJamie Cameron <jcameron@webmin.com>
Sat, 12 Feb 2011 19:02:50 +0000 (11:02 -0800)
committerJamie Cameron <jcameron@webmin.com>
Sat, 12 Feb 2011 19:02:50 +0000 (11:02 -0800)
init/delete_action.cgi
init/init-lib.pl

index efb9e25..c2b0f96 100755 (executable)
@@ -23,6 +23,10 @@ elsif ($in{type} == 1) {
        $file = &runlevel_filename($in{runlevel}, $in{startstop},
                                   $in{number}, $in{action});
        }
+if (&has_command("insserv")) {
+       &system_logged("insserv -r ".quotemeta($in{action}));
+       }
+&unlink_logged("/etc/init/$in{'action'}.conf");
 &unlink_logged($file);
 &webmin_log('delete', 'action', $in{'action'});
 &redirect("");
index 15fbf28..48299cd 100755 (executable)
@@ -112,7 +112,7 @@ foreach $f (sort { lc($a) cmp lc($b) } readdir(DIR)) {
            $f eq "core" || $f eq "README" || $f eq "rc" || $f eq "rcS" ||
            -d "$dir/$f" || $f =~ /\.swp$/ || $f eq "skeleton" ||
            $f =~ /\.lock$/ || $f =~ /\.dpkg-(old|dist)$/ ||
-           $f =~ /^\.depend\./) { next; }
+           $f =~ /^\.depend\./ || $f eq '.legacy-bootordering') { next; }
        if (@stbuf = stat("$dir/$f")) {
                push(@rv, "$f $stbuf[1]");
                }
@@ -381,6 +381,7 @@ in with supported parameters to the action, like 'start' and 'stop'.
 =cut
 sub init_description
 {
+# Read contents of script, extract start/stop commands
 open(FILE, $_[0]);
 local @lines = <FILE>;
 close(FILE);
@@ -427,6 +428,17 @@ elsif ($config{'init_info'} || $data =~ /BEGIN INIT INFO/) {
                        }
                }
        }
+elsif ($_[0] =~ /^\/etc\/init.d\/(\S+)$/ && -r "/etc/init/$1.conf") {
+       # Upstart description file exists
+       open(CONF, "/etc/init/$1.conf");
+       while(<CONF>) {
+               if (/^description\s+"([^"]+)"/) {
+                       $desc = $1;
+                       last;
+                       }
+               }
+       close(CONF);
+       }
 else {
        # Use the first comments
        foreach (@lines) {