From ee45d93276cf795a53fcb0351a78fe7e6b1a4b5c Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 22 Jun 2016 10:30:56 +0200 Subject: 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) --- perl-install/install/NEWS | 4 ++++ perl-install/services.pm | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'perl-install') 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(); -- cgit v1.2.1