slitaz-boot-scripts rev 302

Huge clean, colored rcS, faster, fix sound and other devices (used need a devtmpfs mounted on /dev) disabled logging for now
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jun 01 21:46:07 2012 +0200 (2012-06-01)
parents 8c7926208f7c
children 445b09ea0b07
files applications/bootlog.desktop bin/bootlog etc/init.d/bootopts.sh etc/init.d/local.sh etc/init.d/network.sh etc/init.d/rc.shutdown etc/init.d/rcS etc/init.d/system.sh etc/rcS.conf init
line diff
     1.1 --- a/applications/bootlog.desktop	Wed May 02 17:03:41 2012 +0200
     1.2 +++ b/applications/bootlog.desktop	Fri Jun 01 21:46:07 2012 +0200
     1.3 @@ -1,8 +1,8 @@
     1.4  [Desktop Entry]
     1.5  Encoding=UTF-8
     1.6 -Name=Show Boot Log
     1.7 +Name=Boot Log Viewer
     1.8  Name[fr]=Log de démarrage
     1.9 -Exec=xterm -hold -title 'boot.log (shift-pgup/pgdn to scroll)' -e 'bootlog'
    1.10 -Icon=other.png
    1.11 +Exec=bootlog box
    1.12 +Icon=text-plain
    1.13  Type=Application
    1.14  Categories=System;
     2.1 --- a/bin/bootlog	Wed May 02 17:03:41 2012 +0200
     2.2 +++ b/bin/bootlog	Fri Jun 01 21:46:07 2012 +0200
     2.3 @@ -1,4 +1,16 @@
     2.4  #!/bin/sh
     2.5 -# tazbootlog: Display SliTaz boot log messages.
     2.6  #
     2.7 -cat /var/log/dmesg.log /var/log/boot.log | sed "s/.\[3g.*\]R//"
     2.8 +# Display SliTaz boot log messages
     2.9 +#
    2.10 +
    2.11 +catlog() {
    2.12 +	cat /var/log/dmesg.log /var/log/boot.log | sed "s/.\[3g.*\]R//"
    2.13 +}
    2.14 +
    2.15 +case "$1" in
    2.16 +	box) catlog | sed -e s'///'g -e s'/\[1;3[0-9]m//'g \
    2.17 +		-e s'/\[*.0G\[/ /'g -e s'/\[0;39m.*//'g | yad \
    2.18 +		--text-info --title="Boot Log" --window-icon=text-plain \
    2.19 +		--width=600 --height=400 --button=gtk-close:0 ;;
    2.20 +	*) catlog ;;
    2.21 +esac
     3.1 --- a/etc/init.d/bootopts.sh	Wed May 02 17:03:41 2012 +0200
     3.2 +++ b/etc/init.d/bootopts.sh	Fri Jun 01 21:46:07 2012 +0200
     3.3 @@ -1,21 +1,13 @@
     3.4  #!/bin/sh
     3.5 -# /etc/init.d/bootopts.sh - SliTaz boot options from the cmdline.
     3.6 +#
     3.7 +# /etc/init.d/bootopts.sh : SliTaz boot options from the cmdline
     3.8  #
     3.9  # Earlier boot options are in rcS, ex: config= and modprobe=
    3.10  #
    3.11  . /etc/init.d/rc.functions
    3.12  
    3.13 -# Update fstab for swapon/swapoff
    3.14 -add_swap_in_fstab()
    3.15 -{
    3.16 -	grep -q "$1	" /etc/fstab || cat >> /etc/fstab <<EOT
    3.17 -$1	swap	swap	default	0 0
    3.18 -EOT
    3.19 -}
    3.20 -
    3.21  # Get first usb disk
    3.22 -usb_device()
    3.23 -{
    3.24 +usb_device() {
    3.25  	cd /sys/block
    3.26  	for i in sd* sda ; do
    3.27  		grep -qs 1 $i/removable && break
    3.28 @@ -29,7 +21,7 @@
    3.29  # effect on an installed system.
    3.30  if ! grep -q "100[0-9]:100[0-9]" /etc/passwd; then
    3.31  	if fgrep -q "user=" /proc/cmdline; then
    3.32 -		USER=`cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/'`
    3.33 +		USER=$(cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/')
    3.34  		# Avoid usage of an existing system user or root.
    3.35  		if grep -q ^$USER /etc/passwd; then
    3.36  			USER=tux
    3.37 @@ -54,9 +46,9 @@
    3.38  fi
    3.39  
    3.40  # Parse /proc/cmdline for boot options.
    3.41 -echo "Parsing kernel cmdline for SliTaz live options... "
    3.42 +echo "Checking for SliTaz cmdline options..."
    3.43  
    3.44 -for opt in `cat /proc/cmdline`
    3.45 +for opt in $(cat /proc/cmdline)
    3.46  do
    3.47  	case $opt in
    3.48  		eject)
    3.49 @@ -140,12 +132,6 @@
    3.50  				cp -a /home/boot/rootfs/* /
    3.51  			fi ;;
    3.52  		laptop)
    3.53 -			# Laptop option to load related Kernel modules.
    3.54 -			echo "Loading laptop modules: ac, battery, fan, yenta_socket..."
    3.55 -			for mod in ac battery fan yenta_socket
    3.56 -			do
    3.57 -				modprobe $mod
    3.58 -			done
    3.59  			# Enable Kernel Laptop mode.
    3.60  			echo "5" > /proc/sys/vm/laptop_mode ;;
    3.61  		mount)
    3.62 @@ -199,15 +185,3 @@
    3.63  if [ ! -f /etc/X11/wm.default ]; then
    3.64  	echo "openbox" > /etc/X11/wm.default
    3.65  fi
    3.66 -
    3.67 -# Activate an eventual swap file or partition.
    3.68 -if [ "`fdisk -l | grep swap`" ]; then
    3.69 -	for SWAP_DEV in `fdisk -l | sed '/swap/!d;s/ .*//'`; do
    3.70 -		echo "Swap memory detected on: $SWAP_DEV"
    3.71 -		add_swap_in_fstab $SWAP_DEV
    3.72 -	done
    3.73 -fi
    3.74 -if grep -q swap /etc/fstab; then
    3.75 -	echo "Activating swap memory..."
    3.76 -	swapon -a
    3.77 -fi
     4.1 --- a/etc/init.d/local.sh	Wed May 02 17:03:41 2012 +0200
     4.2 +++ b/etc/init.d/local.sh	Fri Jun 01 21:46:07 2012 +0200
     4.3 @@ -1,9 +1,6 @@
     4.4  #!/bin/sh
     4.5 -# /etc/init.d/local.sh - Local startup commands.
     4.6 +#
     4.7 +# /etc/init.d/local.sh: Local startup commands
     4.8  #
     4.9  # All commands here will be executed at boot time.
    4.10  #
    4.11 -. /etc/init.d/rc.functions
    4.12 -
    4.13 -echo "Starting local startup commands... "
    4.14 -
     5.1 --- a/etc/init.d/network.sh	Wed May 02 17:03:41 2012 +0200
     5.2 +++ b/etc/init.d/network.sh	Fri Jun 01 21:46:07 2012 +0200
     5.3 @@ -1,6 +1,7 @@
     5.4  #!/bin/sh
     5.5 -# /etc/init.d/network.sh - Network initialization boot script.
     5.6 -# Config file is: /etc/network.conf
     5.7 +#
     5.8 +# /etc/init.d/network.sh : Network initialization boot script
     5.9 +# Configuration file     : /etc/network.conf
    5.10  #
    5.11  . /etc/init.d/rc.functions
    5.12  
    5.13 @@ -12,7 +13,7 @@
    5.14  
    5.15  boot() {
    5.16  	# Set hostname.
    5.17 -	echo -n "Setting hostname..."
    5.18 +	echo -n "Setting hostname to: $(cat /etc/hostname)"
    5.19  	/bin/hostname -F /etc/hostname
    5.20  	status
    5.21  
    5.22 @@ -30,7 +31,7 @@
    5.23  
    5.24  # For wifi. Users just have to enable it through yes and usually
    5.25  # essid any will work and the interface is autodetected.
    5.26 -wifi() {	
    5.27 +wifi() {
    5.28  	if [ "$WIFI" = "yes" ] || fgrep -q "wifi" /proc/cmdline; then
    5.29  		ifconfig $INTERFACE down
    5.30  
    5.31 @@ -52,7 +53,7 @@
    5.32  			iwconfig $WIFI_INTERFACE txpower on
    5.33  		fi
    5.34  		status
    5.35 -		
    5.36 +
    5.37  		[ -n "$WPA_DRIVER" ] || WPA_DRIVER="wext"
    5.38  		IWCONFIG_ARGS=""
    5.39  		[ -n "$WIFI_MODE" ] && IWCONFIG_ARGS="$IWCONFIG_ARGS mode $WIFI_MODE"
     6.1 --- a/etc/init.d/rc.shutdown	Wed May 02 17:03:41 2012 +0200
     6.2 +++ b/etc/init.d/rc.shutdown	Fri Jun 01 21:46:07 2012 +0200
     6.3 @@ -1,19 +1,19 @@
     6.4  #!/bin/sh
     6.5 -# /etc/init.d/rc.shutdown - This script is used by /etc/inittab to stop
     6.6 -# all daemons and shutdown the system.
     6.7 +#
     6.8 +# /etc/init.d/rc.shutdown : Executed on system shutdown or reboot
     6.9  #
    6.10  . /etc/init.d/rc.functions
    6.11  . /etc/rcS.conf
    6.12  
    6.13  log=/var/lib/shutdown.log
    6.14  
    6.15 -# Bold info message with uptime
    6.16 +# Clear and quiet shutdown
    6.17  clear && echo "System is going down for reboot or halt." > $log
    6.18  uptime >> $log
    6.19  
    6.20  # Store last alsa settings.
    6.21  if [ -x /usr/sbin/alsactl ]; then
    6.22 -	alsactl store
    6.23 +	alsactl store 2>> $log
    6.24  fi
    6.25  
    6.26  # Stop all daemons started at boot time.
     7.1 --- a/etc/init.d/rcS	Wed May 02 17:03:41 2012 +0200
     7.2 +++ b/etc/init.d/rcS	Fri Jun 01 21:46:07 2012 +0200
     7.3 @@ -1,6 +1,7 @@
     7.4  #!/bin/sh
     7.5 -# /etc/init.d/rcS - Initial boot script for SliTaz GNU/Linux.
     7.6 -# Config file is : /etc/rcS.conf
     7.7 +#
     7.8 +# /etc/init.d/rcS    : Initial boot script for SliTaz GNU/Linux
     7.9 +# Configuration file : /etc/rcS.conf
    7.10  #
    7.11  # rcS is the main initialization script used to check fs, mount, clean,
    7.12  # run scripts and start daemons.
    7.13 @@ -8,84 +9,79 @@
    7.14  . /etc/init.d/rc.functions
    7.15  . /etc/rcS.conf
    7.16  
    7.17 -# Set TZ and boot time.
    7.18 +# Set PATH, TZ and boot time.
    7.19 +export PATH=/bin:/sbin:/usr/bin:/usr/sbin
    7.20  [ -s /etc/TZ ] && export TZ="$(cat /etc/TZ)"
    7.21 -[ -n "$bootdate" ] || bootdate=`date +%s`
    7.22 +[ -n "$bootdate" ] || bootdate=$(date +%s)
    7.23  
    7.24  case "$1" in
    7.25  
    7.26  readonly)
    7.27  
    7.28 -# Graphical boot start.
    7.29 -if [ "$FBSPLASH" == "yes" ]; then
    7.30 -	reset && fbsplash -c \
    7.31 -		-s /etc/fbsplash/$FBSPLASH_THEME/fbsplash.ppm \
    7.32 -		-i /etc/fbsplash/$FBSPLASH_THEME/fbsplash.cfg \
    7.33 -		-f /etc/fbsplash/fifo &
    7.34 -	echo "0" > /etc/fbsplash/fifo && sleep 1
    7.35 -fi
    7.36 -
    7.37 -echo "Processing /etc/init.d/rcS..."
    7.38 +colorize 34 "Processing /etc/init.d/rcS..."
    7.39  
    7.40  # Mount /proc.
    7.41  echo -n "Mounting proc filesystem..."
    7.42 -/bin/mount proc
    7.43 +mount proc && status
    7.44 +
    7.45 +# Mount /run as tmpfs to avoid pidfile and other runtime data behing
    7.46 +# writting to disk.
    7.47 +echo -n "Mounting tmpfs filesystem on: /run"
    7.48 +mount -t tmpfs tmpfs /run
    7.49  status
    7.50  
    7.51 -[ "$FBSPLASH" == "yes" ] && echo "10" > /etc/fbsplash/fifo
    7.52 -
    7.53 -[ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo
    7.54 -
    7.55  # Before mounting filesystems we check fs specified in the file
    7.56  # /etc/rcS.conf and variable $CHECK_FS.
    7.57 -if [ -n "$CHECK_FS" ]; then
    7.58 +if [ "$CHECK_FS" ]; then
    7.59  	mount -o remount,ro /
    7.60 -	for i in $CHECK_FS
    7.61 -	do
    7.62 -		echo "Checking filesystem on : $i"
    7.63 -		/sbin/e2fsck -p $i
    7.64 +	for i in $CHECK_FS; do
    7.65 +		colorize 36 "Checking filesystem: $i"
    7.66 +		e2fsck -p $i
    7.67  	done
    7.68  fi
    7.69  
    7.70  # Remount rootfs rw.
    7.71  echo "Remounting rootfs read/write..."
    7.72 -/bin/mount -o remount,rw /
    7.73 +mount -o remount,rw /
    7.74  ;;
    7.75  
    7.76  readwrite)
    7.77  
    7.78  # Trigger Udev and handle hotplug events
    7.79  if [ "$UDEV" = "yes" ]; then
    7.80 +	echo -n "Mounting devtmpfs filesystem..."
    7.81 +	mount -t devtmpfs devtmpfs /dev
    7.82 +	status
    7.83  	echo "Starting udev daemon..."
    7.84 -	/sbin/udevd --daemon
    7.85 +	mkdir -p /run/udev
    7.86 +	udevd --daemon 2>/dev/null
    7.87  	echo "Udevadm requesting events from the Kernel..."
    7.88  	udevadm trigger
    7.89  	echo "Udevadm waiting for the event queue to finish..."
    7.90 -	udevadm settle
    7.91 -	echo "Using Udev for hotplugging..."
    7.92 -	echo "/sbin/udevd" > /proc/sys/kernel/hotplug
    7.93 +	udevadm settle --timeout=120
    7.94 +	# Disable hotplug helper since udevd listen to netlink
    7.95 +	echo "" > /proc/sys/kernel/hotplug
    7.96  fi
    7.97  
    7.98 -[ "$FBSPLASH" == "yes" ] && echo "30" > /etc/fbsplash/fifo
    7.99 -
   7.100  # Mount filesystems in /etc/fstab.
   7.101  echo "Mounting filesystems in fstab..."
   7.102 -/bin/mount -a
   7.103 +mount -a
   7.104 +
   7.105 +# Be quiet
   7.106 +echo "0 0 0 0" > /proc/sys/kernel/printk
   7.107  ;;
   7.108  
   7.109  logged)
   7.110  
   7.111  # Store boot messages to log files.
   7.112 -/bin/dmesg > /var/log/dmesg.log &
   7.113 +dmesg > /var/log/dmesg.log &
   7.114  
   7.115  # Parse cmdline args for earlier boot options. All other boot options
   7.116  # are in /etc/init./bootopts.sh.
   7.117  echo -n "Searching for early boot options..."
   7.118 -for opt in `cat /proc/cmdline`
   7.119 +for opt in $(cat /proc/cmdline)
   7.120  do
   7.121  	case $opt in
   7.122 -		fastbootx|fbx)
   7.123 -			export FAST_BOOT_X="yes" ;;
   7.124  		cdrom=*)
   7.125  			export CDROM=${opt#cdrom=} ;;
   7.126  		modprobe=*)
   7.127 @@ -98,75 +94,38 @@
   7.128  done
   7.129  status
   7.130  
   7.131 -# Clean up the system.
   7.132 +# Clean up the system and set up tmp X11 and ICE dir
   7.133  if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then
   7.134  	echo -n "Cleaning up the system..."
   7.135  	find /var/run -name "*.pid" -type f | xargs /bin/rm -f
   7.136 -	/bin/rm -rf /tmp /var/run/dbus/* /var/run/hald/pid /var/lock/*
   7.137 -	/bin/mkdir -p /tmp && /bin/chmod 1777 /tmp
   7.138 +	rm -rf /tmp /var/run/dbus/* /var/run/hald/pid /var/lock/*
   7.139 +	mkdir -p /tmp/.X11-unix /tmp/.ICE-unix
   7.140 +	chmod -R 1777 /tmp
   7.141  	status
   7.142  else
   7.143 -	echo "System clean up is disabled in /etc/rcS.conf..."
   7.144 -	echo -n "Keeping all tmp and pid files..."
   7.145 -	status
   7.146 -fi
   7.147 -
   7.148 -[ "$FBSPLASH" == "yes" ] && echo "40" > /etc/fbsplash/fifo
   7.149 -
   7.150 -# Set up tmp X11 and ICE dir.
   7.151 -echo -n "Setting up tmp X11 and ICE unix dir..."
   7.152 -/bin/mkdir -p /tmp/.X11-unix /tmp/.ICE-unix
   7.153 -/bin/chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix
   7.154 -status
   7.155 -
   7.156 -# Fast boot into X for HD install or custom Live system. We need
   7.157 -# keymap settings since Xvesa dumps the console mapping and a correct
   7.158 -# slim configuration for screen resolution. DBUS and HAL must also start
   7.159 -# before X session (manual login or autologin) to have devices in PCmanFM.
   7.160 -if [ "$FAST_BOOT_X" = "yes" ]; then
   7.161 -	/etc/init.d/system.sh
   7.162 -	/etc/init.d/dbus start
   7.163 -	/etc/init.d/hald start
   7.164 -	/etc/init.d/slim start &
   7.165 +	echo "System clean up is disabled in: /etc/rcS.conf"
   7.166  fi
   7.167  
   7.168  # Create /dev/cdrom if needed (symlink does not exist on LiveCD).
   7.169  # Also add /dev/cdrom to fstab if entry does not exist.
   7.170 -if [ -n "$CDROM" ]; then
   7.171 +if [ "$CDROM" ]; then
   7.172  	DRIVE_NAME=${CDROM#/dev/}
   7.173  else
   7.174  	DRIVE_NAME=$(fgrep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3)
   7.175  fi
   7.176 -if [ -n "$DRIVE_NAME" -a ! "`readlink /dev/cdrom`" ]; then
   7.177 +if [ "$DRIVE_NAME" -a ! "$(readlink /dev/cdrom)" ]; then
   7.178  	echo -n "Creating symlink : /dev/cdrom..."
   7.179  	ln -s /dev/$DRIVE_NAME /dev/cdrom
   7.180  	ln -s /dev/$DRIVE_NAME /dev/dvd
   7.181  	status
   7.182  fi
   7.183 -if ! fgrep -q "/dev/cdrom" /etc/fstab; then
   7.184 -	echo -n "Adding /dev/cdrom  to fstab..."
   7.185 -	echo '/dev/cdrom      /media/cdrom iso9660 user,ro,noauto       0       0' \
   7.186 -		>> /etc/fstab
   7.187 -	status
   7.188 -fi
   7.189 -# Chmod hack on each boot for Asunder and burnbox. Allowing all users
   7.190 -# to burn/rip CD/DVD.
   7.191 -if [ -n "$DRIVE_NAME" -a "`readlink /dev/cdrom`" ]; then
   7.192 -	echo -n "Chmoding cdrom device..."
   7.193 -	chmod 0666 /dev/cdrom
   7.194 -	chmod 0666 /dev/dvd
   7.195 -	chmod 0666 /dev/$DRIVE_NAME
   7.196 -	status
   7.197 -fi
   7.198 -
   7.199 -[ "$FBSPLASH" == "yes" ] && echo "50" > /etc/fbsplash/fifo
   7.200  
   7.201  # Handle kernel cmdline parameter modprobe=<module_list>
   7.202 -if [ -n "$MODPROBE" ]; then
   7.203 -	MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
   7.204 +if [ "$MODPROBE" ]; then
   7.205 +	MODULES=$(sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline)
   7.206  	for i in $MODULES; do
   7.207 -		echo -n "Loading kernel module $i"
   7.208 -		/sbin/modprobe $i
   7.209 +		echo -n "Loading kernel module: $i"
   7.210 +		modprobe $i
   7.211  		status
   7.212  	done
   7.213  fi
   7.214 @@ -177,131 +136,107 @@
   7.215  	DEVICE=${CONFIG%,*}
   7.216  	SCRIPT=${CONFIG#*,}
   7.217  	echo "Probing $DEVICE... "
   7.218 -	if ! /bin/mount -r $DEVICE /mnt; then
   7.219 +	if ! mount -r $DEVICE /mnt; then
   7.220  		if echo $DEVICE | grep -Eq "/dev/sd|UUID=|LABEL="; then
   7.221 -			USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
   7.222 +			USBDELAY=$(cat /sys/module/usb_storage/parameters/delay_use)
   7.223  			USBDELAY=$((1+$USBDELAY))
   7.224  			echo "$DEVICE is potentially a USB device: sleep for $USBDELAY seconds"
   7.225  			sleep $USBDELAY
   7.226  		fi
   7.227 -		if ! /bin/mount -r $DEVICE /mnt; then
   7.228 +		if ! mount -r $DEVICE /mnt; then
   7.229  			CONFIG=""
   7.230  		fi
   7.231  	fi
   7.232  	echo -n "Source $SCRIPT from $DEVICE..."
   7.233  	if [ -n "$CONFIG" ]; then
   7.234  		. /mnt/$SCRIPT
   7.235 -		/bin/umount /mnt 2> /dev/null || true
   7.236 +		umount /mnt 2> /dev/null || true
   7.237  	fi
   7.238  	status
   7.239  fi
   7.240  
   7.241 -# Mount /proc/bus/usb.
   7.242 +# Mount /proc/bus/usb
   7.243  if [ -d /proc/bus/usb ]; then
   7.244  	echo -n "Mounting /proc/bus/usb filesystem..."
   7.245 -	/bin/mount -t usbfs usbfs /proc/bus/usb
   7.246 +	mount -t usbfs usbfs /proc/bus/usb
   7.247  	status
   7.248  fi
   7.249  
   7.250 -[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo
   7.251 +# Start syslogd and klogd
   7.252 +echo -n "Starting system log deamon: syslogd..."
   7.253 +syslogd -s $SYSLOGD_ROTATED_SIZE && status
   7.254 +echo -n "Starting kernel log daemon: klogd..."
   7.255 +klogd && status
   7.256  
   7.257 -# Start syslogd and klogd.
   7.258 -if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then
   7.259 -	echo -n "Starting system log deamon: syslogd..."
   7.260 -	/sbin/syslogd -s $SYSLOGD_ROTATED_SIZE && status
   7.261 -	echo -n "Starting kernel log daemon: klogd..."
   7.262 -	/sbin/klogd && status
   7.263 -else
   7.264 -	echo "Kernel log daemons are disabled in /etc/rc.conf..."
   7.265 -fi
   7.266 -
   7.267 -# Load all modules listed in config file.
   7.268 -if [ -n "$LOAD_MODULES" ]; then
   7.269 -	for mod in $LOAD_MODULES
   7.270 -	do
   7.271 +# Load all modules listed in config file
   7.272 +if [ "$LOAD_MODULES" ]; then
   7.273 +	colorize 33 "Loading Kernel modules..."
   7.274 +	for mod in $LOAD_MODULES; do
   7.275 +		echo -n "Loading module: $mod"
   7.276  		modprobe $mod
   7.277 +		status
   7.278  	done
   7.279  fi
   7.280  
   7.281 -# Be quiet on configuration to avoid messages overwriting ncurses dialog
   7.282 -echo "0 0 0 0" > /proc/sys/kernel/printk
   7.283 -
   7.284 -[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo
   7.285 -
   7.286  # Detect PCI and USB devices with Tazhw from slitaz-tools. We load
   7.287  # kernel modules only at first boot or in LiveCD mode.
   7.288  if [ ! -s /var/lib/detected-modules ]; then
   7.289 -	/sbin/tazhw init
   7.290 +	tazhw init
   7.291  fi
   7.292  
   7.293 -[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo
   7.294 -
   7.295 -# Call udevadm trigger to ensure /dev is fully populate now that all 
   7.296 +# Call udevadm trigger to ensure /dev is fully populate now that all
   7.297  # modules are loaded.
   7.298  if [ "$UDEV" = "yes" ]; then
   7.299 -	echo -n "Requesting events from the Kernel..."
   7.300 -	udevadm trigger
   7.301 +	echo -n "Triggering udev events: --action=add"
   7.302 +	udevadm trigger --action=add
   7.303  	status
   7.304  fi
   7.305  
   7.306 -# Start all scripts specified with $RUN_SCRIPTS.
   7.307 -echo "Executing all initialization scripts..."
   7.308 -for script in $RUN_SCRIPTS
   7.309 -do
   7.310 -	if [ -x /etc/init.d/$script ]; then
   7.311 -		/etc/init.d/$script
   7.312 -	fi
   7.313 +# Start all scripts specified with $RUN_SCRIPTS
   7.314 +for script in $RUN_SCRIPTS; do
   7.315 +	echo $(colorize 34 "Processing: /etc/init.d/$script")
   7.316 +	/etc/init.d/$script
   7.317  done
   7.318  
   7.319 -[ "$FBSPLASH" == "yes" ] && echo "90" > /etc/fbsplash/fifo
   7.320 -
   7.321 -# Re-source main config file. In Live mode, daemons list can be modified
   7.322 -# by boot options (screen=text will remove slim).
   7.323 -. /etc/rcS.conf
   7.324 -
   7.325 -# Start all daemons specified with $RUN_DAEMONS.
   7.326 -echo "Starting all daemons specified in /etc/rcS.conf..."
   7.327 -for daemon in $RUN_DAEMONS
   7.328 -do
   7.329 -	if [ -x /etc/init.d/$daemon ]; then
   7.330 +# Start all daemons specified with $RUN_DAEMONS
   7.331 +if [ "$RUN_DAEMONS" ]; then
   7.332 +	colorize 33 "Starting all daemons..."
   7.333 +	for daemon in $RUN_DAEMONS; do
   7.334  		/etc/init.d/$daemon start
   7.335 -	fi
   7.336 -done
   7.337 -
   7.338 -[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo
   7.339 -
   7.340 -# Back to a verbose mode.
   7.341 -echo "7 4 1 7" > /proc/sys/kernel/printk
   7.342 -
   7.343 -# Reset screen and display a bold message.
   7.344 -if [ -n "$MESSAGE" ]; then
   7.345 -	/usr/bin/reset
   7.346 -	echo -e "\033[1m$MESSAGE\033[0m"
   7.347 +	done
   7.348  fi
   7.349  
   7.350 -# Display and log boot time.
   7.351 +# Back to a verbose mode
   7.352 +(sleep 6 && echo "7 4 1 7" > /proc/sys/kernel/printk) &
   7.353 +
   7.354 +if [ "$MESSAGE" ]; then
   7.355 +	newline
   7.356 +	colorize 32 "$MESSAGE"
   7.357 +fi
   7.358 +
   7.359 +# Display and log boot time
   7.360  time=$((`date +%s` - $bootdate))
   7.361  echo $time > /var/log/boot-time
   7.362  echo "SliTaz boot time: ${time}s"
   7.363 -[ "$FBSPLASH" == "yes" ] && echo "exit" > /etc/fbsplash/fifo
   7.364  ;;
   7.365  
   7.366  *)
   7.367 -if [ ! -s /dev/shm/boot.log ]; then
   7.368 -	mount -t devpts devpts /dev/pts
   7.369 -	mount -t tmpfs tmpfs /dev/shm
   7.370 -fi
   7.371 -script -aqc '/etc/init.d/rcS readonly' /dev/shm/boot.log
   7.372 -mv -f /dev/shm/boot.log /boot.log
   7.373 -umount /dev/shm
   7.374 -script -aqc '/etc/init.d/rcS readwrite' /boot.log
   7.375 -last=.9
   7.376 -for i in .8 .7 .6 .5 .4 .3 .2 .1 .0 '' ; do
   7.377 -	mv -f /var/log/boot.log$i /var/log/boot.log$last 2>/dev/null
   7.378 -	last=$i
   7.379 -done
   7.380 -mv -f /boot.log /var/log/boot.log
   7.381 -script -aqc '/etc/init.d/rcS logged' /var/log/boot.log
   7.382 -;;
   7.383 -
   7.384 +	# --> readonly --> readwrite --> logged.
   7.385 +	#if [ ! -s /run/boot.log ]; then
   7.386 +		#mount -t devpts devpts /dev/pts
   7.387 +		#mount -t tmpfs tmpfs /run
   7.388 +	#fi
   7.389 +	#script -aqc '/etc/init.d/rcS readonly' /run/boot.log
   7.390 +	#script -aqc '/etc/init.d/rcS readwrite' /run/boot.log
   7.391 +	/etc/init.d/rcS readonly
   7.392 +	/etc/init.d/rcS readwrite
   7.393 +	# Lograde boot.log
   7.394 +	#last=.9
   7.395 +	#for i in .8 .7 .6 .5 .4 .3 .2 .1 .0 '' ; do
   7.396 +		#mv -f /var/log/boot.log$i /var/log/boot.log$last 2>/dev/null
   7.397 +		#last=$i
   7.398 +	#done
   7.399 +	#mv -f /run/boot.log /var/log/boot.log
   7.400 +	#script -aqc '/etc/init.d/rcS logged' /var/log/boot.log
   7.401 +	/etc/init.d/rcS logged ;;
   7.402  esac
     8.1 --- a/etc/init.d/system.sh	Wed May 02 17:03:41 2012 +0200
     8.2 +++ b/etc/init.d/system.sh	Fri Jun 01 21:46:07 2012 +0200
     8.3 @@ -1,11 +1,13 @@
     8.4  #!/bin/sh
     8.5 -# /etc/init.d/system.sh - SliTaz hardware configuration.
     8.6 +#
     8.7 +# /etc/init.d/system.sh : SliTaz hardware configuration
     8.8  #
     8.9  # This script configures the sound card and screen. Tazhw is used earlier
    8.10  # at boot time to autoconfigure PCI and USB devices. It also configures
    8.11 -# system language, keyboard and TZ in live mode.
    8.12 +# system language, keyboard and TZ in live mode and start X.
    8.13  #
    8.14  . /etc/init.d/rc.functions
    8.15 +. /etc/rcS.conf
    8.16  
    8.17  # Parse cmdline args for boot options (See also rcS and bootopts.sh).
    8.18  XARG=""
    8.19 @@ -19,14 +21,6 @@
    8.20  			DRIVER=${opt#sound=} ;;
    8.21  		xarg=*)
    8.22  			XARG="$XARG ${opt#xarg=}" ;;
    8.23 -		screen=text)
    8.24 -				SCREEN=text
    8.25 -				# Disable X.
    8.26 -				echo -n "Disabling X login manager: slim..."
    8.27 -				. /etc/rcS.conf
    8.28 -				RUN_DAEMONS=$(echo $RUN_DAEMONS | sed s/' slim'/''/)
    8.29 -				sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
    8.30 -				status ;;
    8.31  		screen=*)
    8.32  			SCREEN=${opt#screen=} ;;
    8.33  		*)
    8.34 @@ -38,26 +32,26 @@
    8.35  # sound Kernel modules.
    8.36  if [ -n "$DRIVER" ]; then
    8.37  	case "$DRIVER" in
    8.38 -	no)
    8.39 -		echo -n "Removing all sound kernel modules..."
    8.40 -		rm -rf /lib/modules/`uname -r`/kernel/sound
    8.41 -		status
    8.42 -		echo -n "Removing all sound packages..."
    8.43 -		for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    8.44 -			pkg=${i#/var/lib/tazpkg/installed/}
    8.45 -			echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    8.46 -		done
    8.47 -		for i in alsa-lib mhwaveedit asunder libcddb ; do
    8.48 -			echo 'y' | tazpkg remove $i > /dev/null
    8.49 -		done
    8.50 -		status ;;
    8.51 -	noconf)
    8.52 -		echo "Sound configuration was disabled from cmdline..." ;;
    8.53 -	*)
    8.54 -		if [ -x /usr/sbin/soundconf ]; then
    8.55 -			echo "Using sound kernel module $DRIVER..."
    8.56 -			/usr/sbin/soundconf -M $DRIVER
    8.57 -		fi ;;
    8.58 +		no)
    8.59 +			echo -n "Removing all sound kernel modules..."
    8.60 +			rm -rf /lib/modules/$(uname -r)/kernel/sound
    8.61 +			status
    8.62 +			echo -n "Removing all sound packages..."
    8.63 +			for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    8.64 +				pkg=${i#/var/lib/tazpkg/installed/}
    8.65 +				echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    8.66 +			done
    8.67 +			for i in alsa-lib mhwaveedit asunder libcddb ; do
    8.68 +				echo 'y' | tazpkg remove $i > /dev/null
    8.69 +			done
    8.70 +			status ;;
    8.71 +		noconf)
    8.72 +			echo "Sound configuration was disabled from cmdline..." ;;
    8.73 +		*)
    8.74 +			if [ -x /usr/sbin/soundconf ]; then
    8.75 +				echo "Using sound kernel module $DRIVER..."
    8.76 +				/usr/sbin/soundconf -M $DRIVER
    8.77 +			fi ;;
    8.78  	esac
    8.79  # Sound card may already be detected by PCI-detect.
    8.80  elif [ -d /proc/asound ]; then
    8.81 @@ -76,12 +70,6 @@
    8.82  	echo "Unable to configure sound card."
    8.83  fi
    8.84  
    8.85 -# Start TazPanel
    8.86 -[ -x /usr/bin/tazpanel ] && tazpanel start
    8.87 -
    8.88 -# Auto recharge packages list (after network connection of course)
    8.89 -[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge &
    8.90 -
    8.91  # Locale config.
    8.92  echo "Checking if /etc/locale.conf exists... "
    8.93  if [ ! -s "/etc/locale.conf" ]; then
    8.94 @@ -109,37 +97,42 @@
    8.95  			echo "Europe/Paris" > /etc/TZ ;;
    8.96  		fr_CH-latin1|de_CH-latin1)
    8.97  			echo "Europe/Zurich" > /etc/TZ ;;
    8.98 -		cf)
    8.99 -			echo "America/Montreal" > /etc/TZ ;;
   8.100 -		*)
   8.101 -			echo "UTC" > /etc/TZ ;;
   8.102 +		cf) echo "America/Montreal" > /etc/TZ ;;
   8.103 +		*) echo "UTC" > /etc/TZ ;;
   8.104  	esac
   8.105  fi
   8.106  
   8.107 -# Xorg auto configuration.
   8.108 -if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
   8.109 +# Activate an eventual swap file or partition
   8.110 +if [ "$(fdisk -l | grep swap)" ]; then
   8.111 +	for swd in $(fdisk -l | sed '/swap/!d;s/ .*//'); do
   8.112 +		if ! grep -q "$swd	" /etc/fstab; then
   8.113 +			echo "Swap memory detected on: $swd"
   8.114 +		cat >> /etc/fstab <<EOT
   8.115 +$swd	swap	swap	default	0 0
   8.116 +EOT
   8.117 +		fi
   8.118 +	done
   8.119 +fi
   8.120 +if grep -q swap /etc/fstab; then
   8.121 +	echo -n "Activating swap memory..."
   8.122 +	swapon -a && status
   8.123 +fi
   8.124 +
   8.125 +# Xorg auto configuration: $HOME is not yet set. We config even if
   8.126 +# screen=text so X can be started by users via 'startx'
   8.127 +if [ ! -s /etc/X11/xorg.conf ] && [ -x /usr/bin/Xorg ]; then
   8.128  	echo "Configuring Xorg..."
   8.129 -	# $HOME is not yet set.
   8.130  	HOME=/root
   8.131 -	sed -i 's|/usr/bin/Xvesa|/usr/bin/Xorg|' /etc/slim.conf
   8.132 -	sed -i s/"^xserver_arguments"/'\#xserver_arguments'/ /etc/slim.conf
   8.133  	tazx config-xorg 2>/var/log/xorg.configure.log
   8.134  fi
   8.135  
   8.136 -# Start X sesssion as soon as possible in Live/frugal mode. HD install
   8.137 -# can use FAST_BOOT_X which starts X beforehand. In live mode we need
   8.138 -# keymap config for Xorg configuration and a working Xorg config.
   8.139 -#if [ "$SCREEN" != "text" ] && [ -x /usr/bin/slim ]; then
   8.140 -	#if fgrep -q root=/dev/null /proc/cmdline; then
   8.141 -		#/etc/init.d/slim start
   8.142 -	#fi
   8.143 -#fi
   8.144 +# Start X sesssion as soon as possible
   8.145 +if [ "$SCREEN" != "text" ] && [ "$LOGIN_MANAGER" ]; then
   8.146 +	echo -n "Starting X environment..."
   8.147 +	/etc/init.d/dbus start >/dev/null
   8.148 +	/etc/init.d/$LOGIN_MANAGER start >/dev/null &
   8.149 +	status
   8.150 +fi
   8.151  
   8.152 -# Firefox hack to get the right locale.
   8.153 -if fgrep -q "fr_" /etc/locale.conf; then
   8.154 -	# But is the fox installed ?
   8.155 -	if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then
   8.156 -		. /var/lib/tazpkg/installed/firefox/receipt
   8.157 -		sed -i 's/en-US/fr/' /etc/firefox/pref/firefox-l10n.js
   8.158 -	fi
   8.159 -fi
   8.160 +# Start TazPanel
   8.161 +[ -x /usr/bin/tazpanel ] && tazpanel start
     9.1 --- a/etc/rcS.conf	Wed May 02 17:03:41 2012 +0200
     9.2 +++ b/etc/rcS.conf	Fri Jun 01 21:46:07 2012 +0200
     9.3 @@ -1,53 +1,34 @@
     9.4 -# /etc/rcS.conf - Initial boot script configuration for SliTaz GNU/Linux.
     9.5 -# Config file used by /etc/init.d/rcS
     9.6 +# /etc/rcS.conf : Initial boot script configuration for SliTaz GNU/Linux
     9.7 +# Sourced by    : /etc/init.d/rcS
     9.8  #
     9.9  
    9.10 -# Use udev to populate /dev and handle hotplug events.
    9.11 +# Use udev to populate /dev and handle hotplug events
    9.12  UDEV="yes"
    9.13  
    9.14 -# Clean up the system removing all tmp and pid files.
    9.15 +# Clean up the system removing all tmp and pid files
    9.16  CLEAN_UP_SYSTEM="yes"
    9.17  
    9.18  # Filesystems to check integrity of at boot time. You should check the
    9.19 -# rootfs (where SliTaz is installed) and all partitions listed in
    9.20 -# /etc/fstab. Example: CHECK_FS="/dev/hda5 /dev/hdb1"
    9.21 +# rootfs (where SliTaz is installed) and all partitions listed in fstab.
    9.22 +# Example: CHECK_FS="/dev/hda5 /dev/hdb1"
    9.23  CHECK_FS=""
    9.24  
    9.25 -# Fast boot into X by setting the system keymap-locale and starting
    9.26 -# the Slim login manager earlier at boot time. If fast X is enabled
    9.27 -# then dbus, hald and slim can be removed from RUN_DAEMONS.
    9.28 -FAST_BOOT_X="no"
    9.29 -
    9.30 -# Graphical boot with fbsplash (To easily configure use: tazfbsplash)
    9.31 -FBSPLASH="no"
    9.32 -FBSPLASH_THEME="slitaz"
    9.33 -
    9.34 -# Start Kernel log daemons (syslogd and klogd).
    9.35 -KERNEL_LOG_DAEMONS="yes"
    9.36 +# Syslogd: Max size (KB) before rotation
    9.37  SYSLOGD_ROTATED_SIZE="60"
    9.38  
    9.39 -# Kernel modules to automatically load at boot time if not automatically
    9.40 -# detected. You can use 'modprobe -l' to get a list of all kernel modules
    9.41 -# available.
    9.42 +# Kernel modules to load at boot time
    9.43  LOAD_MODULES=""
    9.44  
    9.45 -# Automatically recharge packages list on each boot and in background.
    9.46 -# If new packages or upgrades are available they will be notified with
    9.47 -# tazpkg-notify. Here we just recharge list, we don't install anything
    9.48 -# since root user should visually check packages that will be upgraded.
    9.49 -RECHARGE_PACKAGES_LIST="no"
    9.50 +# X Login manager: slim or lxdm, empty to disable X
    9.51 +LOGIN_MANAGER="slim"
    9.52  
    9.53 -# Initialization scripts to run at boot time. Boot order is important:
    9.54 -# bootopts.sh (boot options) must start first, system.sh after network.sh
    9.55 -# (tazx needs an active connection to install Xorg), then you are free 
    9.56 -# to choose. Note that the local.sh script exists to let you quickly add
    9.57 -# some local startup commands.
    9.58 -RUN_SCRIPTS="bootopts.sh network.sh system.sh local.sh"
    9.59 +# Initialization scripts to run at boot time. The local.sh script
    9.60 +# let you quickly add some local startup commands.
    9.61 +RUN_SCRIPTS="bootopts.sh system.sh network.sh local.sh"
    9.62  
    9.63 -# Daemons to start at boot time. SliTaz only provides a few daemons: firewall,
    9.64 -# Web server (lighttpd), SSH server (dropbear) and rsyncd, so boot order is
    9.65 -# not really important, but dbus/hald should be started before slim.
    9.66 -RUN_DAEMONS="dbus hald slim firewall httpd"
    9.67 +# Daemons to start at boot time. DBUS daemon is started before the
    9.68 +# login manager and from: /etc/init.d/system.sh
    9.69 +RUN_DAEMONS="firewall httpd"
    9.70  
    9.71  # Pre login bold message.
    9.72 -MESSAGE="Welcome to your box."
    9.73 +MESSAGE="Welcome to your box"