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

Fixed rcS. Now mouse and keyboard will work. I commented out tazbox boot for since we would only get openbox and nothing else.
author Christopher Rogers <slaxemulator@gmail.com>
date Sat Apr 30 21:10:06 2011 +0000 (2011-04-30)
parents 2690856778e6
children a0f7424e5486
line source
1 #!/bin/sh
2 # /etc/init.d/rcS - Initial boot script for SliTaz GNU/Linux.
3 # Config file is : /etc/rcS.conf
4 #
5 # rcS is the main initialization script used to check fs, mount, clean,
6 # run scripts and start daemons.
7 #
8 . /etc/init.d/rc.functions
9 . /etc/rcS.conf
11 # Boot time.
12 bootdate=`date +%s`
14 if [ "$1" != "logged" ]; then # logged
16 # Graphical boot start.
17 if [ "$FBSPLASH" == "yes" ]; then
18 reset && fbsplash -c \
19 -s /etc/fbsplash/$FBSPLASH_THEME/fbsplash.ppm \
20 -i /etc/fbsplash/$FBSPLASH_THEME/fbsplash.cfg \
21 -f /etc/fbsplash/fifo &
22 echo "0" > /etc/fbsplash/fifo && sleep 1
23 fi
25 echo "Processing /etc/init.d/rcS..."
27 # Mount /proc.
28 echo -n "Mounting proc filesystem..."
29 /bin/mount proc
30 status
32 # Set time zone now to get system events at local time
33 if [ -s /etc/TZ ]; then
34 export TZ=$(cat /etc/TZ)
35 fi
37 [ "$FBSPLASH" == "yes" ] && echo "10" > /etc/fbsplash/fifo
39 # Parse cmdline args for earlier boot options. All other boot options
40 # are in /etc/init./bootopts.sh.
41 echo "Checking for early boot options..."
42 for opt in `cat /proc/cmdline`
43 do
44 case $opt in
45 cdrom=*)
46 export CDROM=${opt#cdrom=} ;;
47 modprobe=*)
48 export MODPROBE="yes" ;;
49 config=*)
50 export CONFIG=${opt#config=} ;;
51 xarg=*)
52 export XARG="$XARG ${opt#xarg=}" ;;
53 screen=*)
54 export SCREEN=${opt#screen=} ;;
55 autologin)
56 # Autologin option to skip first graphic login prompt.
57 if [ ! $(grep -l '^auto_login yes' /etc/slim.conf) ]; then
58 echo "auto_login yes" >> /etc/slim.conf
59 fi ;;
60 lang=*)
61 # Check for a specified locale (lang=*).
62 LANG=${opt#lang=}
63 echo -n "Setting system locale to: $LANG... "
64 tazlocale init $LANG
65 status ;;
66 kmap=*)
67 # Check for a specified keymap (kmap=*).
68 KEYMAP=${opt#kmap=}
69 echo -n "Setting system keymap to: $KEYMAP..."
70 tazkeymap init $KEYMAP
71 status ;;
72 *)
73 continue ;;
74 esac
75 done
77 [ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo
79 # Before mounting filesystems we check fs specified in the file
80 # /etc/rcS.conf and variable $CHECK_FS.
81 if [ -n "$CHECK_FS" ]; then
82 mount -o remount,ro /
83 for i in $CHECK_FS
84 do
85 echo "Checking filesystem on : $i"
86 /sbin/e2fsck -p $i
87 done
88 fi
90 # Remount rootfs rw.
91 echo "Remounting rootfs read/write..."
92 /bin/mount -o remount,rw /
94 # Trigger Udev and handle hotplug events
95 if [ "$UDEV" = "yes" ]; then
96 echo -n "Starting udev daemon..."
97 /sbin/udevd --daemon
98 status
99 echo -n "Udevadm requesting events from the Kernel..."
100 udevadm trigger
101 status
102 echo -n "Udevadm waiting for the event queue to finish..."
103 udevadm settle
104 status
105 echo -n "Using Udev for hotplugging..."
106 echo "/sbin/udevd" > /proc/sys/kernel/hotplug
107 status
108 fi
110 [ "$FBSPLASH" == "yes" ] && echo "30" > /etc/fbsplash/fifo
112 # Mount filesystems in /etc/fstab.
113 echo "Mounting filesystems in fstab..."
114 /bin/mount -a
116 # Store boot messages to log files.
117 /bin/dmesg > /var/log/dmesg.log &
118 conspy -d | sed 's/ *$//;/^$/d;/^Processi\|^.witchi/,$!d' > /var/log/boot.log
119 script -a -q -c '/etc/init.d/rcS logged' /var/log/boot.log
121 else # logged
123 # Clean up the system.
124 if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then
125 echo -n "Cleaning up the system..."
126 find /var/run -name "*.pid" -type f | xargs /bin/rm -f
127 /bin/rm -rf /tmp /var/run/dbus/* /var/run/hald/pid /var/lock/*
128 /bin/mkdir -p /tmp && /bin/chmod 1777 /tmp
129 status
130 else
131 echo "System clean up is disabled in /etc/rcS.conf..."
132 echo -n "Keeping all tmp and pid files..."
133 status
134 fi
136 [ "$FBSPLASH" == "yes" ] && echo "40" > /etc/fbsplash/fifo
138 # Set up tmp X11 and ICE dir.
139 echo -n "Setting up tmp X11 and ICE unix dir..."
140 /bin/mkdir -p /tmp/.X11-unix /tmp/.ICE-unix
141 /bin/chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix
142 status
144 # Create /dev/cdrom if needed (symlink does not exist on LiveCD).
145 # Also add /dev/cdrom to fstab if entry does not exist.
146 if [ -n "$CDROM" ]; then
147 DRIVE_NAME=${CDROM#/dev/}
148 else
149 DRIVE_NAME=$(grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3)
150 fi
151 if [ -n "$DRIVE_NAME" -a ! "`readlink /dev/cdrom`" ]; then
152 echo -n "Creating symlink : /dev/cdrom..."
153 ln -s /dev/$DRIVE_NAME /dev/cdrom
154 ln -s /dev/$DRIVE_NAME /dev/dvd
155 status
156 fi
157 if ! grep -q "/dev/cdrom" /etc/fstab; then
158 echo -n "Adding /dev/cdrom to fstab..."
159 echo '/dev/cdrom /media/cdrom iso9660 user,ro,noauto 0 0' \
160 >> /etc/fstab
161 status
162 fi
164 [ "$FBSPLASH" == "yes" ] && echo "50" > /etc/fbsplash/fifo
166 # Chmod hack on each boot for Asunder and burnbox. Allowing all users
167 # to burn/rip CD/DVD.
168 if [ -n "$DRIVE_NAME" -a "`readlink /dev/cdrom`" ]; then
169 echo -n "Chmoding cdrom device..."
170 chmod 0666 /dev/cdrom
171 chmod 0666 /dev/dvd
172 chmod 0666 /dev/$DRIVE_NAME
173 status
174 fi
176 # Handle kernel cmdline parameter modprobe=<module_list>
177 if [ -n "$MODPROBE" ]; then
178 MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
179 for i in $MODULES; do
180 echo -n "Loading kernel module $i"
181 /sbin/modprobe $i
182 status
183 done
184 fi
186 [ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo
188 # Handle kernel cmdline parameter config=<device>,<path> to source a
189 # disk init script
190 if [ -n "$CONFIG" ]; then
191 DEVICE=${CONFIG%,*}
192 SCRIPT=${CONFIG#*,}
193 echo "Probing $DEVICE... "
194 if ! /bin/mount -r $DEVICE /mnt; then
195 if echo $DEVICE | grep -Eq "/dev/sd|UUID=|LABEL="; then
196 USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
197 USBDELAY=$((1+$USBDELAY))
198 echo "$DEVICE is potentially a USB device: sleep for $USBDELAY seconds"
199 sleep $USBDELAY
200 fi
201 if ! /bin/mount -r $DEVICE /mnt; then
202 CONFIG=""
203 fi
204 fi
205 echo -n "Source $SCRIPT from $DEVICE..."
206 if [ -n "$CONFIG" ]; then
207 . /mnt/$SCRIPT
208 /bin/umount /mnt 2> /dev/null || true
209 fi
210 status
211 fi
213 # Mount /proc/bus/usb.
214 if [ -d /proc/bus/usb ]; then
215 echo -n "Mounting /proc/bus/usb filesystem..."
216 /bin/mount -t usbfs usbfs /proc/bus/usb
217 status
218 fi
220 # Start syslogd and klogd.
221 if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then
222 echo -n "Starting system log deamon: syslogd..."
223 /sbin/syslogd -s $SYSLOGD_ROTATED_SIZE && status
224 echo -n "Starting kernel log daemon: klogd..."
225 /sbin/klogd && status
226 else
227 echo "Kernel log daemons are disabled in /etc/rc.conf..."
228 fi
230 [ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo
232 # Load all modules listed in config file.
233 if [ -n "$LOAD_MODULES" ]; then
234 for mod in $LOAD_MODULES
235 do
236 modprobe $mod
237 done
238 fi
240 # Be quiet on configuration to avoid messages overwriting ncurses dialog
241 echo "0 0 0 0" > /proc/sys/kernel/printk
243 # Detect PCI and USB devices with Tazhw from slitaz-tools. We load
244 # kernel modules only at first boot or in LiveCD mode.
245 if [ ! -s /var/lib/detected-modules ]; then
246 /sbin/tazhw init
247 fi
249 if [ "$UDEV" = "yes" ]; then
250 echo -n "Udevadm requesting events from the Kernel..."
251 udevadm trigger
252 status
253 fi
255 # Start DBUS and HAL deamon so we can use Xorg and a WM to configure
256 # system locale and keybord on first boot.
257 [ -x /etc/init.d/dbus ] && /etc/init.d/dbus start
258 [ -x /etc/init.d/hald ] && /etc/init.d/hald start
260 [ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo
262 # Set the console keymap and configure i18n in case of screen=text and
263 # no locale.conf or keymap.conf. Add default user for live mode and
264 # mount an eventual /home partition.
265 /etc/init.d/i18n.sh
266 /etc/init.d/user-home.sh
268 # Requested screen is not text mode and keymap.conf is empty so go
269 # for an i18n configuration in GUI mode. In cas of screen=text we
270 # configure locale and keymap just after via i18n.sh
271 #if [ "$SCREEN" != "text" -a ! -s "/etc/keymap.conf" -a -x /usr/bin/Xorg ]; then
272 # DISPLAY=:1 tazbox boot
273 #fi
275 [ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo
277 # Now that we have a keymap configuration we can auto configure Xorg.
278 # We need to set $HOME.
279 if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
280 echo "Configuring Xorg..."
281 HOME=/root
282 tazx config-xorg
283 fi
285 # Here we finish bootsplash since we start Xorg session.
286 [ "$FBSPLASH" == "yes" ] && sleep 1 && echo "exit" > /etc/fbsplash/fifo
288 # No text mode requested, we have i18n and Xorg settings as well as a
289 # user, so start a desktop and let boot process finih in backgroud.
290 if [ "$SCREEN" != "text" -a -x /etc/init.d/slim ]; then
291 /etc/init.d/slim start
292 fi
294 # Auto recharge packages list (after network connection of course)
295 [ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge &
297 # Start all scripts specified with $RUN_SCRIPTS.
298 echo "Executing all initialization scripts..."
299 for script in $RUN_SCRIPTS
300 do
301 if [ -x /etc/init.d/$script ]; then
302 /etc/init.d/$script
303 fi
304 done
306 # Start all daemons specified with $RUN_DAEMONS.
307 echo "Starting all daemons specified in /etc/rcS.conf..."
308 for daemon in $RUN_DAEMONS
309 do
310 if [ -x /etc/init.d/$daemon ]; then
311 /etc/init.d/$daemon start
312 fi
313 done
315 # Back to a verbose mode.
316 echo "7 4 1 7" > /proc/sys/kernel/printk
318 # Reset screen and display a bold message.
319 if [ -n "$MESSAGE" ]; then
320 /usr/bin/reset
321 echo -e "\033[1m$MESSAGE\033[0m"
322 fi
324 # Display and log boot time.
325 time=$((`date +%s` - $bootdate))
326 echo $time > /var/log/boot-time
327 echo "SliTaz boot time: ${time}s"
329 fi # logged