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