openrc/init.d/devfs.in

39 lines
846 B
Plaintext
Raw Normal View History

#!@PREFIX@/sbin/runscript
2009-05-01 19:41:40 +05:30
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
description="Mount system critical filesystems in /dev."
depend() {
use dev-mount
before dev
keyword -prefix -vserver
}
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
2009-04-27 13:21:18 +05:30
set -- $x
grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue
2009-04-27 13:21:18 +05:30
mountinfo -q $2 && continue
2009-04-27 13:21:18 +05:30
if [ ! -d $2 ]; then
mkdir -m $3 -p $2 >/dev/null 2>&1 || \
ewarn "Could not create $2!"
fi
2009-04-27 13:21:18 +05:30
if [ -d $2 ]; then
ebegin "Mounting $2"
2009-04-27 13:21:18 +05:30
if ! fstabinfo --mount $2; then
mount -n -t $1 -o noexec,nosuid$4 $5 $2
fi
eend $?
fi
done
return 0
}