-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc
130 lines (105 loc) · 3.09 KB
/
rc
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
#
# /etc/rc: system boot script
#
echo "The system is coming up. Please wait."
# Load configuration.
. /etc/rc.conf
# Start udev.
/bin/mountpoint -q /proc || /bin/mount -t proc none /proc
/bin/mountpoint -q /sys || /bin/mount -t sysfs none /sys
/sbin/start_udev
# Create device-mapper device nodes and scan for LVM volume groups.
if [ -x /sbin/lvm ]; then
/sbin/vgscan --mknodes --ignorelockingfailure
/sbin/vgchange --sysinit -a y
fi
# Look for devices that could form further arrays and try to assemble them.
if [ -x /sbin/mdadm ]; then
/sbin/mdadm --assemble --scan
fi
# Parse crypttab and map encrypted volumes.
if [ -f /etc/crypttab ] && [ -x /sbin/cryptmount ]; then
/sbin/cryptmount -M
fi
# Mount root read-only.
/bin/mount -o remount,ro /
# Check filesystems.
if [ -f /forcefsck ]; then
FORCEFSCK="-f"
fi
# Intentional.
# shellcheck disable=SC2086
/sbin/fsck $FORCEFSCK -A -T -C -a
if [ $? -gt 1 ]; then
echo
echo "*************** FILESYSTEM CHECK FAILED ******************"
echo "* *"
echo "* Please repair manually and reboot. Note that the root *"
echo "* file system is currently mounted read-only. To remount *"
echo "* it read-write type: mount -n -o remount,rw / *"
echo "* When you exit the maintenance shell the system will *"
echo "* reboot automatically. *"
echo "* *"
echo "************************************************************"
echo
/sbin/sulogin -p
echo "Automatic reboot in progress..."
/bin/umount -a -r
/bin/mount -o remount,ro /
/sbin/reboot -f
exit 0
fi
# Mount local filesystems.
/bin/mount -o remount,rw /
/bin/mount -a -O no_netdev
# Create user dir in /run.
/bin/mkdir -m 0755 /run/user
# Activate swap.
/sbin/swapon -a
# Clean up misc files.
: >/run/utmp
/bin/rm -rf /forcefsck /fastboot /etc/nologin /etc/shutdownpid
(cd /var/lock && /usr/bin/find . ! -type d -delete)
(cd /tmp && /usr/bin/find . ! -name . -delete)
/bin/mkdir -m 1777 /tmp/.ICE-unix /tmp/.X11-unix
# Set kernel variables.
/sbin/sysctl -p >/dev/null
# Update shared library links.
/sbin/ldconfig
# Configure host name.
if [ "$HOSTNAME" ]; then
echo "hostname: $HOSTNAME"
/bin/hostname "$HOSTNAME"
fi
# Load random seed.
if [ -x /sbin/seedrng ]; then
/sbin/seedrng
fi
# Configure system clock.
if [ "$TIMEZONE" ] && [ -f /usr/share/zoneinfo/"$TIMEZONE" ]; then
/bin/ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
fi
# Set the system time from the hardware clock.
/sbin/hwclock -s
# Load console font.
if [ "$FONT" ] && [ -x /usr/bin/setfont ]; then
echo "font: $FONT"
/usr/bin/setfont "$FONT"
fi
# Load console keymap.
if [ "$KEYMAP" ] && [ -x /usr/bin/loadkeys ]; then
echo "keyboard: $KEYMAP"
/usr/bin/loadkeys -q "$KEYMAP"
fi
# Screen blanks after 15 minutes idle time.
if [ -x /usr/bin/setterm ]; then
/usr/bin/setterm -blank "${BLANKTIME:-15}"
fi
# Run module initialization script.
if [ -x /etc/rc.modules ]; then
/etc/rc.modules
fi
# Save boot messages.
/bin/dmesg >/var/log/boot
# End of file.