slitaz-boot-scripts diff etc/init.d/rcS @ rev 254

Huge change in boot... we start X as soon as possible by default, for this we have to config keymap, locale, user and home before, let do that in rcS. Also some fixes such as TZ
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 29 16:06:08 2011 +0200 (2011-04-29)
parents 9fdf071862a6
children c76406c5b7c5
line diff
     1.1 --- a/etc/init.d/rcS	Wed Apr 06 05:00:51 2011 +0200
     1.2 +++ b/etc/init.d/rcS	Fri Apr 29 16:06:08 2011 +0200
     1.3 @@ -29,29 +29,54 @@
     1.4  /bin/mount proc
     1.5  status
     1.6  
     1.7 -[ "$FBSPLASH" == "yes" ] && echo "10" > /etc/fbsplash/fifo
     1.8 +# Set time zone now to get system events at local time
     1.9 +if [ -s /etc/TZ ]; then
    1.10 +	export TZ=$(cat /etc/TZ)
    1.11 +fi
    1.12 +
    1.13 +[ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo
    1.14  
    1.15  # Parse cmdline args for earlier boot options. All other boot options
    1.16  # are in /etc/init./bootopts.sh.
    1.17 -echo -n "Searching for early boot options..."
    1.18 +echo "Checking for early boot options..."
    1.19  for opt in `cat /proc/cmdline`
    1.20  do
    1.21  	case $opt in
    1.22 -		fastbootx|fbx)
    1.23 -			export FAST_BOOT_X="yes" ;;
    1.24  		cdrom=*)
    1.25  			export CDROM=${opt#cdrom=} ;;
    1.26  		modprobe=*)
    1.27  			export MODPROBE="yes" ;;
    1.28  		config=*)
    1.29  			export CONFIG=${opt#config=} ;;
    1.30 +		xarg=*)
    1.31 +			XARG="$XARG ${opt#xarg=}" ;;
    1.32 +		screen=text)
    1.33 +			echo -n "Text mode option detected..."
    1.34 +			SCREEN=text
    1.35 +			status ;;
    1.36 +		screen=[0-9]*)
    1.37 +			SCREEN=${opt#screen=} ;;
    1.38 +		autologin)
    1.39 +			# Autologin option to skip first graphic login prompt.
    1.40 +			echo "auto_login        yes" >> /etc/slim.conf ;;
    1.41 +		lang=*)
    1.42 +			# Check for a specified locale (lang=*).
    1.43 +			LANG=${opt#lang=}
    1.44 +			echo -n "Setting system locale to: $LANG... "
    1.45 +			tazlocale init $LANG
    1.46 +			status ;;
    1.47 +		kmap=*)
    1.48 +			# Check for a specified keymap (kmap=*).
    1.49 +			KEYMAP=${opt#kmap=}
    1.50 +			echo -n "Setting system keymap to: $KEYMAP..."
    1.51 +			tazkeymap init $KEYMAP
    1.52 +			status ;;
    1.53  		*)
    1.54  			continue ;;
    1.55  	esac
    1.56  done
    1.57 -status
    1.58  
    1.59 -[ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo
    1.60 +[ "$FBSPLASH" == "yes" ] && echo "40" > /etc/fbsplash/fifo
    1.61  
    1.62  # Before mounting filesystems we check fs specified in the file
    1.63  # /etc/rcS.conf and variable $CHECK_FS.
    1.64 @@ -73,9 +98,6 @@
    1.65  	echo -n "Starting udev daemon..."
    1.66  	/sbin/udevd --daemon
    1.67  	status
    1.68 -	echo -n "Udevadm requesting events from the Kernel..."
    1.69 -	udevadm trigger
    1.70 -	status
    1.71  	echo -n "Udevadm waiting for the event queue to finish..."
    1.72  	udevadm settle
    1.73  	status
    1.74 @@ -84,7 +106,7 @@
    1.75  	status
    1.76  fi
    1.77  
    1.78 -[ "$FBSPLASH" == "yes" ] && echo "30" > /etc/fbsplash/fifo
    1.79 +[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo
    1.80  
    1.81  # Mount filesystems in /etc/fstab.
    1.82  echo "Mounting filesystems in fstab..."
    1.83 @@ -110,7 +132,7 @@
    1.84  	status
    1.85  fi
    1.86  
    1.87 -[ "$FBSPLASH" == "yes" ] && echo "40" > /etc/fbsplash/fifo
    1.88 +[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo
    1.89  
    1.90  # Set up tmp X11 and ICE dir.
    1.91  echo -n "Setting up tmp X11 and ICE unix dir..."
    1.92 @@ -118,15 +140,43 @@
    1.93  /bin/chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix
    1.94  status
    1.95  
    1.96 -# Fast boot into X for HD install or custom Live system. We need
    1.97 -# keymap settings since Xvesa dumps the console mapping and a correct
    1.98 -# slim configuration for screen resolution. DBUS and HAL must also start
    1.99 -# before X session (manual login or autologin) to have devices in PCmanFM.
   1.100 -if [ "$FAST_BOOT_X" = "yes" ]; then
   1.101 -	/etc/init.d/i18n.sh
   1.102 -	/etc/init.d/dbus start
   1.103 -	/etc/init.d/hald start
   1.104 -	/etc/init.d/slim start &
   1.105 +# Start DBUS and HAL deamon so we can use Xorg and a WM to configure
   1.106 +# system locale and keybord on first boot.
   1.107 +[ -x /etc/init.d/dbus ] && /etc/init.d/dbus start
   1.108 +[ -x /etc/init.d/hald ] && /etc/init.d/hald start
   1.109 +
   1.110 +# Requested screen is not text mode and keymap.conf is empty so go
   1.111 +# for an i18n configuration in GUI mode. In cas of screen=text we
   1.112 +# configure locale and keymap just after via i18n.sh
   1.113 +if [ "$SCREEN" != "text" -a ! -s "/etc/locale.conf" -a -x /usr/bin/Xorg ]; then
   1.114 +	tazbox boot
   1.115 +fi
   1.116 +
   1.117 +[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo
   1.118 +
   1.119 +# Set the console keymap and configure i18n in case of screen=text and
   1.120 +# no locale.conf or keymap.conf. Add default user for live mode and
   1.121 +# mount an eventual /home partition.
   1.122 +/etc/init.d/i18n.sh
   1.123 +/etc/init.d/user-home.sh
   1.124 +
   1.125 +[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo
   1.126 +
   1.127 +# Now that we have a keymap configuration we can auto configure Xorg.
   1.128 +# We need to set $HOME.
   1.129 +if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
   1.130 +	echo "Configuring Xorg..."
   1.131 +	HOME=/root
   1.132 +	tazx config-xorg
   1.133 +fi
   1.134 +
   1.135 +# Here we finish bootsplash since we start Xorg session.
   1.136 +[ "$FBSPLASH" == "yes" ] && sleep 1 && echo "exit" > /etc/fbsplash/fifo
   1.137 +
   1.138 +# No text mode requested, we have i18n and Xorg settings as well as a 
   1.139 +# user, so start a desktop and let boot process finih in backgroud.
   1.140 +if [ "$screen" != "text" -a -x /etc/init.d/slim ]; then
   1.141 +	/etc/init.d/slim start
   1.142  fi
   1.143  
   1.144  # Create /dev/cdrom if needed (symlink does not exist on LiveCD).
   1.145 @@ -134,7 +184,7 @@
   1.146  if [ -n "$CDROM" ]; then
   1.147  	DRIVE_NAME=${CDROM#/dev/}
   1.148  else
   1.149 -	DRIVE_NAME=`grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3`
   1.150 +	DRIVE_NAME=$(grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3)
   1.151  fi
   1.152  if [ -n "$DRIVE_NAME" -a ! "`readlink /dev/cdrom`" ]; then
   1.153  	echo -n "Creating symlink : /dev/cdrom..."
   1.154 @@ -148,6 +198,7 @@
   1.155  		>> /etc/fstab
   1.156  	status
   1.157  fi
   1.158 +
   1.159  # Chmod hack on each boot for Asunder and burnbox. Allowing all users
   1.160  # to burn/rip CD/DVD.
   1.161  if [ -n "$DRIVE_NAME" -a "`readlink /dev/cdrom`" ]; then
   1.162 @@ -158,8 +209,6 @@
   1.163  	status
   1.164  fi
   1.165  
   1.166 -[ "$FBSPLASH" == "yes" ] && echo "50" > /etc/fbsplash/fifo
   1.167 -
   1.168  # Handle kernel cmdline parameter modprobe=<module_list>
   1.169  if [ -n "$MODPROBE" ]; then
   1.170  	MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
   1.171 @@ -202,8 +251,6 @@
   1.172  	status
   1.173  fi
   1.174  
   1.175 -[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo
   1.176 -
   1.177  # Start syslogd and klogd.
   1.178  if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then
   1.179  	echo -n "Starting system log deamon: syslogd..."
   1.180 @@ -225,23 +272,14 @@
   1.181  # Be quiet on configuration to avoid messages overwriting ncurses dialog
   1.182  echo "0 0 0 0" > /proc/sys/kernel/printk
   1.183  
   1.184 -[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo
   1.185 -
   1.186  # Detect PCI and USB devices with Tazhw from slitaz-tools. We load
   1.187  # kernel modules only at first boot or in LiveCD mode.
   1.188  if [ ! -s /var/lib/detected-modules ]; then
   1.189  	/sbin/tazhw init
   1.190  fi
   1.191  
   1.192 -[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo
   1.193 -
   1.194 -# Call udevadm trigger to ensure /dev is fully populate now that all 
   1.195 -# modules are loaded.
   1.196 -if [ "$UDEV" = "yes" ]; then
   1.197 -	echo -n "Requesting events from the Kernel..."
   1.198 -	udevadm trigger
   1.199 -	status
   1.200 -fi
   1.201 +# Auto recharge packages list (after network connection of course)
   1.202 +[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge &
   1.203  
   1.204  # Start all scripts specified with $RUN_SCRIPTS.
   1.205  echo "Executing all initialization scripts..."
   1.206 @@ -252,15 +290,6 @@
   1.207  	fi
   1.208  done
   1.209  
   1.210 -[ "$FBSPLASH" == "yes" ] && echo "90" > /etc/fbsplash/fifo
   1.211 -
   1.212 -# Re-source main config file. In Live mode, daemons list can be modified
   1.213 -# by boot options (screen=text will remove slim).
   1.214 -. /etc/rcS.conf
   1.215 -
   1.216 -# Auto recharge packages list (after network connection of course)
   1.217 -[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge &
   1.218 -
   1.219  # Start all daemons specified with $RUN_DAEMONS.
   1.220  echo "Starting all daemons specified in /etc/rcS.conf..."
   1.221  for daemon in $RUN_DAEMONS
   1.222 @@ -270,8 +299,6 @@
   1.223  	fi
   1.224  done
   1.225  
   1.226 -[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo
   1.227 -
   1.228  # Back to a verbose mode.
   1.229  echo "7 4 1 7" > /proc/sys/kernel/printk
   1.230  
   1.231 @@ -285,6 +312,5 @@
   1.232  time=$((`date +%s` - $bootdate))
   1.233  echo $time > /var/log/boot-time
   1.234  echo "SliTaz boot time: ${time}s"
   1.235 -[ "$FBSPLASH" == "yes" ] && echo "exit" > /etc/fbsplash/fifo
   1.236  
   1.237  fi # logged