From eea6bc94e247b4749090d4f3070334bc50abdc05 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 12 Feb 2011 11:02:50 -0800 Subject: [PATCH] Changes to support upstart and ubuntu 10.10 --- init/delete_action.cgi | 4 ++++ init/init-lib.pl | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/init/delete_action.cgi b/init/delete_action.cgi index efb9e2505..c2b0f967e 100755 --- a/init/delete_action.cgi +++ b/init/delete_action.cgi @@ -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(""); diff --git a/init/init-lib.pl b/init/init-lib.pl index 15fbf2818..48299cda0 100755 --- a/init/init-lib.pl +++ b/init/init-lib.pl @@ -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 = ; 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() { + if (/^description\s+"([^"]+)"/) { + $desc = $1; + last; + } + } + close(CONF); + } else { # Use the first comments foreach (@lines) {