3
0
Fork 0
forked from mirrors/nixpkgs

nixos/switch-to-configuration: Handle stopped sockets

The previous logic failed to detect that units were socket-activated
when the socket was stopped before switch-to-configuration was run. This
commit fixes that and also starts the socket in question.
This commit is contained in:
Janne Heß 2021-10-17 14:23:01 +02:00
parent 558158b4f5
commit ad09f7be14
No known key found for this signature in database
GPG key ID: 69165158F05265DF

View file

@ -180,12 +180,13 @@ sub handleModifiedUnit {
@sockets = ("$baseName.socket");
}
foreach my $socket (@sockets) {
if (defined $activePrev->{$socket}) {
# Only restart sockets that actually
# exist in new configuration
if (-e "$out/etc/systemd/system/$socket") {
$socketActivated = 1;
$unitsToStop->{$unit} = 1;
if (-e "$out/etc/systemd/system/$socket") {
$socketActivated = 1;
$unitsToStop->{$unit} = 1;
# If the socket was not running previously,
# start it now.
if (not defined $activePrev->{$socket}) {
$unitsToStart->{$socket} = 1;
}
}
}