Unverified Commit ad09f7be authored by Janne Heß's avatar Janne Heß
Browse files

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.
parent 558158b4
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -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 the socket was not running previously,
                        # start it now.
                        if (not defined $activePrev->{$socket}) {
                            $unitsToStart->{$socket} = 1;
                        }
                    }
                }