switch-to-configuration: Check overrides.conf for X-* options

This commit is contained in:
Eelco Dolstra 2014-04-19 14:28:33 +02:00
parent b03a2f9e90
commit 82535e0f8f

View File

@ -96,18 +96,19 @@ sub parseFstab {
sub parseUnit { sub parseUnit {
my ($filename) = @_; my ($filename) = @_;
parseKeyValues(read_file($filename)); my $info = {};
parseKeyValues($info, read_file($filename));
parseKeyValues($info, read_file("${filename}.d/overrides.conf")) if -f "${filename}.d/overrides.conf";
return $info;
} }
sub parseKeyValues { sub parseKeyValues {
my @lines = @_; my $info = shift;
my $info = {};
foreach my $line (@_) { foreach my $line (@_) {
# FIXME: not quite correct. # FIXME: not quite correct.
$line =~ /^([^=]+)=(.*)$/ or next; $line =~ /^([^=]+)=(.*)$/ or next;
$info->{$1} = $2; $info->{$1} = $2;
} }
return $info;
} }
sub boolIsTrue { sub boolIsTrue {
@ -362,7 +363,8 @@ while (my ($unit, $state) = each %{$activeNew}) {
elsif ($state->{state} eq "auto-restart") { elsif ($state->{state} eq "auto-restart") {
# A unit in auto-restart state is a failure *if* it previously failed to start # A unit in auto-restart state is a failure *if* it previously failed to start
my $lines = `@systemd@/bin/systemctl show '$unit'`; my $lines = `@systemd@/bin/systemctl show '$unit'`;
my $info = parseKeyValues(split "\n", $lines); my $info = {};
parseKeyValues($info, split("\n", $lines));
if ($info->{ExecMainStatus} ne '0') { if ($info->{ExecMainStatus} ne '0') {
push @failed, $unit; push @failed, $unit;