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 | echo -n "Mounting proc: "
|
---|
11 | mount /proc
|
---|
12 | check_status
|
---|
13 |
|
---|
14 | echo -n "Mounting sysfs: "
|
---|
15 | mount -t sysfs none /sys
|
---|
16 | check_status
|
---|
17 |
|
---|
18 | echo -n "Mounting dev: ""
|
---|
19 | mount -n -t tmpfs -o mode=0755 udev /dev
|
---|
20 | check_status
|
---|
21 | echo -n "Copying static devices to dev: "
|
---|
22 | cp --preserve=all --recursive --remove-destination /lib/udev/devices/* /dev
|
---|
23 | check_status
|
---|
24 | chmod 1777 /dev/shm
|
---|
25 | echo "" > /sys/kernel/uevent_helper
|
---|
26 | echo -n "Starting udev daemon: "
|
---|
27 | /sbin/udevd --daemon
|
---|
28 | check_status
|
---|
29 | mkdir -p /dev/.udev/queue
|
---|
30 | echo -n "Populating dev: "
|
---|
31 | /sbin/udevtrigger
|
---|
32 | check_status
|
---|
33 | echo -n "Waiting for udev to finish: "
|
---|
34 | /sbin/udevsettle
|
---|
35 | check_status
|
---|
36 |
|
---|
37 | echo -n "Setting system clock: "
|
---|
38 | hwclock --hctosys --utc
|
---|
39 | check_status
|
---|
40 |
|
---|
41 | echo "Starting fsck for root filesystem."
|
---|
42 | fsck -T -C /
|
---|
43 | if [ "$?" -gt 2 ]; then
|
---|
44 | echo "WARNING: Errors found while checking root filesystem."
|
---|
45 | echo "You can login as root now, the system will reboot after logout."
|
---|
46 | sulogin
|
---|
47 | reboot
|
---|
48 | elif [ "$?" = "2" ]; then
|
---|
49 | echo "NOTICE: System needs to be rebooted now."
|
---|
50 | sleep 1
|
---|
51 | reboot
|
---|
52 | else
|
---|
53 | echo -n "Checking root filesystem: "
|
---|
54 | check_status
|
---|
55 | fi
|
---|
56 |
|
---|
57 | echo -n "Remounting root rw: "
|
---|
58 | mount -o remount,rw /
|
---|
59 | check_status
|
---|
60 |
|
---|
61 | echo -n "Mounting devpts: "
|
---|
62 | mount /dev/pts
|
---|
63 | check_status
|
---|
64 |
|
---|
65 | echo "Starting fsck for local filesystems."
|
---|
66 | fsck -A -C -R -T -t nonfs,nosmbfs
|
---|
67 | if [ "$?" -gt 2 ]; then
|
---|
68 | echo "WARNING: Errors found while checking filesystems."
|
---|
69 | echo "You can login as root now, the system will reboot after logout."
|
---|
70 | sulogin
|
---|
71 | reboot
|
---|
72 | elif [ "$?" = "2" ]; then
|
---|
73 | echo "NOTICE: System needs to be rebooted now."
|
---|
74 | sleep 1
|
---|
75 | reboot
|
---|
76 | else
|
---|
77 | echo -n "Checking local filesystems: "
|
---|
78 | check_status
|
---|
79 | fi
|
---|
80 |
|
---|
81 | echo -n "Enabling swap space: "
|
---|
82 | swapon -a
|
---|
83 | check_status
|
---|
84 |
|
---|
85 | echo -n "Setting hostname: "
|
---|
86 | hostname -F /etc/HOSTNAME
|
---|
87 | check_status
|
---|
88 |
|
---|
89 | echo -n "Cleaning up system: "
|
---|
90 | > /var/run/utmp
|
---|
91 | touch /var/log/wtmp
|
---|
92 | touch /var/log/messages
|
---|
93 | chmod 0664 /var/run/utmp
|
---|
94 | chmod 0664 /var/log/wtmp
|
---|
95 | chmod 0660 /var/log/messages
|
---|
96 | rm -rf /tmp/*
|
---|
97 | rm -f /var/run/*.pid
|
---|
98 | check_status
|
---|
99 |
|
---|
100 | echo -n "Setting up interface lo: "
|
---|
101 | ifconfig lo up 127.0.0.1
|
---|
102 | check_status
|
---|
103 |
|
---|
104 | echo "Running local start scripts."
|
---|
105 |
|
---|
106 | for i in /etc/rc.d/start/*
|
---|
107 | do
|
---|
108 | if [ -x $i ]; then
|
---|
109 | $i start
|
---|
110 | fi
|
---|
111 | done
|
---|