CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
e2fsprogs: updated to 1.42.5 and aligned with upstream
[crossrootfs.git] / rc / rc
CommitLineData
6dca1d21
JB
1#!/bin/bash
2#
3# /etc/rc: system boot script
4#
5
d9b5f707 6echo "The system is coming up. Please wait."
6dca1d21
JB
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
d9b5f707
JB
16# Create device-mapper device nodes and scan for LVM volume groups
17if [ -x /sbin/lvm ]; then
18 /sbin/vgscan --mknodes --ignorelockingfailure
19 /sbin/vgchange --ignorelockingfailure -a y
20fi
21
6dca1d21
JB
22# Mount root read-only
23/bin/mount -n -o remount,ro /
24
dec3d7f0
VM
25if [ -f /forcefsck ]; then
26FORCEFSCK="-f"
27fi
28
6dca1d21 29# Check filesystems
dec3d7f0 30/sbin/fsck $FORCEFSCK -A -T -C -a
6dca1d21
JB
31if [ $? -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
46 /bin/mount -n -o remount,ro /
47 /sbin/reboot -f
48 exit 0
49fi
50
51# Mount local filesystems
52/bin/mount -n -o remount,rw /
53/bin/umount /sys /proc
54/bin/rm -f /etc/mtab*
55/bin/touch /etc/mtab
56/bin/mount -o remount,rw /
57/bin/mount -a -O no_netdev
58
59# Activate swap
60/sbin/swapon -a
61
62# Clean up misc files
63: > /var/run/utmp
d9b5f707 64/bin/rm -rf /forcefsck /fastboot /etc/nologin /etc/shutdownpid
6dca1d21
JB
65(cd /var/run && /usr/bin/find . -name "*.pid" -delete)
66(cd /var/lock && /usr/bin/find . ! -type d -delete)
67(cd /tmp && /usr/bin/find . ! -name . -delete)
68/bin/mkdir -m 1777 /tmp/.ICE-unix
69
70# Set kernel variables
71/sbin/sysctl -p > /dev/null
72
73# Update shared library links
74/sbin/ldconfig
75
76# Configure host name
77if [ "$HOSTNAME" ]; then
78 echo "hostname: $HOSTNAME"
79 /bin/hostname $HOSTNAME
80fi
81
82# Load random seed
83/bin/cat /var/lib/urandom/seed > /dev/urandom
84
85# Configure system clock
86if [ "$TIMEZONE" ]; then
87 /bin/ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
88fi
d9b5f707 89/sbin/hwclock --hctosys
6dca1d21
JB
90
91# Load console font
92if [ "$FONT" ]; then
93 echo "font: $FONT"
94 /usr/bin/setfont $FONT
95fi
96
97# Load console keymap
98if [ "$KEYMAP" ]; then
99 echo "keyboard: $KEYMAP"
d9b5f707 100 /usr/bin/loadkeys -q $KEYMAP
6dca1d21
JB
101fi
102
d9b5f707
JB
103# Screen blanks after 15 minutes idle time
104/usr/bin/setterm -blank 15
6dca1d21
JB
105
106# Run module initialization script
107if [ -x /etc/rc.modules ]; then
108 /etc/rc.modules
109fi
110
111# Save boot messages
112/bin/dmesg > /var/log/boot
113
114# End of file