CRUX-ARM : Home

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