summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2019-11-26 13:28:48 +0100
committerGitHub <noreply@github.com>2019-11-26 13:28:48 +0100
commit634096c503bf67af5b8ab332e615edc1f5d83d74 (patch)
tree39eea85e33ab0636be499c1318d9a95849520b19 /nixos/modules/system
parente38f83c762f739971fbdf631fcccfda301b555c7 (diff)
parent89806e95363f06869c9de18586e32c8ef65bd2fd (diff)
Merge pull request #73871 from mayflower/socket-activation-fix
nixos/switch-to-configuration: restart changed socket units
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl12
1 files changed, 11 insertions, 1 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 641cf9faadc97..12a80a12d19f4 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -214,7 +214,17 @@ while (my ($unit, $state) = each %{$activePrev}) {
                 # Reload the changed mount unit to force a remount.
                 $unitsToReload{$unit} = 1;
                 recordUnit($reloadListFile, $unit);
-            } elsif ($unit =~ /\.socket$/ || $unit =~ /\.path$/ || $unit =~ /\.slice$/) {
+            } elsif ($unit =~ /\.socket$/) {
+                my $unitInfo = parseUnit($newUnitFile);
+                # If a socket unit has been changed, the corresponding
+                # service unit has to be stopped before the socket can
+                # be restarted. The service will be started again on demand.
+                my $serviceUnit = $unitInfo->{'Unit'} // "$baseName.service";
+                $unitsToStop{$serviceUnit} = 1;
+                $unitsToStop{$unit} = 1;
+                $unitsToStart{$unit} = 1;
+                recordUnit($startListFile, $unit);
+            } elsif ($unit =~ /\.path$/ || $unit =~ /\.slice$/) {
                 # FIXME: do something?
             } else {
                 my $unitInfo = parseUnit($newUnitFile);