Skip to content

Commit

Permalink
nixos/stage2: Check for each special mount individually and mount mis…
Browse files Browse the repository at this point in the history
…sing ones. (#21370)
  • Loading branch information
sh01 authored and fpletz committed Jan 9, 2017
1 parent d750321 commit 712e62c
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions nixos/modules/system/boot/stage-2-init.sh
Expand Up @@ -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
Expand Down

0 comments on commit 712e62c

Please sign in to comment.