diff options
author | Sebastian Hagen <sh_github@memespace.net> | 2017-01-09 09:32:23 +0000 |
---|---|---|
committer | Franz Pletz <fpletz@fnordicwalking.de> | 2017-01-09 10:32:23 +0100 |
commit | 712e62c2608908cfda471cb8fe409ac65c4844e4 (patch) | |
tree | d6b7ad2afe4aaee6ef11a803bccb126212914927 /nixos/modules/system/boot/stage-2-init.sh | |
parent | d750321f24e03b990d3b2151765902aeed27d1d0 (diff) | |
download | nixpkgs-712e62c2608908cfda471cb8fe409ac65c4844e4.tar nixpkgs-712e62c2608908cfda471cb8fe409ac65c4844e4.tar.gz nixpkgs-712e62c2608908cfda471cb8fe409ac65c4844e4.tar.bz2 nixpkgs-712e62c2608908cfda471cb8fe409ac65c4844e4.tar.lz nixpkgs-712e62c2608908cfda471cb8fe409ac65c4844e4.tar.xz nixpkgs-712e62c2608908cfda471cb8fe409ac65c4844e4.tar.zst nixpkgs-712e62c2608908cfda471cb8fe409ac65c4844e4.zip |
nixos/stage2: Check for each special mount individually and mount missing ones. (#21370)
Diffstat (limited to 'nixos/modules/system/boot/stage-2-init.sh')
-rw-r--r-- | nixos/modules/system/boot/stage-2-init.sh | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh index f827e530f87..7a54bb03e29 100644 --- a/nixos/modules/system/boot/stage-2-init.sh +++ b/nixos/modules/system/boot/stage-2-init.sh @@ -34,20 +34,24 @@ if [ -z "$container" ]; then fi -# Likewise, stage 1 mounts /proc, /dev and /sys, so if we don't have a +# Likewise, stage 1 mounts /proc, /dev, /sys and /run, so if we don't have a # stage 1, we need to do that here. -if [ ! -e /proc/1 ]; then - specialMount() { - local device="$1" - local mountPoint="$2" - local options="$3" - local fsType="$4" - - mkdir -m 0755 -p "$mountPoint" - mount -n -t "$fsType" -o "$options" "$device" "$mountPoint" - } - source @earlyMountScript@ -fi +# We check for each mountpoint separately to avoid esoteric failure modes +# if only a subset was mounted by whatever called us. +specialMount() { + local device="$1" + local mountPoint="$2" + local options="$3" + local fsType="$4" + + if mountpoint -q "$mountpoint"; then + return 0 + fi + + mkdir -m 0755 -p "$mountPoint" + mount -n -t "$fsType" -o "$options" "$device" "$mountPoint" +} +source @earlyMountScript@ echo "booting system configuration $systemConfig" > /dev/kmsg |