1 | #!/bin/sh
|
---|
2 | ########################################################################
|
---|
3 | # Begin mountvirtfs
|
---|
4 | #
|
---|
5 | # Description : Ensure proc, sysfs, run, and dev are mounted
|
---|
6 | #
|
---|
7 | # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
8 | # DJ Lucas - dj@linuxfromscratch.org
|
---|
9 | # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
---|
10 | #
|
---|
11 | # Version : LFS 7.0
|
---|
12 | #
|
---|
13 | ########################################################################
|
---|
14 |
|
---|
15 | ### BEGIN INIT INFO
|
---|
16 | # Provides: mountvirtfs
|
---|
17 | # Required-Start: $first
|
---|
18 | # Should-Start:
|
---|
19 | # Required-Stop:
|
---|
20 | # Should-Stop:
|
---|
21 | # Default-Start: S
|
---|
22 | # Default-Stop:
|
---|
23 | # Short-Description: Mounts various special fs needed at start
|
---|
24 | # Description: Mounts /sys and /proc virtual (kernel) filesystems.
|
---|
25 | # Mounts /run (tmpfs) and /dev (devtmpfs).
|
---|
26 | # This is done only if they are not already mounted.
|
---|
27 | # with the kernel config proposed in the book, dev
|
---|
28 | # should be automatically mounted by the kernel.
|
---|
29 | # X-LFS-Provided-By: LFS
|
---|
30 | ### END INIT INFO
|
---|
31 |
|
---|
32 | . /lib/lsb/init-functions
|
---|
33 |
|
---|
34 | case "${1}" in
|
---|
35 | start)
|
---|
36 | # Make sure /run is available before logging any messages
|
---|
37 | if ! mountpoint /run >/dev/null; then
|
---|
38 | mount /run || failed=1
|
---|
39 | fi
|
---|
40 |
|
---|
41 | mkdir -p /run/lock
|
---|
42 | chmod 1777 /run/lock
|
---|
43 |
|
---|
44 | log_info_msg "Mounting virtual file systems: ${INFO}/run"
|
---|
45 |
|
---|
46 | if ! mountpoint /proc >/dev/null; then
|
---|
47 | log_info_msg2 " ${INFO}/proc"
|
---|
48 | mount -o nosuid,noexec,nodev /proc || failed=1
|
---|
49 | fi
|
---|
50 |
|
---|
51 | if ! mountpoint /sys >/dev/null; then
|
---|
52 | log_info_msg2 " ${INFO}/sys"
|
---|
53 | mount -o nosuid,noexec,nodev /sys || failed=1
|
---|
54 | fi
|
---|
55 |
|
---|
56 | if ! mountpoint /dev >/dev/null; then
|
---|
57 | log_info_msg2 " ${INFO}/dev"
|
---|
58 | mount -o mode=0755,nosuid /dev || failed=1
|
---|
59 | fi
|
---|
60 |
|
---|
61 | mkdir -p /dev/shm
|
---|
62 | log_info_msg2 " ${INFO}/dev/shm"
|
---|
63 | mount -o nosuid,nodev /dev/shm || failed=1
|
---|
64 |
|
---|
65 | (exit ${failed})
|
---|
66 | evaluate_retval
|
---|
67 | exit $failed
|
---|
68 | ;;
|
---|
69 |
|
---|
70 | *)
|
---|
71 | echo "Usage: ${0} {start}"
|
---|
72 | exit 1
|
---|
73 | ;;
|
---|
74 | esac
|
---|
75 |
|
---|
76 | # End mountvirtfs
|
---|