forked from mirrors/nixpkgs
Allow units to specify that they shouldn't be stopped when removed
This commit is contained in:
parent
382b49e634
commit
80d9b42663
|
@ -97,7 +97,7 @@ sub parseFstab {
|
||||||
sub parseUnit {
|
sub parseUnit {
|
||||||
my ($filename) = @_;
|
my ($filename) = @_;
|
||||||
my $info = {};
|
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";
|
parseKeyValues($info, read_file("${filename}.d/overrides.conf")) if -f "${filename}.d/overrides.conf";
|
||||||
return $info;
|
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 $prevUnitFile && ($state->{state} eq "active" || $state->{state} eq "activating")) {
|
||||||
if (! -e $newUnitFile || abs_path($newUnitFile) eq "/dev/null") {
|
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$/) {
|
elsif ($unit =~ /\.target$/) {
|
||||||
|
|
Loading…
Reference in a new issue