diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-06-22 10:30:56 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-06-22 13:19:02 +0200 |
commit | ee45d93276cf795a53fcb0351a78fe7e6b1a4b5c (patch) | |
tree | a3d4938a0a4b51aa5f1d4d56c8f8cd037cc56a3a | |
parent | 6d04c44f822fed45a408cf2c7f435d2ac4ffbd51 (diff) | |
download | drakx-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)
-rw-r--r-- | perl-install/install/NEWS | 4 | ||||
-rw-r--r-- | perl-install/services.pm | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 1db4c40f8..61f04dada 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,7 @@ +- summary: + o fix not listing some services (mga#17288) + o fix updating firewall status after configuration (mga#17288) + Version 17.42 - 22 June 2016 - bootloader configuration: 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(); |