diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-06-26 15:56:39 +0200 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-06-26 15:56:39 +0200 |
commit | 2a16f39cb158934bbcf2aa70c3121b77f2b508d1 (patch) | |
tree | b031c017c508dbc8c57a1115077f5564bab5e2c9 /lib | |
parent | 01be3171ecd51bcf91cd49b4d84a6e2d4b5b9cf2 (diff) | |
download | manatools-2a16f39cb158934bbcf2aa70c3121b77f2b508d1.tar manatools-2a16f39cb158934bbcf2aa70c3121b77f2b508d1.tar.gz manatools-2a16f39cb158934bbcf2aa70c3121b77f2b508d1.tar.bz2 manatools-2a16f39cb158934bbcf2aa70c3121b77f2b508d1.tar.xz manatools-2a16f39cb158934bbcf2aa70c3121b77f2b508d1.zip |
Forgotten ENV protection
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AdminPanel/Shared/Services.pm | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/AdminPanel/Shared/Services.pm b/lib/AdminPanel/Shared/Services.pm index 2fa64079..2123dbb2 100644 --- a/lib/AdminPanel/Shared/Services.pm +++ b/lib/AdminPanel/Shared/Services.pm @@ -289,11 +289,12 @@ This function enable/disable at boot the given service #============================================================= sub set_service { my ($service, $enable) = @_; - + my @xinetd_services = map { $_->[0] } xinetd_services(); if (AdminPanel::Shared::member($service, @xinetd_services)) { - run_program::rooted($::prefix, "chkconfig", $enable ? "--add" : "--del", $service); + $ENV{PATH} = "/usr/bin:/usr/sbin"; + run_program::rooted($::prefix, "/usr/sbin/chkconfig", $enable ? "--add" : "--del", $service); } elsif (_running_systemd() || _has_systemd()) { # systemctl rejects any symlinked units. You have to enabled the real file if (-l "/lib/systemd/system/$service.service") { @@ -302,13 +303,16 @@ sub set_service { } else { $service = $service . ".service"; } - run_program::rooted($::prefix, "/bin/systemctl", $enable ? "enable" : "disable", $service); + $ENV{PATH} = "/usr/bin:/usr/sbin"; + run_program::rooted($::prefix, "/usr/bin/systemctl", $enable ? "enable" : "disable", $service); } else { my $script = "/etc/rc.d/init.d/$service"; - run_program::rooted($::prefix, "chkconfig", $enable ? "--add" : "--del", $service); + $ENV{PATH} = "/usr/bin:/usr/sbin"; + run_program::rooted($::prefix, "/usr/sbin/chkconfig", $enable ? "--add" : "--del", $service); #- FIXME: handle services with no chkconfig line and with no Default-Start levels in LSB header if ($enable && MDK::Common::File::cat_("$::prefix$script") =~ /^#\s+chkconfig:\s+-/m) { - run_program::rooted($::prefix, "chkconfig", "--level", "35", $service, "on"); + $ENV{PATH} = "/usr/bin:/usr/sbin"; + run_program::rooted($::prefix, "/usr/sbin/chkconfig", "--level", "35", $service, "on"); } } } @@ -670,7 +674,7 @@ This function returns if the given service is running sub is_service_running ($) { my ($service) = @_; # Exit silently if the service is not installed - service_exists($service) or return 1; + service_exists($service) or return 0; my $out; if (_running_systemd()) { $ENV{PATH} = "/usr/bin:/usr/sbin"; @@ -813,9 +817,9 @@ and restarts/stops it if o_dont_apply is not given sub set_status { my ($service, $enable, $o_dont_apply) = @_; if ($enable) { - enable($service, $o_dont_apply); + enable($service, $o_dont_apply); } else { - disable($service, $o_dont_apply); + disable($service, $o_dont_apply); } } |