#!/bin/sh
# /etc/init.d/rcS - run once by init at boot (::sysinit in /etc/inittab).
# Mounts only what isn't mounted yet, so it works the same whether the
# root filesystem is an initramfs or a real disk.

mnt() { # mnt TYPE DIR [OPTIONS]
	mountpoint -q "$2" && return 0
	mkdir -p "$2"
	mount -t "$1" ${3:+-o "$3"} "$1" "$2"
}

mnt proc     /proc    nosuid,nodev,noexec
mnt sysfs    /sys     nosuid,nodev,noexec
mnt devtmpfs /dev     nosuid,mode=0755
mnt devpts   /dev/pts nosuid,noexec,gid=5,mode=0620
mnt tmpfs    /dev/shm nosuid,nodev,mode=1777
mnt tmpfs    /run     nosuid,nodev,mode=0755

# A real root filesystem is usually mounted read-only by the kernel.
mount -o remount,rw / 2>/dev/null

[ -r /etc/hostname ] && hostname -F /etc/hostname
