summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2022-01-29 14:23:59 +0100
committerJanne Heß <janne@hess.ooo>2022-02-09 14:31:44 +0100
commit78db7b6529a12f2afbac4d3958b68c23b04e8996 (patch)
tree92d2ee6ae8715de136482377da0f9c4c57146eec /nixos/modules/system
parentd729cc8a53915847a586c367bc48e7113f82412d (diff)
downloadnixpkgs-78db7b6529a12f2afbac4d3958b68c23b04e8996.tar
nixpkgs-78db7b6529a12f2afbac4d3958b68c23b04e8996.tar.gz
nixpkgs-78db7b6529a12f2afbac4d3958b68c23b04e8996.tar.bz2
nixpkgs-78db7b6529a12f2afbac4d3958b68c23b04e8996.tar.lz
nixpkgs-78db7b6529a12f2afbac4d3958b68c23b04e8996.tar.xz
nixpkgs-78db7b6529a12f2afbac4d3958b68c23b04e8996.tar.zst
nixpkgs-78db7b6529a12f2afbac4d3958b68c23b04e8996.zip
nixos/switch-to-configuration: Allow passing parsed unit contents
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl10
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index d6f780f7b61..f2c1cf795d1 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -205,7 +205,7 @@ sub fingerprintUnit {
 }
 
 sub handleModifiedUnit {
-    my ($unit, $baseName, $newUnitFile, $activePrev, $unitsToStop, $unitsToStart, $unitsToReload, $unitsToRestart, $unitsToSkip) = @_;
+    my ($unit, $baseName, $newUnitFile, $newUnitInfo, $activePrev, $unitsToStop, $unitsToStart, $unitsToReload, $unitsToRestart, $unitsToSkip) = @_;
 
     if ($unit eq "sysinit.target" || $unit eq "basic.target" || $unit eq "multi-user.target" || $unit eq "graphical.target" || $unit =~ /\.path$/ || $unit =~ /\.slice$/) {
         # Do nothing.  These cannot be restarted directly.
@@ -223,7 +223,7 @@ sub handleModifiedUnit {
         # Revert of the attempt: https://github.com/NixOS/nixpkgs/pull/147609
         # More details: https://github.com/NixOS/nixpkgs/issues/74899#issuecomment-981142430
     } else {
-        my %unitInfo = parseUnit($newUnitFile);
+        my %unitInfo = $newUnitInfo ? %{$newUnitInfo} : parseUnit($newUnitFile);
         if (parseSystemdBool(\%unitInfo, "Service", "X-ReloadIfChanged", 0)) {
             $unitsToReload->{$unit} = 1;
             recordUnit($reloadListFile, $unit);
@@ -349,7 +349,7 @@ while (my ($unit, $state) = each %{$activePrev}) {
         }
 
         elsif (fingerprintUnit($prevUnitFile) ne fingerprintUnit($newUnitFile)) {
-            handleModifiedUnit($unit, $baseName, $newUnitFile, $activePrev, \%unitsToStop, \%unitsToStart, \%unitsToReload, \%unitsToRestart, \%unitsToSkip);
+            handleModifiedUnit($unit, $baseName, $newUnitFile, undef, $activePrev, \%unitsToStop, \%unitsToStart, \%unitsToReload, \%unitsToRestart, \%unitsToSkip);
         }
     }
 }
@@ -473,7 +473,7 @@ if ($action eq "dry-activate") {
             next;
         }
 
-        handleModifiedUnit($unit, $baseName, $newUnitFile, $activePrev, \%unitsToRestart, \%unitsToRestart, \%unitsToReload, \%unitsToRestart, \%unitsToSkip);
+        handleModifiedUnit($unit, $baseName, $newUnitFile, undef, $activePrev, \%unitsToRestart, \%unitsToRestart, \%unitsToReload, \%unitsToRestart, \%unitsToSkip);
     }
     unlink($dryRestartByActivationFile);
 
@@ -529,7 +529,7 @@ foreach (split('\n', read_file($restartByActivationFile, err_mode => 'quiet') //
         next;
     }
 
-    handleModifiedUnit($unit, $baseName, $newUnitFile, $activePrev, \%unitsToRestart, \%unitsToRestart, \%unitsToReload, \%unitsToRestart, \%unitsToSkip);
+    handleModifiedUnit($unit, $baseName, $newUnitFile, undef, $activePrev, \%unitsToRestart, \%unitsToRestart, \%unitsToReload, \%unitsToRestart, \%unitsToSkip);
 }
 # We can remove the file now because it has been propagated to the other restart/reload files
 unlink($restartByActivationFile);