diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Init/Services.pm | 38 | ||||
-rw-r--r-- | Utils/File.pm | 6 |
3 files changed, 29 insertions, 22 deletions
@@ -1,3 +1,10 @@ +2006-08-05 Carlos Garnacho <carlosg@gnome.org> + + * Services.pm (get_gentoo_runlevel_status_by_service) + (get_gentoo_service_info) (get_gentoo_services) (get_init_type): Fix + glitches that made ServicesConfig misbehave with gentoo + * File.pm (get_cmd_command): return -1 if the command doesn't exist + 2006-08-02 Carlos Garnacho <carlosg@gnome.org> * Release 1.9.2 diff --git a/Init/Services.pm b/Init/Services.pm index 6200ecb..cb9c67a 100644 --- a/Init/Services.pm +++ b/Init/Services.pm @@ -682,7 +682,7 @@ sub get_gentoo_runlevels { my($raw_output) = Utils::File::run_backtick("rc-status -l"); my(@runlevels) = split(/\n/,$raw_output); - + return @runlevels; } @@ -780,53 +780,47 @@ sub get_gentoo_runlevel_status_by_service { if (defined $start_runlevels{$runlevel}) { - push @arr, { "name" => $runlevel, - "action" => "start" }; + push @arr, [ $runlevel, "start", 0 ]; } else { - push @arr, { "name" => $runlevel, - "action" => "stop" }; + push @arr, [ $runlevel, "stop", 0 ]; } } - push @ret, { "runlevel" => \@arr }; - return @ret; + return \@arr; } sub get_gentoo_service_info { my ($service) = @_; my ($script, @actions, @runlevels); - my %hash; + my ($role); # We have to check out if the service is in the "forbidden" list - return undef if (&Init::ServicesList::is_forbidden ($service)); - - my($runlevels) = &get_gentoo_runlevel_status_by_service ($service); + return if (&Init::ServicesList::is_forbidden ($service)); - $hash{"script"} = $service; - $hash{"runlevels"} = $runlevels unless ($runlevels eq undef); - $hash{"role"} = &Init::ServicesList::get_role ($service); + $runlevels = &get_gentoo_runlevel_status_by_service ($service); + $role = &Init::ServicesList::get_role ($service); - return \%hash; + return ($service, $role, $runlevels); } sub get_gentoo_services { my ($service); - my (%ret); + my (@arr); my ($service_list) = &get_gentoo_services_list (); foreach $service (@$service_list) { - my (%hash); + my (@info); - $hash = &get_gentoo_service_info ($service); - $ret{$service} = $hash if ($hash ne undef); + @info = &get_gentoo_service_info ($service); + push @arr, \@info if scalar (@info); } - return \%ret; + return \@arr; } sub set_gentoo_service_status @@ -1128,6 +1122,10 @@ sub set_suse_services # generic functions to get the available services sub get_init_type { + my $gst_dist; + + $gst_dist = $Utils::Backend::tool{"platform"}; + if (($gst_dist =~ /debian/) && (Utils::File::exists ("/etc/runlevel.conf"))) { return "file-rc"; diff --git a/Utils/File.pm b/Utils/File.pm index 41edd3e..77f5b2e 100644 --- a/Utils/File.pm +++ b/Utils/File.pm @@ -89,6 +89,8 @@ sub get_cmd_path my ($cmd) = @_; my $command = &do_get_cmd_path ($cmd); + + return -1 if ($command == -1); return ("LC_ALL=C PATH=\$PATH:/sbin:/usr/sbin $command 2> /dev/null"); } @@ -456,7 +458,7 @@ sub run_pipe { $command = &get_cmd_path ($cmd); } - + if ($command == -1) { &Utils::Report::do_report ("file_run_pipe_failed", $command); @@ -464,7 +466,7 @@ sub run_pipe return undef; } - $command .= " |" if $mode_mask & $FILE_READ; + $command .= " |" if $mode_mask & $FILE_READ; $command = "| $command > /dev/null" if $mode_mask & $FILE_WRITE; open PIPE, $command; |