summary refs log tree commit diff
path: root/os/etc/s6-rc/src/mount-sysfs/up
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2023-09-25 11:56:34 +0200
committerRobert Günzler <r@gnzler.io>2023-09-25 11:56:34 +0200
commitf5c219983c0f60a07f1bd52b6f6071e86f35455e (patch)
treeb7520a02b9822481f29aea4ccb404744a73414b1 /os/etc/s6-rc/src/mount-sysfs/up
parent91ba318df1ff9b04d08af373ae904f61a91bf489 (diff)
add os config
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'os/etc/s6-rc/src/mount-sysfs/up')
-rw-r--r--os/etc/s6-rc/src/mount-sysfs/up66
1 files changed, 66 insertions, 0 deletions
diff --git a/os/etc/s6-rc/src/mount-sysfs/up b/os/etc/s6-rc/src/mount-sysfs/up
new file mode 100644
index 0000000..d84627f
--- /dev/null
+++ b/os/etc/s6-rc/src/mount-sysfs/up
@@ -0,0 +1,66 @@
+#!/bin/execlineb -P
+
+# /sys
+foreground {
+	if -n { test -d /sys } mkdir -m 0755 /sys
+	if -n { mountpoint -q /sys }
+		mount -t sysfs sys /sys -o nosuid,noexec,nodev
+
+}
+
+# securityfs
+foreground {
+	if -t { test -d /sys/kernel/security }
+	if -t { grep -qs securityfs /proc/filesystems }
+	if -n { mountpoint -q /sys/kernel/security }
+		mount -t securityfs securityfs /sys/kernel/security -o nosuid,noexec,nodev
+}
+
+# debugfs
+foreground {
+	if -t { test -d /sys/kernel/debug }
+	if -t { grep -qs debugfs /proc/filesystems }
+	if -n { mountpoint -q /sys/kernel/debug }
+		mount -t debugfs debugfs /sys/kernel/debug -o nosuid,noexec,nodev
+}
+
+# configfs
+foreground {
+	if -t { test -d /sys/kernel/config }
+	if -t { grep -qs configfs /proc/filesystems }
+	if -n { mountpoint -q /sys/kernel/config }
+		mount -t configfs configfs /sys/kernel/config -o nosuid,noexec,nodev
+}
+
+# fusectl
+foreground {
+	if -t { test -d /sys/fs/fuse/connections }
+	if -t { grep -qs fusectl /proc/filesystems }
+	if -n { mountpoint -q /sys/fs/fuse/connections }
+		mount -t fusectl fusectl /sys/fs/fuse/connections -o nosuid,noexec,nodev
+}
+
+# pstore
+foreground {
+	if -t { test -d /sys/fs/pstore }
+	if -t { grep -qs 'pstore$' /proc/filesystems }
+	if -n { mountpoint -q /sys/fs/pstore }
+		mount -t pstore pstore /sys/fs/pstore -o nosuid,noexec,nodev
+}
+
+# selinux
+foreground {
+	if -t { test -d /sys/fs/selinux }
+	if -t { grep -qs selinuxfs /proc/filesystems }
+	if -n { mountpoint -q /sys/fs/selinux }
+		mount -t selinuxfs selinuxfs /sys/fs/selinux -o nosuid,noexec,nodev
+}
+
+# efivarfs
+foreground {
+	if -t { test -d /sys/firmware/efi }
+	if -t { grep -qs efivarfs /proc/filesystems }
+	if { test -d /sys/firmware/efi }
+		if -n { mountpoint -q /sys/firmware/efi/efivars }
+			mount -n -t efivarfs efivarfs /sys/firmware/efi/efivars -o ro,nosuid,noexec,nodev
+}