CRUX-ARM : Home

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