slitaz-boot-scripts view etc/init.d/rcS @ rev 70

network.sh: typo
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Apr 21 10:17:44 2008 +0000 (2008-04-21)
parents 31837608fcdf
children 066907ea77fe
line source
1 #!/bin/sh
2 # /etc/init.d/rcS - Initial boot script for SliTaz GNU/Linux. rcS is the main
3 # initialisation script used to check fs, mount, clean, run scripts and start
4 # daemons.
5 #
6 # Config file is : /etc/rcS.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/rcS.conf
11 if [ "$1" != "logged" ]; then #logged
13 # Start by sleeping a bit.
14 echo "Processing /etc/init.d/rcS... "
15 sleep 1
17 # Mount /proc.
18 echo -n "Mounting proc filesystem... "
19 /bin/mount proc
20 status && sleep 1
22 # Before mounting filesystems we check fs specified in the file
23 # /etc/rcS.conf and variable $CHECK_FS.
24 if [ ! "$CHECK_FS" = "" ]; then
25 mount -o remount,ro /
26 for i in $CHECK_FS
27 do
28 echo "Checking filesystem on : $i"
29 /sbin/e2fsck -p $i
30 sleep 2
31 done
32 fi
34 # Remount rootfs rw.
35 echo "Remounting rootfs read/write... "
36 /bin/mount -o remount,rw /
38 # Mount all stuff from /etc/fstab.
39 echo "Mounting all staff from fstab... "
40 /bin/mount -a
42 # Start Udev to populate /dev and handle hotplug events
43 if [ "$UDEV" = "yes" ]; then
44 echo -n "Starting udev daemon..."
45 /sbin/udevd --daemon
46 status
47 echo "/sbin/udevd" > /proc/sys/kernel/hotplug
48 fi
50 /bin/dmesg > /var/log/dmesg.log
51 vcsa2txt < /dev/vcsa1 | awk 'BEGIN {s=0} /^Processing/ {s=1} { if (s) print }' >/var/log/boot.log
52 script -a -q -c '/etc/init.d/rcS logged' /var/log/boot.log
54 else #logged
56 # Creat /dev/cdrom if needed (symlink does not exist on LiveCD).
57 # Add also /dev/cdrom to fstab if entry dos not exist.
58 #
59 DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3`
60 if [ -n "$DRIVE_NAME" -a ! "`readlink /dev/cdrom`" ]; then
61 echo -n "Creating symlink : /dev/cdrom..."
62 ln -s /dev/$DRIVE_NAME /dev/cdrom
63 ln -s /dev/$DRIVE_NAME /dev/dvd
64 status
65 fi
66 if ! grep -q "/dev/cdrom" /etc/fstab; then
67 echo -n "Adding /dev/cdrom to fstab..."
68 echo '/dev/cdrom /media/cdrom iso9660 user,ro,noauto 0 0' \
69 >> /etc/fstab
70 status
71 fi
72 # Chmod hack on each boot for Asunder and burnbox. Allowing all users
73 # to burn/rip CD/DVD.
74 if [ -n "$DRIVE_NAME" -a "`readlink /dev/cdrom`" ]; then
75 echo -n "Chmoding cdrom device..."
76 chmod 0666 /dev/cdrom
77 chmod 0666 /dev/dvd
78 chmod 0666 /dev/$DRIVE_NAME
79 status
80 fi
82 # Handle kernel cmdline parameter modprobe=<module_list>
83 if grep -q " modprobe=" /proc/cmdline; then
84 MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
85 for i in $MODULES; do
86 echo -n "Loading kernel module $i"
87 /sbin/modprobe $i
88 status
89 done
90 fi
92 # Handle kernel cmdline parameter config=<device>,<path> to source a
93 # disk init script
94 if grep -q " config=" /proc/cmdline; then
95 CONFIG=`cat /proc/cmdline | sed 's/.* config=\([^ ]*\).*/\1/'`
96 DEVICE=${CONFIG%,*}
97 SCRIPT=${CONFIG#*,}
98 echo -n "Source $SCRIPT from $DEVICE... "
99 if /bin/mount -r $DEVICE /mnt; then
100 . /mnt/$SCRIPT
101 /bin/umount /mnt
102 fi
103 status
104 fi
106 # Eject option
107 if grep -q -w "eject" /proc/cmdline; then
108 eject /dev/cdrom
109 fi
111 # Start syslogd and klogd.
112 if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then
113 echo -n "Starting system log deamon: syslogd... "
114 /sbin/syslogd -s $SYSLOGD_ROTATED_SIZE && status
115 echo -n "Starting kernel log daemon: klogd... "
116 /sbin/klogd && status
117 else
118 echo "Kernel log daemons are disabled in /etc/rc.conf... "
119 fi
121 # Clean up the system.
122 if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then
123 echo -n "Cleaning up the system... "
124 rm -rf /tmp/*
125 rm -f /var/run/*.pid
126 rm -f /var/lock/*
127 status
128 else
129 echo "System clean up is disabled in /etc/rcS.conf... "
130 echo "Keeping all tmp and pid files... "
131 status
132 fi
134 # Set up tmp X11 and ICE dir.
135 echo -n "Setting up tmp X11 and ICE unix dir... "
136 /bin/mkdir -p /tmp/.X11-unix
137 /bin/mkdir -p /tmp/.ICE-unix
138 /bin/chmod 1777 /tmp/.X11-unix
139 /bin/chmod 1777 /tmp/.ICE-unix
140 status
142 # Load all modules listed in config file.
143 if [ ! "$LOAD_MODULES" = "" ]; then
144 for mod in $LOAD_MODULES
145 do
146 modprobe $mod
147 done
148 fi
150 # Start all scripts specified with $RUN_SCRIPTS.
151 echo "Executing all initialisation scripts..."
152 for script in $RUN_SCRIPTS
153 do
154 if [ -x /etc/init.d/$script ]; then
155 /etc/init.d/$script
156 fi
157 done
159 # Re-source main config file, in Live mode daemons list ca be modified
160 # by boot options.
161 . /etc/rcS.conf
163 # Start all daemons specified with $RUN_DAEMONS.
164 echo "Starting all daemons specified in /etc/rcS.conf..."
165 for daemon in $RUN_DAEMONS
166 do
167 if [ -x /etc/init.d/$daemon ]; then
168 /etc/init.d/$daemon start
169 fi
170 done
172 # Reset screen and display a bold message.
173 if [ -n "$MESSAGE" ]; then
174 /usr/bin/reset
175 echo -e "\033[1m$MESSAGE\033[0m"
176 fi
178 fi #logged