about summary refs log tree commit diff
path: root/nixos/modules/system/activation
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-09-26 01:54:45 +0200
committeraszlig <aszlig@redmoonstudios.org>2016-09-26 02:04:54 +0200
commitf94ea04805845d1d98e2a9ff1342c3aad196d3a1 (patch)
tree57a5f3b45a5763adceca3e5f8a78880e46443a10 /nixos/modules/system/activation
parent8967a3f7981ad0d029a0057a4493701398893ad2 (diff)
downloadnixlib-f94ea04805845d1d98e2a9ff1342c3aad196d3a1.tar
nixlib-f94ea04805845d1d98e2a9ff1342c3aad196d3a1.tar.gz
nixlib-f94ea04805845d1d98e2a9ff1342c3aad196d3a1.tar.bz2
nixlib-f94ea04805845d1d98e2a9ff1342c3aad196d3a1.tar.lz
nixlib-f94ea04805845d1d98e2a9ff1342c3aad196d3a1.tar.xz
nixlib-f94ea04805845d1d98e2a9ff1342c3aad196d3a1.tar.zst
nixlib-f94ea04805845d1d98e2a9ff1342c3aad196d3a1.zip
nixos/activation: Avoid remounting non-existing FS
Regression introduced by 79d4636d506094eae3c5c7575a0bef817cba9bda.

The mentioned commit moves /run/keys from stage 2 to
boot.specialFileSystems, the latter being remounted during system
activation.

Unfortunately, the specialMount function in the activation script does
this unconditionally and thus will fail if it can't be remounted because
the mount point simply doesn't exist.

We now check the mount point for existance and only remount if it exists
but mkdir + mount it if it doesn't.

Tested against the "simple" NixOS installer test.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'nixos/modules/system/activation')
-rw-r--r--nixos/modules/system/activation/activation-script.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index 4c3d30e346c5..fa0ad747454c 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -167,7 +167,12 @@ in
           local options="$3"
           local fsType="$4"
 
-          ${pkgs.utillinux}/bin/mount -t "$fsType" -o "remount,$options" "$device" "$mountPoint"
+          if ${pkgs.utillinux}/bin/mountpoint -q "$mountPoint"; then
+            local options="remount,$options"
+          else
+            mkdir -m 0755 -p "$mountPoint"
+          fi
+          ${pkgs.utillinux}/bin/mount -t "$fsType" -o "$options" "$device" "$mountPoint"
         }
         source ${config.system.build.earlyMountScript}
       '';