summaryrefslogtreecommitdiffstats
path: root/perl-install/services.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-27 09:39:00 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-27 09:39:00 +0000
commit6509c3df1303138da0b51ebb256b4ec147da20f8 (patch)
tree47793e98aa58fa86289b65908b873e1463757102 /perl-install/services.pm
parent360dabe91b296b09b62d0a1d82d4e536dc9d4d45 (diff)
downloaddrakx-backup-do-not-use-6509c3df1303138da0b51ebb256b4ec147da20f8.tar
drakx-backup-do-not-use-6509c3df1303138da0b51ebb256b4ec147da20f8.tar.gz
drakx-backup-do-not-use-6509c3df1303138da0b51ebb256b4ec147da20f8.tar.bz2
drakx-backup-do-not-use-6509c3df1303138da0b51ebb256b4ec147da20f8.tar.xz
drakx-backup-do-not-use-6509c3df1303138da0b51ebb256b4ec147da20f8.zip
factorize in a _run_action wrapper
Diffstat (limited to 'perl-install/services.pm')
-rw-r--r--perl-install/services.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/perl-install/services.pm b/perl-install/services.pm
index 7756613cf..0b945a043 100644
--- a/perl-install/services.pm
+++ b/perl-install/services.pm
@@ -260,6 +260,11 @@ sub ask {
!$::isInstall && $in->isa('interactive::gtk') ? &ask_standalone_gtk : &ask_;
}
+sub _run_action {
+ my ($service, $action) = @_;
+ run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", $action);
+}
+
sub doit {
my ($in, $on_services) = @_;
my ($l, $was_on_services) = services();
@@ -276,7 +281,7 @@ sub doit {
if (!$after && !$::isInstall && !$in->isa('interactive::gtk')) {
#- only done after install AND when not using the gtk frontend (since it allows one to start/stop services)
#- this allows to skip stopping service "dm"
- run_program::rooted($::prefix, $script, "stop");
+ _run_action($_, "stop");
}
}
}
@@ -327,37 +332,35 @@ sub restart ($) {
my ($service) = @_;
# Exit silently if the service is not installed
service_exists($service) or return 1;
- run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "restart");
+ _run_action($service, "restart");
}
sub restart_or_start ($) {
my ($service) = @_;
# Exit silently if the service is not installed
service_exists($service) or return 1;
- is_service_running($service) ?
- run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "restart") :
- run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "start");
+ _run_action($service, is_service_running($service) ? "restart" : "start");
}
sub start ($) {
my ($service) = @_;
# Exit silently if the service is not installed
service_exists($service) or return 1;
- run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "start");
+ _run_action($service, "start");
}
sub start_not_running_service ($) {
my ($service) = @_;
# Exit silently if the service is not installed
service_exists($service) or return 1;
- is_service_running($service) || run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "start");
+ is_service_running($service) || _run_action($service, "start");
}
sub stop ($) {
my ($service) = @_;
# Exit silently if the service is not installed
service_exists($service) or return 1;
- run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "stop");
+ _run_action($service, "stop");
}
sub is_service_running ($) {