3
0
Fork 0
forked from mirrors/nixpkgs

Allow units to specify that they shouldn't be stopped when removed

This commit is contained in:
Eelco Dolstra 2015-08-07 05:25:59 +02:00
parent 382b49e634
commit 80d9b42663

View file

@ -97,7 +97,7 @@ sub parseFstab {
sub parseUnit {
my ($filename) = @_;
my $info = {};
parseKeyValues($info, read_file($filename));
parseKeyValues($info, read_file($filename)) if -f $filename;
parseKeyValues($info, read_file("${filename}.d/overrides.conf")) if -f "${filename}.d/overrides.conf";
return $info;
}
@ -157,7 +157,8 @@ while (my ($unit, $state) = each %{$activePrev}) {
if (-e $prevUnitFile && ($state->{state} eq "active" || $state->{state} eq "activating")) {
if (! -e $newUnitFile || abs_path($newUnitFile) eq "/dev/null") {
$unitsToStop{$unit} = 1;
my $unitInfo = parseUnit($prevUnitFile);
$unitsToStop{$unit} = 1 if boolIsTrue($unitInfo->{'X-StopOnRemoval'} // "yes");
}
elsif ($unit =~ /\.target$/) {