summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorJanne Heß <dasJ@users.noreply.github.com>2023-09-23 17:03:13 +0200
committerGitHub <noreply@github.com>2023-09-23 17:03:13 +0200
commitcc55ef9d55254e44cfe9a49ecbccb67412838227 (patch)
tree952b3be18ed98629d8c1f61fffef81c589c30983 /nixos/modules/system
parent805fee6f38428d7ef2ee59b36cf910003cabed71 (diff)
parent358347e8b651ae24413c2abb7640c8c8e1786a1f (diff)
downloadnixpkgs-cc55ef9d55254e44cfe9a49ecbccb67412838227.tar
nixpkgs-cc55ef9d55254e44cfe9a49ecbccb67412838227.tar.gz
nixpkgs-cc55ef9d55254e44cfe9a49ecbccb67412838227.tar.bz2
nixpkgs-cc55ef9d55254e44cfe9a49ecbccb67412838227.tar.lz
nixpkgs-cc55ef9d55254e44cfe9a49ecbccb67412838227.tar.xz
nixpkgs-cc55ef9d55254e44cfe9a49ecbccb67412838227.tar.zst
nixpkgs-cc55ef9d55254e44cfe9a49ecbccb67412838227.zip
Merge pull request #254993 from helsinki-systems/feat/stc-mount-improvements
nixos/switch-to-configuration: Mount improvements and a lot more test cases
Diffstat (limited to 'nixos/modules/system')
-rwxr-xr-xnixos/modules/system/activation/switch-to-configuration.pl20
1 files changed, 15 insertions, 5 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 8bd450d7343..e05f89bb0fb 100755
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -74,7 +74,7 @@ if ("@localeArchive@" ne "") {
 
 if (!defined($action) || ($action ne "switch" && $action ne "boot" && $action ne "test" && $action ne "dry-activate")) {
     print STDERR <<"EOF";
-Usage: $0 [switch|boot|test]
+Usage: $0 [switch|boot|test|dry-activate]
 
 switch:       make the configuration the boot default and activate now
 boot:         make the configuration the boot default
@@ -661,10 +661,20 @@ foreach my $mount_point (keys(%{$cur_fss})) {
         # Filesystem entry disappeared, so unmount it.
         $units_to_stop{$unit} = 1;
     } elsif ($cur->{fsType} ne $new->{fsType} || $cur->{device} ne $new->{device}) {
-        # Filesystem type or device changed, so unmount and mount it.
-        $units_to_stop{$unit} = 1;
-        $units_to_start{$unit} = 1;
-        record_unit($start_list_file, $unit);
+        if ($mount_point eq '/' or $mount_point eq '/nix') {
+            if ($cur->{options} ne $new->{options}) {
+                # Mount options changed, so remount it.
+                $units_to_reload{$unit} = 1;
+                record_unit($reload_list_file, $unit);
+            } else {
+                # Don't unmount / or /nix if the device changed
+                $units_to_skip{$unit} = 1;
+            }
+        } else {
+            # Filesystem type or device changed, so unmount and mount it.
+            $units_to_restart{$unit} = 1;
+            record_unit($restart_list_file, $unit);
+        }
     } elsif ($cur->{options} ne $new->{options}) {
         # Mount options changes, so remount it.
         $units_to_reload{$unit} = 1;