summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-27 09:39:51 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-27 09:39:51 +0000
commitcd76e0199a7d6e983875d424be9b67c493e4d8d7 (patch)
treecff1b9693ab160760cbac04aefd80e0b599bae03
parent6509c3df1303138da0b51ebb256b4ec147da20f8 (diff)
downloaddrakx-backup-do-not-use-cd76e0199a7d6e983875d424be9b67c493e4d8d7.tar
drakx-backup-do-not-use-cd76e0199a7d6e983875d424be9b67c493e4d8d7.tar.gz
drakx-backup-do-not-use-cd76e0199a7d6e983875d424be9b67c493e4d8d7.tar.bz2
drakx-backup-do-not-use-cd76e0199a7d6e983875d424be9b67c493e4d8d7.tar.xz
drakx-backup-do-not-use-cd76e0199a7d6e983875d424be9b67c493e4d8d7.zip
extract _set_service function that handles services with "-" as default chkconfig level
-rw-r--r--perl-install/services.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/perl-install/services.pm b/perl-install/services.pm
index 0b945a043..705f4eae3 100644
--- a/perl-install/services.pm
+++ b/perl-install/services.pm
@@ -260,6 +260,15 @@ sub ask {
!$::isInstall && $in->isa('interactive::gtk') ? &ask_standalone_gtk : &ask_;
}
+sub _set_service {
+ my ($service, $enable) = @_;
+ my $script = "/etc/rc.d/init.d/$service";
+ run_program::rooted($::prefix, "chkconfig", $enable ? "--add" : "--del", $service);
+ if ($enable && cat_("$::prefix$script") =~ /^#\s+chkconfig:\s+-/m) {
+ run_program::rooted($::prefix, "chkconfig", "--level", "35", $service, "on");
+ }
+}
+
sub _run_action {
my ($service, $action) = @_;
run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", $action);
@@ -273,11 +282,7 @@ sub doit {
my $before = member($_, @$was_on_services);
my $after = member($_, @$on_services);
if ($before != $after) {
- my $script = "/etc/rc.d/init.d/$_";
- run_program::rooted($::prefix, "chkconfig", $after ? "--add" : "--del", $_);
- if ($after && cat_("$::prefix$script") =~ /^#\s+chkconfig:\s+-/m) {
- run_program::rooted($::prefix, "chkconfig", "--level", "35", $_, "on");
- }
+ _set_service($_, $after);
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"