diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/services.pm | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/perl-install/services.pm b/perl-install/services.pm index 9d5809f9b..c4a2399e3 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -288,46 +288,43 @@ sub services { # the following functions are mostly by printer related modules -#-if we are in an DrakX config -our $prefix = ""; - sub restart ($) { my ($service) = @_; # Exit silently if the service is not installed - return 1 if !(-x "$prefix/etc/rc.d/init.d/$service"); - run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "restart"); + return 1 if !(-x "$::prefix/etc/rc.d/init.d/$service"); + run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "restart"); } sub start ($) { my ($service) = @_; # Exit silently if the service is not installed - return 1 if !(-x "$prefix/etc/rc.d/init.d/$service"); - run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "start"); + return 1 if !(-x "$::prefix/etc/rc.d/init.d/$service"); + run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "start"); return (($? >> 8) != 0) ? 0 : 1; } sub start_not_running_service ($) { my ($service) = @_; # Exit silently if the service is not installed - return 1 if !(-x "$prefix/etc/rc.d/init.d/$service"); - run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "status"); + return 1 if !(-x "$::prefix/etc/rc.d/init.d/$service"); + run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "status"); return (($? >> 8) != 0) ? 0 : 1; } sub stop ($) { my ($service) = @_; # Exit silently if the service is not installed - return 1 if !(-x "$prefix/etc/rc.d/init.d/$service"); - run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "stop"); + return 1 if !(-x "$::prefix/etc/rc.d/init.d/$service"); + run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "stop"); return (($? >> 8) != 0) ? 0 : 1; } sub is_service_running ($) { my ($service) = @_; # Exit silently if the service is not installed - return 0 if !(-x "$prefix/etc/rc.d/init.d/$service"); - run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "status"); + return 0 if !(-x "$::prefix/etc/rc.d/init.d/$service"); + run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "status"); # The exit status is not zero when the service is not running return (($? >> 8) != 0) ? 0 : 1; } @@ -335,7 +332,7 @@ sub is_service_running ($) { sub starts_on_boot ($) { my ($service) = @_; local *F; - open F, ($::testing ? $prefix : "chroot $prefix/ ") . + open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . "/bin/sh -c \"export LC_ALL=C; /sbin/chkconfig --list $service 2>&1\" |" or return 0; while (my $line = <F>) { @@ -351,7 +348,7 @@ sub starts_on_boot ($) { sub start_service_on_boot ($) { my ($service) = @_; - run_program::rooted($prefix, "/sbin/chkconfig", "--add", $service) + run_program::rooted($::prefix, "/sbin/chkconfig", "--add", $service) or return 0; return 1; } |