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 /tmp /tmp
|
---|
10 | /bin/mkdir /dev/pts
|
---|
11 | /bin/mkdir /dev/shm
|
---|
12 |
|
---|
13 | /bin/echo "/sbin/mdev" > /proc/sys/kernel/hotplug
|
---|
14 |
|
---|
15 | echo -n "Starting mdev: "
|
---|
16 | /sbin/mdev -s
|
---|
17 | check_status
|
---|
18 |
|
---|
19 | echo -n "Mounting devpts: "
|
---|
20 | /bin/mount -t devpts none /dev/pts
|
---|
21 | check_status
|
---|
22 |
|
---|
23 | echo -n "Mounting shared memory: "
|
---|
24 | /bin/mount -t tmpfs none /dev/shm
|
---|
25 | check_status
|
---|
26 |
|
---|
27 | if [ -x /sbin/hwclock ] && [ -e /dev/rtc0 ]; then
|
---|
28 | echo -n "Setting system clock: "
|
---|
29 | hwclock --hctosys --utc
|
---|
30 | check_status
|
---|
31 | fi
|
---|
32 |
|
---|
33 | if [ -x /sbin/fsck ]; then
|
---|
34 | echo "Starting fsck for local filesystems."
|
---|
35 | fsck -A -C -R -T -t nonfs,nosmbfs
|
---|
36 | if [ "$?" -gt 2 ]; then
|
---|
37 | echo "WARNING: Errors found while checking filesystems."
|
---|
38 | echo "You can login as root now, the system will reboot after logout."
|
---|
39 | sulogin
|
---|
40 | reboot
|
---|
41 | elif [ "$?" = "2" ]; then
|
---|
42 | echo "NOTICE: System needs to be rebooted now."
|
---|
43 | sleep 1
|
---|
44 | reboot
|
---|
45 | else
|
---|
46 | echo -n "Checking local filesystems: "
|
---|
47 | check_status
|
---|
48 | fi
|
---|
49 | fi
|
---|
50 |
|
---|
51 |
|
---|
52 | if [ -x /sbin/swapon ]; then
|
---|
53 | echo -n "Enabling swap space: "
|
---|
54 | swapon -a
|
---|
55 | check_status
|
---|
56 | fi
|
---|
57 |
|
---|
58 | echo -n "Remounting root rw: "
|
---|
59 | mount -o remount,rw /
|
---|
60 | check_status
|
---|
61 |
|
---|
62 | echo -n "Linking /var/tmp and /tmp: "
|
---|
63 | ln -s ../tmp /var/tmp
|
---|
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
|
---|
93 |
|
---|
94 | exit 0
|
---|