3
0
Fork 0
forked from mirrors/nixpkgs

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 {
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 {
my @lines = @_;
my $info = {};
my $info = shift;
foreach my $line (@_) {
# FIXME: not quite correct.
$line =~ /^([^=]+)=(.*)$/ or next;
$info->{$1} = $2;
}
return $info;
}
sub boolIsTrue {
@ -362,7 +363,8 @@ while (my ($unit, $state) = each %{$activeNew}) {
elsif ($state->{state} eq "auto-restart") {
# A unit in auto-restart state is a failure *if* it previously failed to start
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') {
push @failed, $unit;