diff options
| author | Robert Günzler <r@gnzler.io> | 2023-09-25 11:56:34 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2023-09-25 11:56:34 +0200 |
| commit | f5c219983c0f60a07f1bd52b6f6071e86f35455e (patch) | |
| tree | b7520a02b9822481f29aea4ccb404744a73414b1 /os/etc/s6-rc/src/mount-devfs | |
| parent | 91ba318df1ff9b04d08af373ae904f61a91bf489 (diff) | |
add os config
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'os/etc/s6-rc/src/mount-devfs')
| -rw-r--r-- | os/etc/s6-rc/src/mount-devfs/dependencies.d/mount-procfs | 0 | ||||
| -rw-r--r-- | os/etc/s6-rc/src/mount-devfs/type | 1 | ||||
| -rw-r--r-- | os/etc/s6-rc/src/mount-devfs/up | 52 |
3 files changed, 53 insertions, 0 deletions
diff --git a/os/etc/s6-rc/src/mount-devfs/dependencies.d/mount-procfs b/os/etc/s6-rc/src/mount-devfs/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/os/etc/s6-rc/src/mount-devfs/dependencies.d/mount-procfs diff --git a/os/etc/s6-rc/src/mount-devfs/type b/os/etc/s6-rc/src/mount-devfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/os/etc/s6-rc/src/mount-devfs/type @@ -0,0 +1 @@ +oneshot diff --git a/os/etc/s6-rc/src/mount-devfs/up b/os/etc/s6-rc/src/mount-devfs/up new file mode 100644 index 0000000..bbb8ec5 --- /dev/null +++ b/os/etc/s6-rc/src/mount-devfs/up @@ -0,0 +1,52 @@ +#!/bin/execlineb -P + +# mount /dev through fstab +foreground { + if -n { mountpoint -q /dev } + if -t { fstabinfo -q /dev } fstabinfo -q --mount /dev +} +# or manually +foreground { + if -n { mountpoint -q /dev } + ifelse -n { grep -q devtmpfs /proc/filesystems } { echo "This kernel doesn't have support for devtmpfs! This means /dev will not be mounted." } + mount -n -t devtmpfs dev /dev -o mode=0755,noexec,nosuid,size=10M +} + +# creating console, tty1 and tty to be able to write to console +# with/without bootsplash before udevd creates it +foreground { if -n { test -c /dev/console } mknod -m 600 /dev/console c 5 1 } +foreground { if -n { test -c /dev/tty1 } mknod -m 620 /dev/tty1 c 4 1 } +foreground { if -n { test -c /dev/tty } mknod -m 666 /dev/tty c 5 0 } + +# udevd will dup it's std{in,out,err} to /dev/null +# and we don't want a file which gets buffered in ram +foreground { if -n { test -c /dev/null } mknod -m 666 /dev/null c 1 3 } + +# so udev can add it's start message to dmesg +foreground { if -n { test -c /dev/kmesg } mknod -m 660 /dev/kmesg c 1 11 } + +# extra symlinks +foreground { ln -snf /proc/self/fd /dev/fd } +foreground { ln -snf /proc/self/fd/0 /dev/stdin } +foreground { ln -snf /proc/self/fd/1 /dev/stdout } +foreground { ln -snf /proc/self/fd/2 /dev/stderr } +foreground { ln -snf /proc/kcore /dev/core } + +# mount required dirs that may not be in /etc/fstab +foreground { mkdir -m 1777 -p /dev/mqueue } +foreground { + if -n { mountpoint -q /dev/mqueue } + mount -n -t mqueue mqueue /dev/mqueue -o nosuid,noexec,nodev +} + +foreground { mkdir -m 0755 -p /dev/pts } +foreground { + if -n { mountpoint -q /dev/pts } + mount -n -t devpts devpts /dev/pts -o gid=5,mode=0620,nosuid,noexec +} + +foreground { mkdir -m 1777 -p /dev/shm } +foreground { + if -n { mountpoint -q /dev/shm } + mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,noexec,nodev +} |