summaryrefslogtreecommitdiff
path: root/init.d/devfs.in
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-10-10 08:37:21 +0000
committerRoy Marples <roy@marples.name>2008-10-10 08:37:21 +0000
commitd6da8e8c48feb8faf9287fc86fbbf0890c37a87c (patch)
treee6cdf21f0f3a3270b705fe14b876f92b14b38dbf /init.d/devfs.in
parent247766695cd7c5e8d83dff72f7eb7e6578bf57b8 (diff)
downloadopenrc-d6da8e8c48feb8faf9287fc86fbbf0890c37a87c.tar.gz
openrc-d6da8e8c48feb8faf9287fc86fbbf0890c37a87c.tar.bz2
openrc-d6da8e8c48feb8faf9287fc86fbbf0890c37a87c.tar.xz
sysinit is now a real runlevel that handles things like udev, dmesg and
mounting various bits in /dev and /sys. init.sh JUST mounts /lib/rc/init.d (and /proc for Linux systems) To make development of this easier we now return an empty RC_STRINGLIST instead of a NULL for empty things. If you don't have a udev init script installed, don't reboot your box OR roll back to an older OpenRC version.
Diffstat (limited to 'init.d/devfs.in')
-rw-r--r--init.d/devfs.in36
1 files changed, 36 insertions, 0 deletions
diff --git a/init.d/devfs.in b/init.d/devfs.in
new file mode 100644
index 0000000..2e140f0
--- /dev/null
+++ b/init.d/devfs.in
@@ -0,0 +1,36 @@
+#!@PREFIX@/sbin/runscript
+# Copyright 2007-2008 Roy Marples <roy@marples.name>
+# All rights reserved. Released under the 2-clause BSD license.
+
+description="Mount system critical filesystems in /dev."
+
+depend() {
+ use dev
+ keyword noprefix
+}
+
+start() {
+ # Mount required stuff as user may not have then in /etc/fstab
+ for x in \
+ "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
+}