Changes to support upstart and ubuntu 10.10

This commit is contained in:
Jamie Cameron
2011-02-12 11:02:50 -08:00
parent b7e2f4725f
commit eea6bc94e2
2 changed files with 17 additions and 1 deletions

View File

@@ -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("");

View File

@@ -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) {