summary refs log tree commit diff
path: root/os/etc/s6-rc/src/mount-devfs/up
blob: bbb8ec557aa335290422188c05539bc780d8170d (plain) (blame)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/execlineb -P

# mount /dev through fstab
foreground {
	if -n { mountpoint -q /dev }
		if -t { fstabinfo -q /dev } fstabinfo -q --mount /dev
}
# or manually
foreground {
	if -n { mountpoint -q /dev }
		ifelse -n { grep -q devtmpfs /proc/filesystems } { echo "This kernel doesn't have support for devtmpfs! This means /dev will not be mounted." }
			mount -n -t devtmpfs dev /dev -o mode=0755,noexec,nosuid,size=10M
}

# creating console, tty1 and tty to be able to write to console
# with/without bootsplash before udevd creates it
foreground { if -n { test -c /dev/console } mknod -m 600 /dev/console c 5 1 }
foreground { if -n { test -c /dev/tty1 } mknod -m 620 /dev/tty1 c 4 1 }
foreground { if -n { test -c /dev/tty } mknod -m 666 /dev/tty c 5 0 }

# udevd will dup it's std{in,out,err} to /dev/null
# and we don't want a file which gets buffered in ram
foreground { if -n { test -c /dev/null } mknod -m 666 /dev/null c 1 3 }

# so udev can add it's start message to dmesg
foreground { if -n { test -c /dev/kmesg } mknod -m 660 /dev/kmesg c 1 11 }

# extra symlinks
foreground { ln -snf /proc/self/fd /dev/fd }
foreground { ln -snf /proc/self/fd/0 /dev/stdin }
foreground { ln -snf /proc/self/fd/1 /dev/stdout }
foreground { ln -snf /proc/self/fd/2 /dev/stderr }
foreground { ln -snf /proc/kcore /dev/core }

# mount required dirs that may not be in /etc/fstab
foreground { mkdir -m 1777 -p /dev/mqueue }
foreground {
	if -n { mountpoint -q /dev/mqueue }
		mount -n -t mqueue mqueue /dev/mqueue -o nosuid,noexec,nodev
}

foreground { mkdir -m 0755 -p /dev/pts }
foreground {
	if -n { mountpoint -q /dev/pts }
		mount -n -t devpts devpts /dev/pts -o gid=5,mode=0620,nosuid,noexec
}

foreground { mkdir -m 1777 -p /dev/shm }
foreground {
	if -n { mountpoint -q /dev/shm }
		mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,noexec,nodev
}