slitaz-boot-scripts diff etc/init.d/rcS @ rev 153
Improve and tidy scripts, start tazhw from rcS and start network.sh earlier
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Apr 21 01:46:21 2009 +0200 (2009-04-21) |
parents | 979868f40866 |
children | 1392ada2e985 |
line diff
1.1 --- a/etc/init.d/rcS Mon Mar 09 20:04:05 2009 +0000 1.2 +++ b/etc/init.d/rcS Tue Apr 21 01:46:21 2009 +0200 1.3 @@ -1,14 +1,14 @@ 1.4 #!/bin/sh 1.5 -# /etc/init.d/rcS - Initial boot script for SliTaz GNU/Linux. rcS is the main 1.6 -# initialization script used to check fs, mount, clean, run scripts and start 1.7 -# daemons. 1.8 +# /etc/init.d/rcS - Initial boot script for SliTaz GNU/Linux. 1.9 +# Config file is : /etc/rcS.conf 1.10 # 1.11 -# Config file is : /etc/rcS.conf 1.12 +# rcS is the main initialization script used to check fs, mount, clean, 1.13 +# run scripts and start daemons. 1.14 # 1.15 . /etc/init.d/rc.functions 1.16 . /etc/rcS.conf 1.17 1.18 -if [ "$1" != "logged" ]; then #logged 1.19 +if [ "$1" != "logged" ]; then # logged 1.20 1.21 echo "Processing /etc/init.d/rcS... " 1.22 1.23 @@ -17,9 +17,23 @@ 1.24 /bin/mount proc 1.25 status 1.26 1.27 +# Start Udev to populate /dev and handle hotplug events 1.28 +if [ "$UDEV" = "yes" ]; then 1.29 + echo -n "Starting udev daemon..." 1.30 + /sbin/udevd --daemon 1.31 + status 1.32 + echo -n "Udevadm requesting events from the Kernel..." 1.33 + udevadm trigger 1.34 + status 1.35 + echo -n "Udevadm waiting for the event queue to finish..." 1.36 + udevadm settle 1.37 + status 1.38 + echo "/sbin/udevd" > /proc/sys/kernel/hotplug 1.39 +fi 1.40 + 1.41 # Before mounting filesystems we check fs specified in the file 1.42 # /etc/rcS.conf and variable $CHECK_FS. 1.43 -if [ ! "$CHECK_FS" = "" ]; then 1.44 +if [ -n "$CHECK_FS" ]; then 1.45 mount -o remount,ro / 1.46 for i in $CHECK_FS 1.47 do 1.48 @@ -36,29 +50,14 @@ 1.49 echo "Mounting filesystems in fstab... " 1.50 /bin/mount -a 1.51 1.52 -# Start Udev to populate /dev and handle hotplug events 1.53 -if [ "$UDEV" = "yes" ]; then 1.54 - echo -n "Starting udev daemon..." 1.55 - /sbin/udevd --daemon 1.56 - status 1.57 - echo -n "Udevadm requesting events from the Kernel..." 1.58 - udevadm trigger 1.59 - status 1.60 - echo -n "Udevadm waiting for the event queue to finish..." 1.61 - udevadm settle 1.62 - status 1.63 - echo "/sbin/udevd" > /proc/sys/kernel/hotplug 1.64 -fi 1.65 - 1.66 /bin/dmesg > /var/log/dmesg.log 1.67 vcsa2txt < /dev/vcsa1 | awk 'BEGIN {s=0} /^Processing|^.witching/ {s=1} { if (s) print }' >/var/log/boot.log 1.68 script -a -q -c '/etc/init.d/rcS logged' /var/log/boot.log 1.69 1.70 -else #logged 1.71 +else # logged 1.72 1.73 # Create /dev/cdrom if needed (symlink does not exist on LiveCD). 1.74 # Also add /dev/cdrom to fstab if entry does not exist. 1.75 -# 1.76 DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3` 1.77 if grep -q " cdrom=" /proc/cmdline; then 1.78 DRIVE_NAME=`cat /proc/cmdline | sed 's/.* cdrom=\([^ ]*\).*/\1/'` 1.79 @@ -121,11 +120,6 @@ 1.80 status 1.81 fi 1.82 1.83 -# Eject option 1.84 -if grep -q -w "eject" /proc/cmdline; then 1.85 - eject /dev/cdrom 1.86 -fi 1.87 - 1.88 # Mount /proc/bus/usb. 1.89 if [ -d /proc/bus/usb ]; then 1.90 echo -n "Mounting /proc/bus/usb filesystem... " 1.91 @@ -146,26 +140,24 @@ 1.92 # Clean up the system. 1.93 if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then 1.94 echo -n "Cleaning up the system... " 1.95 - rm -rf /tmp/* /tmp/.* 2> /dev/null 1.96 - rm -f /var/run/*.pid /var/run/dbus/* /var/run/hald/pid 1.97 - rm -f /var/lock/* 1.98 + /bin/rm -rf /tmp /var/run/*.pid /var/run/dbus/* \ 1.99 + /var/run/hald/pid /var/lock/* 1.100 + /bin/mkdir -p /tmp && /bin/chmod 1777 /tmp 1.101 status 1.102 else 1.103 echo "System clean up is disabled in /etc/rcS.conf... " 1.104 - echo "Keeping all tmp and pid files... " 1.105 + echo -n "Keeping all tmp and pid files... " 1.106 status 1.107 fi 1.108 1.109 # Set up tmp X11 and ICE dir. 1.110 echo -n "Setting up tmp X11 and ICE unix dir... " 1.111 -/bin/mkdir -p /tmp/.X11-unix 1.112 -/bin/mkdir -p /tmp/.ICE-unix 1.113 -/bin/chmod 1777 /tmp/.X11-unix 1.114 -/bin/chmod 1777 /tmp/.ICE-unix 1.115 +/bin/mkdir -p /tmp/.X11-unix /tmp/.ICE-unix 1.116 +/bin/chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix 1.117 status 1.118 1.119 # Load all modules listed in config file. 1.120 -if [ ! "$LOAD_MODULES" = "" ]; then 1.121 +if [ -n "$LOAD_MODULES" ]; then 1.122 for mod in $LOAD_MODULES 1.123 do 1.124 modprobe $mod 1.125 @@ -175,6 +167,12 @@ 1.126 # Be quiet on configuration to avoid message overwriting ncurses dialog 1.127 echo "0 0 0 0" > /proc/sys/kernel/printk 1.128 1.129 +# Detect PCI and USB devices with Tazhw from slitaz-tools. We load 1.130 +# kernel module only at first boot or in LiveCD mode. 1.131 +if [ ! -s /var/lib/detected-modules ]; then 1.132 + /sbin/tazhw init 1.133 +fi 1.134 + 1.135 # Start all scripts specified with $RUN_SCRIPTS. 1.136 echo "Executing all initialization scripts..." 1.137 for script in $RUN_SCRIPTS 1.138 @@ -185,7 +183,7 @@ 1.139 done 1.140 1.141 # Re-source main config file. In Live mode, daemons list can be modified 1.142 -# by boot options. 1.143 +# by boot options (screen=text will remove slim). 1.144 . /etc/rcS.conf 1.145 1.146 # Start all daemons specified with $RUN_DAEMONS.