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