summary refs log tree commit diff
path: root/nixos/modules/system/activation
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2016-10-02 10:36:47 +0300
committerTuomas Tynkkynen <tuomas@tuxera.com>2016-10-02 10:36:47 +0300
commit19225bf5cc546b1608eea3f1770f1ee1110c14c8 (patch)
treee95881d505d9cf1f309f8e6b2fbee40496f550cd /nixos/modules/system/activation
parent97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7 (diff)
parenta387a5d870c306220d6dfd06160bddde8532422d (diff)
downloadnixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.gz
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.bz2
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.lz
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.xz
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.zst
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.zip
Merge remote-tracking branch 'upstream/master' into staging
Diffstat (limited to 'nixos/modules/system/activation')
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl40
1 files changed, 18 insertions, 22 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index bb97d0c53a6b..8747c1e3d4ac 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -213,33 +213,30 @@ while (my ($unit, $state) = each %{$activePrev}) {
                 elsif (!boolIsTrue($unitInfo->{'X-RestartIfChanged'} // "yes") || boolIsTrue($unitInfo->{'RefuseManualStop'} // "no") ) {
                     $unitsToSkip{$unit} = 1;
                 } else {
-                    # If this unit is socket-activated, then stop the
-                    # socket unit(s) as well, and restart the
-                    # socket(s) instead of the service.
-                    my $socketActivated = 0;
-                    if ($unit =~ /\.service$/) {
-                        my @sockets = split / /, ($unitInfo->{Sockets} // "");
-                        if (scalar @sockets == 0) {
-                            @sockets = ("$baseName.socket");
-                        }
-                        foreach my $socket (@sockets) {
-                            if (defined $activePrev->{$socket}) {
-                                $unitsToStop{$unit} = 1;
-                                $unitsToStart{$unit} = 1;
-                                recordUnit($startListFile, $socket);
-                                $socketActivated = 1;
-                            }
-                        }
-                    }
-
                     if (!boolIsTrue($unitInfo->{'X-StopIfChanged'} // "yes")) {
-
                         # This unit should be restarted instead of
                         # stopped and started.
                         $unitsToRestart{$unit} = 1;
                         recordUnit($restartListFile, $unit);
-
                     } else {
+                        # If this unit is socket-activated, then stop the
+                        # socket unit(s) as well, and restart the
+                        # socket(s) instead of the service.
+                        my $socketActivated = 0;
+                        if ($unit =~ /\.service$/) {
+                            my @sockets = split / /, ($unitInfo->{Sockets} // "");
+                            if (scalar @sockets == 0) {
+                                @sockets = ("$baseName.socket");
+                            }
+                            foreach my $socket (@sockets) {
+                                if (defined $activePrev->{$socket}) {
+                                    $unitsToStop{$socket} = 1;
+                                    $unitsToStart{$socket} = 1;
+                                    recordUnit($startListFile, $socket);
+                                    $socketActivated = 1;
+                                }
+                            }
+                        }
 
                         # If the unit is not socket-activated, record
                         # that this unit needs to be started below.
@@ -251,7 +248,6 @@ while (my ($unit, $state) = each %{$activePrev}) {
                         }
 
                         $unitsToStop{$unit} = 1;
-
                     }
                 }
             }