1 | #!/bin/ash
|
---|
2 |
|
---|
3 | # System Startup Script
|
---|
4 | #
|
---|
5 | . /etc/rc.d/init.d/functions
|
---|
6 |
|
---|
7 | /bin/mount -t proc proc /proc
|
---|
8 | /bin/mount -t sysfs none /sys
|
---|
9 | /bin/mount -o remount,rw /
|
---|
10 | /bin/mount -t tmpfs -o mode=0755 udev /dev
|
---|
11 | /bin/mkdir /dev/pts
|
---|
12 | /bin/mkdir /dev/shm
|
---|
13 | /bin/echo "/sbin/mdev" > /proc/sys/kernel/hotplug
|
---|
14 | /sbin/mdev -s
|
---|
15 |
|
---|
16 | echo -n "Setting system clock: "
|
---|
17 | hwclock --hctosys --utc
|
---|
18 | check_status
|
---|
19 |
|
---|
20 | echo "Starting fsck for root filesystem."
|
---|
21 | fsck -T -C /
|
---|
22 | if [ "$?" -gt 2 ]; then
|
---|
23 | echo "WARNING: Errors found while checking root filesystem."
|
---|
24 | echo "You can login as root now, the system will reboot after logout."
|
---|
25 | sulogin
|
---|
26 | reboot
|
---|
27 | elif [ "$?" = "2" ]; then
|
---|
28 | echo "NOTICE: System needs to be rebooted now."
|
---|
29 | sleep 1
|
---|
30 | reboot
|
---|
31 | else
|
---|
32 | echo -n "Checking root filesystem: "
|
---|
33 | check_status
|
---|
34 | fi
|
---|
35 |
|
---|
36 | echo -n "Remounting root rw: "
|
---|
37 | mount -o remount,rw /
|
---|
38 | check_status
|
---|
39 |
|
---|
40 | echo -n "Mounting devpts: "
|
---|
41 | mount /dev/pts
|
---|
42 | check_status
|
---|
43 |
|
---|
44 | echo "Starting fsck for local filesystems."
|
---|
45 | fsck -A -C -R -T -t nonfs,nosmbfs
|
---|
46 | if [ "$?" -gt 2 ]; then
|
---|
47 | echo "WARNING: Errors found while checking filesystems."
|
---|
48 | echo "You can login as root now, the system will reboot after logout."
|
---|
49 | sulogin
|
---|
50 | reboot
|
---|
51 | elif [ "$?" = "2" ]; then
|
---|
52 | echo "NOTICE: System needs to be rebooted now."
|
---|
53 | sleep 1
|
---|
54 | reboot
|
---|
55 | else
|
---|
56 | echo -n "Checking local filesystems: "
|
---|
57 | check_status
|
---|
58 | fi
|
---|
59 |
|
---|
60 | echo -n "Enabling swap space: "
|
---|
61 | swapon -a
|
---|
62 | check_status
|
---|
63 |
|
---|
64 | echo -n "Setting hostname: "
|
---|
65 | hostname -F /etc/HOSTNAME
|
---|
66 | check_status
|
---|
67 |
|
---|
68 | echo -n "Cleaning up system: "
|
---|
69 | > /var/run/utmp
|
---|
70 | touch /var/log/wtmp
|
---|
71 | touch /var/log/messages
|
---|
72 | chmod 0664 /var/run/utmp
|
---|
73 | chmod 0664 /var/log/wtmp
|
---|
74 | chmod 0660 /var/log/messages
|
---|
75 | rm -rf /tmp/*
|
---|
76 | rm -f /var/run/*.pid
|
---|
77 | check_status
|
---|
78 |
|
---|
79 | echo -n "Setting up interface lo: "
|
---|
80 | ifconfig lo up 127.0.0.1
|
---|
81 | check_status
|
---|
82 |
|
---|
83 | echo "Running start scripts."
|
---|
84 |
|
---|
85 | for i in /etc/rc.d/start/*
|
---|
86 | do
|
---|
87 | if [ -x $i ]; then
|
---|
88 | $i start
|
---|
89 | fi
|
---|
90 | done
|
---|