summary refs log tree commit diff
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2022-01-29 23:21:42 +0100
committerJanne Heß <janne@hess.ooo>2022-02-09 15:14:38 +0100
commit08cd8ab8b6782d9f48cdccd127a12d82257e1b3d (patch)
treebebc4f768b279ceaeaa5248f781cc8aa9adf84a4
parent1c1f8c59e13590b13e51f829cdb6c98d47d13e7c (diff)
downloadnixpkgs-08cd8ab8b6782d9f48cdccd127a12d82257e1b3d.tar
nixpkgs-08cd8ab8b6782d9f48cdccd127a12d82257e1b3d.tar.gz
nixpkgs-08cd8ab8b6782d9f48cdccd127a12d82257e1b3d.tar.bz2
nixpkgs-08cd8ab8b6782d9f48cdccd127a12d82257e1b3d.tar.lz
nixpkgs-08cd8ab8b6782d9f48cdccd127a12d82257e1b3d.tar.xz
nixpkgs-08cd8ab8b6782d9f48cdccd127a12d82257e1b3d.tar.zst
nixpkgs-08cd8ab8b6782d9f48cdccd127a12d82257e1b3d.zip
nixos/switch-to-configuration: Don't stop swaps in dry-activate
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 2fe78634d62..2ea871626e2 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -507,8 +507,12 @@ foreach my $device (keys %$prevSwaps) {
         # "systemctl stop" here because systemd has lots of alias
         # units that prevent a stop from actually calling
         # "swapoff".
-        print STDERR "stopping swap device: $device\n";
-        system("@utillinux@/sbin/swapoff", $device);
+        if ($action ne "dry-activate") {
+            print STDERR "would stop swap device: $device\n";
+        } else {
+            print STDERR "stopping swap device: $device\n";
+            system("@utillinux@/sbin/swapoff", $device);
+        }
     }
     # FIXME: update swap options (i.e. its priority).
 }