* Mount /dev, /proc and /sys when booting without a stage 1 (e.g. on

Amazon).

svn path=/nixos/trunk/; revision=22598
This commit is contained in:
Eelco Dolstra 2010-07-14 10:55:45 +00:00
parent fb97b5b122
commit bfe46a653b

View File

@ -36,14 +36,28 @@ setPath "@path@"
mount -n -o remount,rw none /
# Mount special file systems. Note that /dev, /proc and /sys are
# already mounted by `switch_root' in the initrd.
# Likewise, stage 1 mounts /proc, /dev and /sys, so if we don't have a
# stage 1, we need to do that here.
if [ ! -e /proc/1 ]; then
mkdir -m 0755 -p /proc
mount -n -t proc none /proc
mkdir -m 0755 -p /sys
mount -t sysfs none /sys
mkdir -m 0755 -p /dev
mount -t tmpfs -o "mode=0755" none /dev
# Create the minimal device nodes needed for the activation scripts
# and Upstart.
mknod -m 0666 /dev/null c 1 3
mknod -m 0644 /dev/urandom c 1 9 # needed for passwd
mknod -m 0644 /dev/console c 5 1
fi
# Provide a /etc/mtab.
mkdir -m 0755 -p /etc
test -e /etc/fstab || touch /etc/fstab # to shut up mount
test -s /etc/mtab && rm /etc/mtab # while installing a symlink is created (see man mount), if it's still there for whateever reason remove it
rm -f /etc/mtab* # not that we care about stale locks
rm -f /etc/mtab
cat /proc/mounts > /etc/mtab