nixos/stage2: Check for each special mount individually and mount missing ones. (#21370)

This commit is contained in:
Sebastian Hagen 2017-01-09 09:32:23 +00:00 committed by Franz Pletz
parent d750321f24
commit 712e62c260

View File

@ -34,20 +34,24 @@ if [ -z "$container" ]; then
fi 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. # stage 1, we need to do that here.
if [ ! -e /proc/1 ]; then # We check for each mountpoint separately to avoid esoteric failure modes
# if only a subset was mounted by whatever called us.
specialMount() { specialMount() {
local device="$1" local device="$1"
local mountPoint="$2" local mountPoint="$2"
local options="$3" local options="$3"
local fsType="$4" local fsType="$4"
if mountpoint -q "$mountpoint"; then
return 0
fi
mkdir -m 0755 -p "$mountPoint" mkdir -m 0755 -p "$mountPoint"
mount -n -t "$fsType" -o "$options" "$device" "$mountPoint" mount -n -t "$fsType" -o "$options" "$device" "$mountPoint"
} }
source @earlyMountScript@ source @earlyMountScript@
fi
echo "booting system configuration $systemConfig" > /dev/kmsg echo "booting system configuration $systemConfig" > /dev/kmsg