summaryrefslogtreecommitdiffstats
path: root/perl-install/services.pm
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-06-22 10:30:56 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2016-06-22 13:19:02 +0200
commitee45d93276cf795a53fcb0351a78fe7e6b1a4b5c (patch)
treea3d4938a0a4b51aa5f1d4d56c8f8cd037cc56a3a /perl-install/services.pm
parent6d04c44f822fed45a408cf2c7f435d2ac4ffbd51 (diff)
downloaddrakx-ee45d93276cf795a53fcb0351a78fe7e6b1a4b5c.tar
drakx-ee45d93276cf795a53fcb0351a78fe7e6b1a4b5c.tar.gz
drakx-ee45d93276cf795a53fcb0351a78fe7e6b1a4b5c.tar.bz2
drakx-ee45d93276cf795a53fcb0351a78fe7e6b1a4b5c.tar.xz
drakx-ee45d93276cf795a53fcb0351a78fe7e6b1a4b5c.zip
fix getting systemd services status at install
Some services such as shorewall are not "wantedby". However, as systemd is not running during installation, we failed to detect if whether they're enabled or not as the legacy fallback doesn't handle such services Let's try hard to query status of services that are not "wanted" but we're checking for. Thus fixing updating firewall status after configuration (mga#17288)
Diffstat (limited to 'perl-install/services.pm')
-rw-r--r--perl-install/services.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/perl-install/services.pm b/perl-install/services.pm
index 6c8b79943..9d3450231 100644
--- a/perl-install/services.pm
+++ b/perl-install/services.pm
@@ -360,8 +360,13 @@ sub _systemd_services() {
my %loaded;
# Running system using systemd
log::explanations("Detected systemd running. Using systemctl introspection.");
- foreach (run_program::rooted_get_stdout($::prefix, '/bin/systemctl', '--no-legend', '--no-pager', '--full', '--all', 'list-units')) {
- if (my ($name) = m!^(\S+)\.service\s+loaded!) {
+ # even if systemd is not running, we can detect status of shorewell service which is not wanted by:
+ my @opts = $::isInstall ? 'list-unit-files' : qw(--all list-units);
+ print "chroot $::prefix /bin/systemctl --no-legend --no-pager --full @opts";
+ foreach (run_program::rooted_get_stdout($::prefix, '/bin/systemctl', '--no-legend', '--no-pager', '--full', @opts)) {
+ my ($name) = m!^(\S+)\.service\s+loaded!;
+ ($name) = m!^(\S+)\.service\s+enabled! if $::isInstall && !$name;
+ if ($name) {
# We only look at non-template, non-linked service files in /lib
# We also check for any non-masked sysvinit files as these are
# also handled by systemd
@@ -459,6 +464,12 @@ sub services() {
@services = _systemd_services();
} else {
@services = _legacy_services();
+ # list shorewall and the like which are not "wantedBy":
+ if ($::isInstall) {
+ # prevent listing some services twice:
+ my @found = map { $_->[0] } @services;
+ push @services, grep { !member($_->[0], @found) } _systemd_services();
+ }
}
my @l = xinetd_services();