nixos/activation: Avoid remounting non-existing FS

Regression introduced by 79d4636d50.

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>
This commit is contained in:
aszlig 2016-09-26 01:54:45 +02:00
parent 8967a3f798
commit f94ea04805
No known key found for this signature in database
GPG Key ID: 1DE8E48E57DB5436

View File

@ -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}
'';