12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- # shellcheck shell=sh
- __mnt() {
- for last in "${@}"; do :; done
- mountpoint -q "${last}" || mount "${@}"
- }
- (
- umask 0022
- cd /dev && \
- mkdir pts shm
- cd /run && {
- mkdir runit
- mkdir -m0700 cryptsetup
- }
- )
- msg 'mounting pseudo file systems'
- __mnt -o nosuid,noexec,nodev -t proc none /proc
- __mnt -o nosuid,noexec,nodev -t sysfs none /sys
- __mnt -o mode=0755,nosuid -t devtmpfs none /dev
- __mnt -o mode=0755,nosuid,nodev,size=512M -t tmpfs none /run
- __mnt -o mode=0620,gid=5,nosuid,noexec -n -t devpts devpts /dev/pts
- __mnt -o mode=1777,nosuid,nodev,size=1G -n -t tmpfs shm /dev/shm
- __mnt -o mode=0755,size=1M -t tmpfs cgroup /sys/fs/cgroup
- msg 'mounting cgroups'
- while read -r name _ _ e; do
- [ "${e}" = 1 ] && {
- mkdir -p "/sys/fs/cgroup/${name}" || continue
- __mnt -o "${name}" -t cgroup cgroup "/sys/fs/cgroup/${name}"
- }
- done < /proc/cgroups
- mkdir -p /sys/fs/cgroup/unified
- __mnt -o nsdelegate -t cgroup2 cgroup2 /sys/fs/cgroup/unified
- msg "remounting root '/'"
- mount -o remount /
- unset __mnt
|