aboutsummaryrefslogtreecommitdiff
path: root/init.d/devfs.in
blob: 9e31377080f2e153f62ff9ad1f07db5265ebe466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!@PREFIX@/sbin/runscript
# 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 \
		"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
}