diff options
author | Janne Heß <janne@hess.ooo> | 2023-09-13 18:22:12 +0200 |
---|---|---|
committer | Janne Heß <janne@hess.ooo> | 2023-09-22 10:26:10 +0200 |
commit | 85c1c30fd9ab350ad254736d0950d07639b9f6e8 (patch) | |
tree | c2ef8efca934f044924f8abc100557af86a89dee /nixos/modules/system | |
parent | c3e6412260dd30f82b715f976fff834fbeddae2f (diff) | |
download | nixlib-85c1c30fd9ab350ad254736d0950d07639b9f6e8.tar nixlib-85c1c30fd9ab350ad254736d0950d07639b9f6e8.tar.gz nixlib-85c1c30fd9ab350ad254736d0950d07639b9f6e8.tar.bz2 nixlib-85c1c30fd9ab350ad254736d0950d07639b9f6e8.tar.lz nixlib-85c1c30fd9ab350ad254736d0950d07639b9f6e8.tar.xz nixlib-85c1c30fd9ab350ad254736d0950d07639b9f6e8.tar.zst nixlib-85c1c30fd9ab350ad254736d0950d07639b9f6e8.zip |
nixos/switch-to-configuration: Never unmount / or /nix
Also adds a huge test for fstab handling
Diffstat (limited to 'nixos/modules/system')
-rwxr-xr-x | nixos/modules/system/activation/switch-to-configuration.pl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index 95308d5da946..e05f89bb0fb4 100755 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -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; |