summaryrefslogtreecommitdiff
path: root/mk/rootfs/openrc/etc/init.d/devfs
diff options
context:
space:
mode:
Diffstat (limited to 'mk/rootfs/openrc/etc/init.d/devfs')
-rw-r--r--mk/rootfs/openrc/etc/init.d/devfs32
1 files changed, 32 insertions, 0 deletions
diff --git a/mk/rootfs/openrc/etc/init.d/devfs b/mk/rootfs/openrc/etc/init.d/devfs
new file mode 100644
index 0000000..bfcb644
--- /dev/null
+++ b/mk/rootfs/openrc/etc/init.d/devfs
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
+# Released under the 2-clause BSD license.
+
+description="Mount system critical filesystems in /dev."
+
+start() {
+ # Mount required stuff as user may not have then in /etc/fstab
+ for x in \
+ "mqueue /dev/mqueue 1777 ,nodev mqueue" \
+ "devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \
+ "tmpfs /dev/shm 1777 ,nodev shm" \
+ ; do
+ set -- $x
+ grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue
+ mountinfo -q $2 && continue
+
+ if [ ! -d $2 ]; then
+ mkdir -m $3 -p $2 >/dev/null 2>&1 || \
+ ewarn "Could not create $2!"
+ fi
+
+ if [ -d $2 ]; then
+ ebegin "Mounting $2"
+ if ! fstabinfo --mount $2; then
+ mount -n -t $1 -o noexec,nosuid$4 $5 $2
+ fi
+ eend $?
+ fi
+ done
+ return 0
+}