Commit | Line | Data |
---|---|---|
6dca1d21 JB |
1 | #!/bin/bash |
2 | # | |
3 | # /etc/rc: system boot script | |
4 | # | |
5 | ||
d9b5f707 | 6 | echo "The system is coming up. Please wait." |
6dca1d21 JB |
7 | |
8 | # Load configuration | |
9 | . /etc/rc.conf | |
10 | ||
11 | # Start udev | |
8499ab6e VM |
12 | /bin/mount -t proc none /proc |
13 | /bin/mount -t sysfs none /sys | |
6dca1d21 JB |
14 | /sbin/start_udev |
15 | ||
d9b5f707 JB |
16 | # Create device-mapper device nodes and scan for LVM volume groups |
17 | if [ -x /sbin/lvm ]; then | |
18 | /sbin/vgscan --mknodes --ignorelockingfailure | |
19 | /sbin/vgchange --ignorelockingfailure -a y | |
20 | fi | |
21 | ||
6dca1d21 | 22 | # Mount root read-only |
8499ab6e | 23 | /bin/mount -o remount,ro / |
6dca1d21 | 24 | |
dec3d7f0 VM |
25 | if [ -f /forcefsck ]; then |
26 | FORCEFSCK="-f" | |
27 | fi | |
28 | ||
6dca1d21 | 29 | # Check filesystems |
dec3d7f0 | 30 | /sbin/fsck $FORCEFSCK -A -T -C -a |
6dca1d21 JB |
31 | if [ $? -gt 1 ]; then |
32 | echo | |
33 | echo "*************** FILESYSTEM CHECK FAILED ******************" | |
34 | echo "* *" | |
35 | echo "* Please repair manually and reboot. Note that the root *" | |
36 | echo "* file system is currently mounted read-only. To remount *" | |
37 | echo "* it read-write type: mount -n -o remount,rw / *" | |
38 | echo "* When you exit the maintainance shell the system will *" | |
39 | echo "* reboot automatically. *" | |
40 | echo "* *" | |
41 | echo "************************************************************" | |
42 | echo | |
43 | /sbin/sulogin -p | |
44 | echo "Automatic reboot in progress..." | |
45 | /bin/umount -a -r | |
8499ab6e | 46 | /bin/mount -o remount,ro / |
6dca1d21 JB |
47 | /sbin/reboot -f |
48 | exit 0 | |
49 | fi | |
50 | ||
51 | # Mount local filesystems | |
6dca1d21 JB |
52 | /bin/mount -o remount,rw / |
53 | /bin/mount -a -O no_netdev | |
54 | ||
55 | # Activate swap | |
56 | /sbin/swapon -a | |
57 | ||
58 | # Clean up misc files | |
59 | : > /var/run/utmp | |
d9b5f707 | 60 | /bin/rm -rf /forcefsck /fastboot /etc/nologin /etc/shutdownpid |
6dca1d21 JB |
61 | (cd /var/run && /usr/bin/find . -name "*.pid" -delete) |
62 | (cd /var/lock && /usr/bin/find . ! -type d -delete) | |
63 | (cd /tmp && /usr/bin/find . ! -name . -delete) | |
64 | /bin/mkdir -m 1777 /tmp/.ICE-unix | |
65 | ||
66 | # Set kernel variables | |
67 | /sbin/sysctl -p > /dev/null | |
68 | ||
69 | # Update shared library links | |
70 | /sbin/ldconfig | |
71 | ||
72 | # Configure host name | |
73 | if [ "$HOSTNAME" ]; then | |
74 | echo "hostname: $HOSTNAME" | |
75 | /bin/hostname $HOSTNAME | |
76 | fi | |
77 | ||
78 | # Load random seed | |
79 | /bin/cat /var/lib/urandom/seed > /dev/urandom | |
80 | ||
81 | # Configure system clock | |
82 | if [ "$TIMEZONE" ]; then | |
83 | /bin/ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime | |
84 | fi | |
d9b5f707 | 85 | /sbin/hwclock --hctosys |
6dca1d21 JB |
86 | |
87 | # Load console font | |
88 | if [ "$FONT" ]; then | |
89 | echo "font: $FONT" | |
90 | /usr/bin/setfont $FONT | |
91 | fi | |
92 | ||
93 | # Load console keymap | |
94 | if [ "$KEYMAP" ]; then | |
95 | echo "keyboard: $KEYMAP" | |
d9b5f707 | 96 | /usr/bin/loadkeys -q $KEYMAP |
6dca1d21 JB |
97 | fi |
98 | ||
d9b5f707 JB |
99 | # Screen blanks after 15 minutes idle time |
100 | /usr/bin/setterm -blank 15 | |
6dca1d21 JB |
101 | |
102 | # Run module initialization script | |
103 | if [ -x /etc/rc.modules ]; then | |
104 | /etc/rc.modules | |
105 | fi | |
106 | ||
107 | # Save boot messages | |
108 | /bin/dmesg > /var/log/boot | |
109 | ||
110 | # End of file |