slitaz-boot-scripts rev 262

Improve, fixes, big changes, 2 scripts less, one new system.sh, GUI config in live tha work with latest cookutils packages, well tested on Qemu, frugal, first HD install boot
author Christophe Lincoln <pankso@slitaz.org>
date Mon May 16 00:32:16 2011 +0200 (2011-05-16)
parents 1cb12350353b
children 8b16caf41633
files etc/init.d/bootopts.sh etc/init.d/hwconf.sh etc/init.d/i18n.sh etc/init.d/rc.functions etc/init.d/rcS etc/init.d/system.sh etc/init.d/user-home.sh etc/rcS.conf
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Sat Apr 30 21:10:06 2011 +0000
     1.2 +++ b/etc/init.d/bootopts.sh	Mon May 16 00:32:16 2011 +0200
     1.3 @@ -13,6 +13,38 @@
     1.4  EOT
     1.5  }
     1.6  
     1.7 +# Default user account without password (uid=1000). In live mode the option
     1.8 +# user=name can be used, but user must be added before home= to have home dir.
     1.9 +# This option is not handled by a loop and case like others and has no
    1.10 +# effect on an installed system.
    1.11 +if ! grep -q "100[0-9]:100[0-9]" /etc/passwd; then
    1.12 +	if grep -q "user=" /proc/cmdline; then
    1.13 +		USER=`cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/'`
    1.14 +		# Avoid usage of an existing system user or root.
    1.15 +		if grep -q ^$USER /etc/passwd; then
    1.16 +			USER=tux
    1.17 +		fi
    1.18 +	else
    1.19 +		USER=tux
    1.20 +	fi
    1.21 +	echo -n "Configuring user and group: $USER..."
    1.22 +	adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER
    1.23 +	passwd -d $USER >/dev/null
    1.24 +	status
    1.25 +	# Audio and cdrom group.
    1.26 +	addgroup $USER audio
    1.27 +	addgroup $USER cdrom
    1.28 +	addgroup $USER video
    1.29 +	addgroup $USER tty
    1.30 +	# make user be only read/write by user
    1.31 +	chmod -R 700 /home/$USER
    1.32 +	# Slim default user.
    1.33 +	if [ -f /etc/slim.conf ]; then
    1.34 +		sed -i s/"default_user .*"/"default_user        $USER"/\
    1.35 +			/etc/slim.conf
    1.36 +	fi
    1.37 +fi
    1.38 +
    1.39  # Parse /proc/cmdline for boot options.
    1.40  echo "Parsing kernel cmdline for SliTaz live options... "
    1.41  
    1.42 @@ -22,6 +54,86 @@
    1.43  		eject)
    1.44  			# Eject cdrom.
    1.45  			eject /dev/cdrom ;;
    1.46 +		autologin)
    1.47 +			# Autologin option to skip first graphic login prompt.
    1.48 +			echo "auto_login        yes" >> /etc/slim.conf ;;
    1.49 +		lang=*)
    1.50 +			# Check for a specified locale (lang=*).
    1.51 +			LANG=${opt#lang=}
    1.52 +			echo -n "Setting system locale to: $LANG... "
    1.53 +			echo "LANG=$LANG" > /etc/locale.conf
    1.54 +			echo "LC_ALL=$LANG" >> /etc/locale.conf
    1.55 +			[ ! -d /usr/lib/locale/$LANG ] && localedef \
    1.56 +				-i $LANG -c -f UTF-8 /usr/lib/locale/$LANG &
    1.57 +			tazlocale link-files
    1.58 +			status ;;
    1.59 +		kmap=*)
    1.60 +			# Check for a specified keymap (kmap=*).
    1.61 +			KEYMAP=${opt#kmap=}
    1.62 +			echo -n "Setting system keymap to: $KEYMAP..."
    1.63 +			echo "$KEYMAP" > /etc/keymap.conf
    1.64 +			status ;;
    1.65 +		home=*)
    1.66 +			# Check for a specified home partition (home=*) and check for
    1.67 +			# user home dir. Note: home=usb is a shorter and easier way to
    1.68 +			# have home=/dev/sda1.
    1.69 +			DEVICE=${opt#home=}
    1.70 +			[ "$DEVICE" = "usb" ] && DEVICE=sda1
    1.71 +			echo "Home has been specified to $DEVICE..."
    1.72 +			DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    1.73 +			if [ -z "$DEVID" ]; then
    1.74 +				USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
    1.75 +				USBDELAY=$((2+$USBDELAY))
    1.76 +				echo "Sleeping $USBDELAY s to let the kernel detect the device... "
    1.77 +				sleep $USBDELAY
    1.78 +			fi
    1.79 +			USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'`
    1.80 +			DEVID=$DEVICE
    1.81 +			if [ -x /sbin/blkid ]; then
    1.82 +				# Can be a label, uuid, type or devname. DEVID gives us first: /dev/name.
    1.83 +				DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    1.84 +			fi
    1.85 +			DEVID=${DEVID##*/}
    1.86 +			if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
    1.87 +				echo "Mounting /home on /dev/$DEVID... "
    1.88 +				[ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files
    1.89 +				mount /dev/$DEVID /home -o uid=1000,gid=1000 2>/dev/null \
    1.90 +					|| mount /dev/$DEVID /home
    1.91 +				# Check if swap file must be generated in /home: swap=size (Mb).
    1.92 +				# This option is only used within home=device.
    1.93 +				if grep -q "swap=[1-9]*" /proc/cmdline; then
    1.94 +					SWAP_SIZE=`sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline`
    1.95 +					# DD to gen a virtual disk.
    1.96 +					echo "Generating swap file: /home/swap ($SWAP_SIZE)..."
    1.97 +					dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE
    1.98 +					# Make the Linux swap filesystem.
    1.99 +					mkswap /home/swap
   1.100 +					add_swap_in_fstab /home/swap
   1.101 +				fi
   1.102 +			else
   1.103 +				echo "Unable to find $DEVICE... "
   1.104 +			fi
   1.105 +			# Move all user dir if needed.
   1.106 +			if [ ! -d "/home/$USER" ] ; then
   1.107 +				mv /tmp/$USER-files /home/$USER
   1.108 +				chown -R $USER.users /home/$USER
   1.109 +			else
   1.110 +				rm -rf /tmp/$USER-files
   1.111 +			fi
   1.112 +			# Install all packages in /home/boot/packages. In live CD and
   1.113 +			# USB mode the option home= mounts the device on /home, so we
   1.114 +			# already have a boot directory with the Kernel and rootfs.
   1.115 +			if [ -d "/home/boot/packages" ]; then
   1.116 +				for pkg in /home/boot/packages/*.tazpkg
   1.117 +				do
   1.118 +					tazpkg install $pkg
   1.119 +				done
   1.120 +			fi
   1.121 +			# We can have custom files in /home/boot/rootfs to overwrite
   1.122 +			# the one packed into the Live system.
   1.123 +			if [ -d "/home/boot/rootfs" ]; then
   1.124 +				cp -a /home/boot/rootfs/* /
   1.125 +			fi ;;
   1.126  		laptop)
   1.127  			# Laptop option to load related Kernel modules.
   1.128  			echo "Loading laptop modules: ac, battery, fan, yenta_socket..."
   1.129 @@ -62,11 +174,29 @@
   1.130  				status
   1.131  				/packages/install.sh
   1.132  			fi ;;
   1.133 +		wm=*)
   1.134 +			# Check for a Window Manager (for a flavor, default WM can be changed
   1.135 +			# with boot options or with an addfile in /etc/X11/wm.default.
   1.136 +			WM=${opt#wm=}
   1.137 +			mkdir -p /etc/X11
   1.138 +			case $WM in
   1.139 +				jwm)
   1.140 +					echo "jwm" > /etc/X11/wm.default ;;
   1.141 +				ob|openbox|openbox-session)
   1.142 +					echo "openbox" > /etc/X11/wm.default ;;
   1.143 +				e17|enlightenment|enlightenment_start)
   1.144 +					echo "enlightenment" > /etc/X11/wm.default ;;
   1.145 +			esac ;;
   1.146  		*)
   1.147  			continue ;;
   1.148  	esac
   1.149  done
   1.150  
   1.151 +# If no default WM fallback to Openbox (we never know).
   1.152 +if [ ! -f /etc/X11/wm.default ]; then
   1.153 +	echo "openbox" > /etc/X11/wm.default
   1.154 +fi
   1.155 +
   1.156  # Activate an eventual swap file or partition.
   1.157  if [ "`fdisk -l | grep swap`" ]; then
   1.158  	for SWAP_DEV in `fdisk -l | sed '/swap/!d;s/ .*//'`; do
     2.1 --- a/etc/init.d/hwconf.sh	Sat Apr 30 21:10:06 2011 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,73 +0,0 @@
     2.4 -#!/bin/sh
     2.5 -# /etc/init.d/hwconf.sh - SliTaz hardware configuration.
     2.6 -#
     2.7 -# This script configures the sound card and screen. Tazhw is used earlier
     2.8 -# at boot time to autoconfigure PCI and USB devices.
     2.9 -#
    2.10 -. /etc/init.d/rc.functions
    2.11 -
    2.12 -# Parse cmdline args for boot options (See also rcS and bootopts.sh).
    2.13 -XARG=""
    2.14 -for opt in `cat /proc/cmdline`
    2.15 -do
    2.16 -	case $opt in
    2.17 -		sound=*)
    2.18 -			DRIVER=${opt#sound=} ;;
    2.19 -		xarg=*)
    2.20 -			XARG="$XARG ${opt#xarg=}" ;;
    2.21 -		screen=text)
    2.22 -				SCREEN=text
    2.23 -				# Disable X.
    2.24 -				echo -n "Disabling X login manager: slim..."
    2.25 -				. /etc/rcS.conf
    2.26 -				RUN_DAEMONS=`echo $RUN_DAEMONS | sed s/' slim'/''/`
    2.27 -				sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
    2.28 -				status ;;
    2.29 -		screen=*)
    2.30 -			SCREEN=${opt#screen=} ;;
    2.31 -		*)
    2.32 -			continue ;;
    2.33 -	esac
    2.34 -done
    2.35 -
    2.36 -# Sound configuration stuff. First check if sound=no and remove all
    2.37 -# sound Kernel modules.
    2.38 -if [ -n "$DRIVER" ]; then
    2.39 -	case "$DRIVER" in
    2.40 -	no)
    2.41 -		echo -n "Removing all sound kernel modules..."
    2.42 -		rm -rf /lib/modules/`uname -r`/kernel/sound
    2.43 -		status
    2.44 -		echo -n "Removing all sound packages..."
    2.45 -		for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    2.46 -			pkg=${i#/var/lib/tazpkg/installed/}
    2.47 -			echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    2.48 -		done
    2.49 -		for i in alsa-lib mhwaveedit asunder libcddb ; do
    2.50 -			echo 'y' | tazpkg remove $i > /dev/null
    2.51 -		done
    2.52 -		status ;;
    2.53 -	noconf)
    2.54 -		echo "Sound configuration was disabled from cmdline..." ;;
    2.55 -	*)
    2.56 -		if [ -x /usr/sbin/soundconf ]; then
    2.57 -			echo "Using sound kernel module $DRIVER..."
    2.58 -			/usr/sbin/soundconf -M $DRIVER
    2.59 -		fi ;;
    2.60 -	esac
    2.61 -# Sound card may already be detected by PCI-detect.
    2.62 -elif [ -d /proc/asound ]; then
    2.63 -	# Restore sound config for installed system.
    2.64 -	if [ -s /etc/asound.state ]; then
    2.65 -		echo -n "Restoring last alsa configuration..."
    2.66 -		alsactl restore
    2.67 -		status
    2.68 -	else
    2.69 -		/usr/sbin/setmixer
    2.70 -	fi
    2.71 -	# Start soundconf to config driver and load module for Live mode
    2.72 -	# if not yet detected.
    2.73 -	/usr/bin/amixer >/dev/null || /usr/sbin/soundconf
    2.74 -else
    2.75 -	echo "Unable to configure sound card."
    2.76 -fi
     3.1 --- a/etc/init.d/i18n.sh	Sat Apr 30 21:10:06 2011 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,52 +0,0 @@
     3.4 -#!/bin/sh
     3.5 -# /etc/init.d/i18n.sh - Internationalization initialization.
     3.6 -#
     3.7 -# This script configures SliTaz default keymap, locale, timezone.
     3.8 -#
     3.9 -. /etc/init.d/rc.functions
    3.10 -
    3.11 -# Locale config.
    3.12 -if [ -s "/etc/locale.conf" ]; then
    3.13 -	. /etc/locale.conf
    3.14 -	echo -n "Locale configuration: $LANG" && status
    3.15 -else
    3.16 -	tazlocale
    3.17 -fi
    3.18 -
    3.19 -# Keymap config.
    3.20 -if [ -s "/etc/keymap.conf" ]; then
    3.21 -	keymap=`cat /etc/keymap.conf`
    3.22 -	echo -n "Keymap configuration: $keymap" && status
    3.23 -	if [ -x /bin/loadkeys ]; then
    3.24 -		loadkeys $keymap
    3.25 -	else
    3.26 -		loadkmap < /usr/share/kmap/$keymap.kmap
    3.27 -	fi
    3.28 -else
    3.29 -	tazkeymap
    3.30 -fi
    3.31 -
    3.32 -# Timezone config. Set timezone using the keymap config for fr, be, fr_CH
    3.33 -# and ca with Montreal.
    3.34 -if [ ! -s "/etc/TZ" ]; then
    3.35 -	keymap=`cat /etc/keymap.conf`
    3.36 -	case "$keymap" in
    3.37 -		fr-latin1|be-latin1)
    3.38 -			echo -n "Setting timezone to Europe/Paris... "
    3.39 -			echo "Europe/Paris" > /etc/TZ && status
    3.40 -			;;
    3.41 -		fr_CH-latin1|de_CH-latin1)
    3.42 -			echo -n "Setting timezone to Europe/Zurich... "
    3.43 -			echo "Europe/Zurich" > /etc/TZ && status
    3.44 -			;;
    3.45 -		cf)
    3.46 -			echo -n "Setting timezone to America/Montreal... "
    3.47 -			echo "America/Montreal" > /etc/TZ && status
    3.48 -			;;
    3.49 -		*)
    3.50 -			echo -n "Setting default timezone to UTC... "
    3.51 -			echo "UTC" > /etc/TZ && status
    3.52 -			;;
    3.53 -	esac
    3.54 -fi
    3.55 -
     4.1 --- a/etc/init.d/rc.functions	Sat Apr 30 21:10:06 2011 +0000
     4.2 +++ b/etc/init.d/rc.functions	Mon May 16 00:32:16 2011 +0200
     4.3 @@ -1,30 +1,16 @@
     4.4 +#!/bin/sh
     4.5  # /etc/init.d/rc.functions: SliTaz boot scripts functions.
     4.6  #
     4.7  
     4.8  # Status functions.
     4.9 -status()
    4.10 -{
    4.11 -	local CHECK=$?
    4.12 +status() {
    4.13  	echo -en "\\033[70G[ "
    4.14 -	if [ $CHECK = 0 ]; then
    4.15 -		echo -en "\\033[1;33mOK"
    4.16 +	if [ $? = 0 ]; then
    4.17 +		echo -en "\\033[1;32mOK"
    4.18  	else
    4.19  		echo -en "\\033[1;31mFailed"
    4.20  	fi
    4.21  	echo -e "\\033[0;39m ]"
    4.22 -	return $CHECK
    4.23 -}
    4.24 -
    4.25 -# Another way to sleep.
    4.26 -usleep_progress()
    4.27 -{
    4.28 -	CHAR='='
    4.29 -	for i in `seq 1 79`
    4.30 -	do
    4.31 -		echo -n "$CHAR"
    4.32 -		usleep 18000
    4.33 -	done
    4.34 -	echo "$CHAR"
    4.35  }
    4.36  
    4.37  # Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON
    4.38 @@ -40,6 +26,3 @@
    4.39  		return 2
    4.40  	fi
    4.41  }
    4.42 -
    4.43 -# Set TZ
    4.44 -[ -s /etc/TZ ] && export TZ="$(cat /etc/TZ)"
     5.1 --- a/etc/init.d/rcS	Sat Apr 30 21:10:06 2011 +0000
     5.2 +++ b/etc/init.d/rcS	Mon May 16 00:32:16 2011 +0200
     5.3 @@ -8,7 +8,8 @@
     5.4  . /etc/init.d/rc.functions
     5.5  . /etc/rcS.conf
     5.6  
     5.7 -# Boot time.
     5.8 +# Set TZ and boot time.
     5.9 +[ -s /etc/TZ ] && export TZ="$(cat /etc/TZ)"
    5.10  bootdate=`date +%s`
    5.11  
    5.12  if [ "$1" != "logged" ]; then # logged
    5.13 @@ -29,50 +30,27 @@
    5.14  /bin/mount proc
    5.15  status
    5.16  
    5.17 -# Set time zone now to get system events at local time
    5.18 -if [ -s /etc/TZ ]; then
    5.19 -	export TZ=$(cat /etc/TZ)
    5.20 -fi
    5.21 -
    5.22  [ "$FBSPLASH" == "yes" ] && echo "10" > /etc/fbsplash/fifo
    5.23  
    5.24  # Parse cmdline args for earlier boot options. All other boot options
    5.25  # are in /etc/init./bootopts.sh.
    5.26 -echo "Checking for early boot options..."
    5.27 +echo -n "Searching for early boot options..."
    5.28  for opt in `cat /proc/cmdline`
    5.29  do
    5.30  	case $opt in
    5.31 +		fastbootx|fbx)
    5.32 +			export FAST_BOOT_X="yes" ;;
    5.33  		cdrom=*)
    5.34  			export CDROM=${opt#cdrom=} ;;
    5.35  		modprobe=*)
    5.36  			export MODPROBE="yes" ;;
    5.37  		config=*)
    5.38  			export CONFIG=${opt#config=} ;;
    5.39 -		xarg=*)
    5.40 -			export XARG="$XARG ${opt#xarg=}" ;;
    5.41 -		screen=*)
    5.42 -			export SCREEN=${opt#screen=} ;;
    5.43 -		autologin)
    5.44 -			# Autologin option to skip first graphic login prompt.
    5.45 -			if [ ! $(grep -l '^auto_login        yes' /etc/slim.conf) ]; then
    5.46 -				echo "auto_login        yes" >> /etc/slim.conf
    5.47 -			fi ;;
    5.48 -		lang=*)
    5.49 -			# Check for a specified locale (lang=*).
    5.50 -			LANG=${opt#lang=}
    5.51 -			echo -n "Setting system locale to: $LANG... "
    5.52 -			tazlocale init $LANG
    5.53 -			status ;;
    5.54 -		kmap=*)
    5.55 -			# Check for a specified keymap (kmap=*).
    5.56 -			KEYMAP=${opt#kmap=}
    5.57 -			echo -n "Setting system keymap to: $KEYMAP..."
    5.58 -			tazkeymap init $KEYMAP
    5.59 -			status ;;
    5.60  		*)
    5.61  			continue ;;
    5.62  	esac
    5.63  done
    5.64 +status
    5.65  
    5.66  [ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo
    5.67  
    5.68 @@ -141,12 +119,23 @@
    5.69  /bin/chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix
    5.70  status
    5.71  
    5.72 +# Fast boot into X for HD install or custom Live system. We need
    5.73 +# keymap settings since Xvesa dumps the console mapping and a correct
    5.74 +# slim configuration for screen resolution. DBUS and HAL must also start
    5.75 +# before X session (manual login or autologin) to have devices in PCmanFM.
    5.76 +if [ "$FAST_BOOT_X" = "yes" ]; then
    5.77 +	/etc/init.d/system.sh
    5.78 +	/etc/init.d/dbus start
    5.79 +	/etc/init.d/hald start
    5.80 +	/etc/init.d/slim start &
    5.81 +fi
    5.82 +
    5.83  # Create /dev/cdrom if needed (symlink does not exist on LiveCD).
    5.84  # Also add /dev/cdrom to fstab if entry does not exist.
    5.85  if [ -n "$CDROM" ]; then
    5.86  	DRIVE_NAME=${CDROM#/dev/}
    5.87  else
    5.88 -	DRIVE_NAME=$(grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3)
    5.89 +	DRIVE_NAME=`grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3`
    5.90  fi
    5.91  if [ -n "$DRIVE_NAME" -a ! "`readlink /dev/cdrom`" ]; then
    5.92  	echo -n "Creating symlink : /dev/cdrom..."
    5.93 @@ -160,9 +149,6 @@
    5.94  		>> /etc/fstab
    5.95  	status
    5.96  fi
    5.97 -
    5.98 -[ "$FBSPLASH" == "yes" ] && echo "50" > /etc/fbsplash/fifo
    5.99 -
   5.100  # Chmod hack on each boot for Asunder and burnbox. Allowing all users
   5.101  # to burn/rip CD/DVD.
   5.102  if [ -n "$DRIVE_NAME" -a "`readlink /dev/cdrom`" ]; then
   5.103 @@ -173,6 +159,8 @@
   5.104  	status
   5.105  fi
   5.106  
   5.107 +[ "$FBSPLASH" == "yes" ] && echo "50" > /etc/fbsplash/fifo
   5.108 +
   5.109  # Handle kernel cmdline parameter modprobe=<module_list>
   5.110  if [ -n "$MODPROBE" ]; then
   5.111  	MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
   5.112 @@ -183,8 +171,6 @@
   5.113  	done
   5.114  fi
   5.115  
   5.116 -[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo
   5.117 -
   5.118  # Handle kernel cmdline parameter config=<device>,<path> to source a
   5.119  # disk init script
   5.120  if [ -n "$CONFIG" ]; then
   5.121 @@ -217,6 +203,8 @@
   5.122  	status
   5.123  fi
   5.124  
   5.125 +[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo
   5.126 +
   5.127  # Start syslogd and klogd.
   5.128  if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then
   5.129  	echo -n "Starting system log deamon: syslogd..."
   5.130 @@ -227,8 +215,6 @@
   5.131  	echo "Kernel log daemons are disabled in /etc/rc.conf..."
   5.132  fi
   5.133  
   5.134 -[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo
   5.135 -
   5.136  # Load all modules listed in config file.
   5.137  if [ -n "$LOAD_MODULES" ]; then
   5.138  	for mod in $LOAD_MODULES
   5.139 @@ -240,60 +226,24 @@
   5.140  # Be quiet on configuration to avoid messages overwriting ncurses dialog
   5.141  echo "0 0 0 0" > /proc/sys/kernel/printk
   5.142  
   5.143 +[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo
   5.144 +
   5.145  # Detect PCI and USB devices with Tazhw from slitaz-tools. We load
   5.146  # kernel modules only at first boot or in LiveCD mode.
   5.147  if [ ! -s /var/lib/detected-modules ]; then
   5.148  	/sbin/tazhw init
   5.149  fi
   5.150  
   5.151 +[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo
   5.152 +
   5.153 +# Call udevadm trigger to ensure /dev is fully populate now that all 
   5.154 +# modules are loaded.
   5.155  if [ "$UDEV" = "yes" ]; then
   5.156 -	echo -n "Udevadm requesting events from the Kernel..."
   5.157 +	echo -n "Requesting events from the Kernel..."
   5.158  	udevadm trigger
   5.159  	status
   5.160  fi
   5.161  
   5.162 -# Start DBUS and HAL deamon so we can use Xorg and a WM to configure
   5.163 -# system locale and keybord on first boot.
   5.164 -[ -x /etc/init.d/dbus ] && /etc/init.d/dbus start
   5.165 -[ -x /etc/init.d/hald ] && /etc/init.d/hald start
   5.166 -
   5.167 -[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo
   5.168 -
   5.169 -# Set the console keymap and configure i18n in case of screen=text and
   5.170 -# no locale.conf or keymap.conf. Add default user for live mode and
   5.171 -# mount an eventual /home partition.
   5.172 -/etc/init.d/i18n.sh
   5.173 -/etc/init.d/user-home.sh
   5.174 -
   5.175 -# Requested screen is not text mode and keymap.conf is empty so go
   5.176 -# for an i18n configuration in GUI mode. In cas of screen=text we
   5.177 -# configure locale and keymap just after via i18n.sh
   5.178 -#if [ "$SCREEN" != "text" -a ! -s "/etc/keymap.conf" -a -x /usr/bin/Xorg ]; then
   5.179 -#	DISPLAY=:1 tazbox boot
   5.180 -#fi
   5.181 -
   5.182 -[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo
   5.183 -
   5.184 -# Now that we have a keymap configuration we can auto configure Xorg.
   5.185 -# We need to set $HOME.
   5.186 -if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
   5.187 -	echo "Configuring Xorg..."
   5.188 -	HOME=/root
   5.189 -	tazx config-xorg
   5.190 -fi
   5.191 -
   5.192 -# Here we finish bootsplash since we start Xorg session.
   5.193 -[ "$FBSPLASH" == "yes" ] && sleep 1 && echo "exit" > /etc/fbsplash/fifo
   5.194 -
   5.195 -# No text mode requested, we have i18n and Xorg settings as well as a 
   5.196 -# user, so start a desktop and let boot process finih in backgroud.
   5.197 -if [ "$SCREEN" != "text" -a -x /etc/init.d/slim ]; then
   5.198 -	/etc/init.d/slim start
   5.199 -fi
   5.200 -
   5.201 -# Auto recharge packages list (after network connection of course)
   5.202 -[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge &
   5.203 -
   5.204  # Start all scripts specified with $RUN_SCRIPTS.
   5.205  echo "Executing all initialization scripts..."
   5.206  for script in $RUN_SCRIPTS
   5.207 @@ -303,6 +253,12 @@
   5.208  	fi
   5.209  done
   5.210  
   5.211 +[ "$FBSPLASH" == "yes" ] && echo "90" > /etc/fbsplash/fifo
   5.212 +
   5.213 +# Re-source main config file. In Live mode, daemons list can be modified
   5.214 +# by boot options (screen=text will remove slim).
   5.215 +. /etc/rcS.conf
   5.216 +
   5.217  # Start all daemons specified with $RUN_DAEMONS.
   5.218  echo "Starting all daemons specified in /etc/rcS.conf..."
   5.219  for daemon in $RUN_DAEMONS
   5.220 @@ -312,6 +268,8 @@
   5.221  	fi
   5.222  done
   5.223  
   5.224 +[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo
   5.225 +
   5.226  # Back to a verbose mode.
   5.227  echo "7 4 1 7" > /proc/sys/kernel/printk
   5.228  
   5.229 @@ -325,5 +283,6 @@
   5.230  time=$((`date +%s` - $bootdate))
   5.231  echo $time > /var/log/boot-time
   5.232  echo "SliTaz boot time: ${time}s"
   5.233 +[ "$FBSPLASH" == "yes" ] && echo "exit" > /etc/fbsplash/fifo
   5.234  
   5.235  fi # logged
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/etc/init.d/system.sh	Mon May 16 00:32:16 2011 +0200
     6.3 @@ -0,0 +1,150 @@
     6.4 +#!/bin/sh
     6.5 +# /etc/init.d/system.sh - SliTaz hardware configuration.
     6.6 +#
     6.7 +# This script configures the sound card and screen. Tazhw is used earlier
     6.8 +# at boot time to autoconfigure PCI and USB devices. It also configure
     6.9 +# system language, keyboarf and TZ in live mode.
    6.10 +#
    6.11 +. /etc/init.d/rc.functions
    6.12 +
    6.13 +# Parse cmdline args for boot options (See also rcS and bootopts.sh).
    6.14 +XARG=""
    6.15 +for opt in $(cat /proc/cmdline)
    6.16 +do
    6.17 +	case $opt in
    6.18 +		sound=*)
    6.19 +			DRIVER=${opt#sound=} ;;
    6.20 +		xarg=*)
    6.21 +			XARG="$XARG ${opt#xarg=}" ;;
    6.22 +		screen=text)
    6.23 +				SCREEN=text
    6.24 +				# Disable X.
    6.25 +				echo -n "Disabling X login manager: slim..."
    6.26 +				. /etc/rcS.conf
    6.27 +				RUN_DAEMONS=$(echo $RUN_DAEMONS | sed s/' slim'/''/)
    6.28 +				sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
    6.29 +				status ;;
    6.30 +		screen=*)
    6.31 +			SCREEN=${opt#screen=} ;;
    6.32 +		*)
    6.33 +			continue ;;
    6.34 +	esac
    6.35 +done
    6.36 +
    6.37 +# Sound configuration stuff. First check if sound=no and remove all
    6.38 +# sound Kernel modules.
    6.39 +if [ -n "$DRIVER" ]; then
    6.40 +	case "$DRIVER" in
    6.41 +	no)
    6.42 +		echo -n "Removing all sound kernel modules..."
    6.43 +		rm -rf /lib/modules/`uname -r`/kernel/sound
    6.44 +		status
    6.45 +		echo -n "Removing all sound packages..."
    6.46 +		for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    6.47 +			pkg=${i#/var/lib/tazpkg/installed/}
    6.48 +			echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    6.49 +		done
    6.50 +		for i in alsa-lib mhwaveedit asunder libcddb ; do
    6.51 +			echo 'y' | tazpkg remove $i > /dev/null
    6.52 +		done
    6.53 +		status ;;
    6.54 +	noconf)
    6.55 +		echo "Sound configuration was disabled from cmdline..." ;;
    6.56 +	*)
    6.57 +		if [ -x /usr/sbin/soundconf ]; then
    6.58 +			echo "Using sound kernel module $DRIVER..."
    6.59 +			/usr/sbin/soundconf -M $DRIVER
    6.60 +		fi ;;
    6.61 +	esac
    6.62 +# Sound card may already be detected by PCI-detect.
    6.63 +elif [ -d /proc/asound ]; then
    6.64 +	# Restore sound config for installed system.
    6.65 +	if [ -s /etc/asound.state ]; then
    6.66 +		echo -n "Restoring last alsa configuration..."
    6.67 +		alsactl restore
    6.68 +		status
    6.69 +	else
    6.70 +		/usr/sbin/setmixer
    6.71 +	fi
    6.72 +	# Start soundconf to config driver and load module for Live mode
    6.73 +	# if not yet detected.
    6.74 +	/usr/bin/amixer >/dev/null || /usr/sbin/soundconf
    6.75 +else
    6.76 +	echo "Unable to configure sound card."
    6.77 +fi
    6.78 +
    6.79 +# Start TazPanel
    6.80 +[ -x /usr/bin/tazpanel ] && tazpanel start
    6.81 +
    6.82 +# Auto recharge packages list (after network connection of course)
    6.83 +[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge &
    6.84 +
    6.85 +# Locale config. Do a gui config for both lang/keymap.
    6.86 +echo "Checking if /etc/locale.conf exists... "
    6.87 +if [ ! -s "/etc/locale.conf" ]; then
    6.88 +	if [ "$SCREEN" != "text" ] && [ -x /usr/bin/Xorg ]; then
    6.89 +		echo "GUI configuration starting..."
    6.90 +		DISPLAY=:1 tazbox boot
    6.91 +	else
    6.92 +		tazlocale
    6.93 +	fi
    6.94 +else
    6.95 +	echo -n "Locale configuration: $(cat /etc/locale.conf)" && status
    6.96 +fi
    6.97 +
    6.98 +# Keymap config.
    6.99 +if [ -s "/etc/keymap.conf" ]; then
   6.100 +	KEYMAP=$(cat /etc/keymap.conf)
   6.101 +	echo "Keymap configuration: $KEYMAP"
   6.102 +	if [ -x /bin/loadkeys ]; then
   6.103 +		loadkeys $KEYMAP
   6.104 +	else
   6.105 +		loadkmap < /usr/share/kmap/$KEYMAP.kmap
   6.106 +	fi
   6.107 +else
   6.108 +	tazkeymap
   6.109 +fi
   6.110 +
   6.111 +# Timezone config. Set timezone using the keymap config for fr, be, fr_CH
   6.112 +# and ca with Montreal.
   6.113 +if [ ! -s "/etc/TZ" ]; then
   6.114 +	map=$(cat /etc/keymap.conf)
   6.115 +	case "$map" in
   6.116 +		fr-latin1|be-latin1)
   6.117 +			echo "Europe/Paris" > /etc/TZ ;;
   6.118 +		fr_CH-latin1|de_CH-latin1)
   6.119 +			echo "Europe/Zurich" > /etc/TZ ;;
   6.120 +		cf)
   6.121 +			echo "America/Montreal" > /etc/TZ ;;
   6.122 +		*)
   6.123 +			echo "UTC" > /etc/TZ ;;
   6.124 +	esac
   6.125 +fi
   6.126 +
   6.127 +# Xorg auto configuration.
   6.128 +if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
   6.129 +	echo "Configuring Xorg..."
   6.130 +	# $HOME is not yet set.
   6.131 +	HOME=/root
   6.132 +	sed -i 's|/usr/bin/Xvesa|/usr/bin/Xorg|' /etc/slim.conf
   6.133 +	sed -i s/"^xserver_arguments"/'\#xserver_arguments'/ /etc/slim.conf
   6.134 +	tazx config-xorg 2>/var/log/xorg.configure.log
   6.135 +fi
   6.136 +
   6.137 +# Start X sesssion as soon as possible in Live/frugal mode. HD install
   6.138 +# can use FAST_BOOT_X wich start X even before. In live mode we need
   6.139 +# keymap config for Xorg configuration and a working Xorg config.
   6.140 +if [ "$SCREEN" != "text" ] && [ -x /usr/bin/slim ]; then
   6.141 +	if fgrep -q root=/dev/null /proc/cmdline; then
   6.142 +		/etc/init.d/slim start
   6.143 +	fi
   6.144 +fi
   6.145 +
   6.146 +# Firefox hack to get the right locale.
   6.147 +if fgrep -q "fr_" /etc/locale.conf; then
   6.148 +	# But is the fox installed ?
   6.149 +	if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then
   6.150 +		. /var/lib/tazpkg/installed/firefox/receipt
   6.151 +		sed -i 's/en-US/fr/' /etc/firefox/pref/firefox-l10n.js
   6.152 +	fi
   6.153 +fi
     7.1 --- a/etc/init.d/user-home.sh	Sat Apr 30 21:10:06 2011 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,103 +0,0 @@
     7.4 -#!/bin/sh
     7.5 -# /etc/init.d/user.sh - SliTaz default user for live mode and /home.
     7.6 -#
     7.7 -# This script is called from the main boot script /etc/init/rcS
     7.8 -# to add a user for live mode and mount /home before we start Slim
     7.9 -# since we need a user to autologin and provide a desktop
    7.10 -#
    7.11 -# Default user account without password (uid=1000). In live mode the option
    7.12 -# user=name can be used, but user must be added before home= to have home dir.
    7.13 -# This option is not handled by a loop and case like others and has no
    7.14 -# effect on an installed system.
    7.15 -#
    7.16 -. /etc/init.d/rc.functions
    7.17 -
    7.18 -if ! grep -q "100[0-9]:100[0-9]" /etc/passwd; then
    7.19 -	if grep -q "user=" /proc/cmdline; then
    7.20 -		USER=`cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/'`
    7.21 -		# Avoid usage of an existing system user or root.
    7.22 -		if grep -q ^$USER /etc/passwd; then
    7.23 -			USER=tux
    7.24 -		fi
    7.25 -	else
    7.26 -		USER=tux
    7.27 -	fi
    7.28 -	echo -n "Configuring user and group: $USER..."
    7.29 -	adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER
    7.30 -	passwd -d $USER >/dev/null
    7.31 -	status
    7.32 -	# Audio and cdrom group.
    7.33 -	addgroup $USER audio
    7.34 -	addgroup $USER cdrom
    7.35 -	addgroup $USER video
    7.36 -	addgroup $USER tty
    7.37 -	# Slim default user.
    7.38 -	if [ -f /etc/slim.conf ]; then
    7.39 -		sed -i s/"default_user .*"/"default_user        $USER"/\
    7.40 -			/etc/slim.conf
    7.41 -	fi
    7.42 -fi
    7.43 -
    7.44 -# Check for a specified home partition (home=*) and check for
    7.45 -# user home dir. Note: home=usb is a shorter and easier way to
    7.46 -# have home=/dev/sda1.
    7.47 -#
    7.48 -if grep -q "home=" /proc/cmdline; then
    7.49 -	DEVICE=${opt#home=}
    7.50 -	[ "$DEVICE" = "usb" ] && DEVICE=sda1
    7.51 -	echo "Home has been specified to $DEVICE..."
    7.52 -	DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    7.53 -	if [ -z "$DEVID" ]; then
    7.54 -		USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
    7.55 -		USBDELAY=$((2+$USBDELAY))
    7.56 -		echo "Sleeping $USBDELAY s to let the kernel detect the device... "
    7.57 -		sleep $USBDELAY
    7.58 -	fi
    7.59 -	USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'`
    7.60 -	DEVID=$DEVICE
    7.61 -	if [ -x /sbin/blkid ]; then
    7.62 -		# Can be a label, uuid, type or devname. DEVID gives us first: /dev/name.
    7.63 -		DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    7.64 -	fi
    7.65 -	DEVID=${DEVID##*/}
    7.66 -	if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
    7.67 -		echo "Mounting /home on /dev/$DEVID... "
    7.68 -		[ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files
    7.69 -		mount /dev/$DEVID /home -o uid=1000,gid=1000 2>/dev/null \
    7.70 -			|| mount /dev/$DEVID /home
    7.71 -		# Check if swap file must be generated in /home: swap=size (Mb).
    7.72 -		# This option is only used within home=device.
    7.73 -		if grep -q "swap=[1-9]*" /proc/cmdline; then
    7.74 -			SWAP_SIZE=`sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline`
    7.75 -			# DD to gen a virtual disk.
    7.76 -			echo "Generating swap file: /home/swap ($SWAP_SIZE)..."
    7.77 -			dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE
    7.78 -			# Make the Linux swap filesystem.
    7.79 -			mkswap /home/swap
    7.80 -			add_swap_in_fstab /home/swap
    7.81 -		fi
    7.82 -	else
    7.83 -		echo "Unable to find $DEVICE... "
    7.84 -	fi
    7.85 -	# Move all user dir if needed.
    7.86 -	if [ ! -d "/home/$USER" ] ; then
    7.87 -		mv /tmp/$USER-files /home/$USER
    7.88 -		chown -R $USER.users /home/$USER
    7.89 -	else
    7.90 -		rm -rf /tmp/$USER-files
    7.91 -	fi
    7.92 -	# Install all packages in /home/boot/packages. In live CD and
    7.93 -	# USB mode the option home= mounts the device on /home, so we
    7.94 -	# already have a boot directory with the Kernel and rootfs.
    7.95 -	if [ -d "/home/boot/packages" ]; then
    7.96 -		for pkg in /home/boot/packages/*.tazpkg
    7.97 -		do
    7.98 -			tazpkg install $pkg
    7.99 -		done
   7.100 -	fi
   7.101 -	# We can have custom files in /home/boot/rootfs to overwrite
   7.102 -	# the one packed into the Live system.
   7.103 -	if [ -d "/home/boot/rootfs" ]; then
   7.104 -		cp -a /home/boot/rootfs/* /
   7.105 -	fi
   7.106 -fi
     8.1 --- a/etc/rcS.conf	Sat Apr 30 21:10:06 2011 +0000
     8.2 +++ b/etc/rcS.conf	Mon May 16 00:32:16 2011 +0200
     8.3 @@ -18,7 +18,7 @@
     8.4  # then dbus, hald and slim can be removed from RUN_DAEMONS.
     8.5  FAST_BOOT_X="no"
     8.6  
     8.7 -# Graphical boot with fbsplash (To easily configure use: tazfbsplash).
     8.8 +# Graphical boot with fbsplash (To easily configure use: tazfbsplash)
     8.9  FBSPLASH="no"
    8.10  FBSPLASH_THEME="slitaz"
    8.11  
    8.12 @@ -29,7 +29,7 @@
    8.13  # Kernel modules to automatically load at boot time if not automatically
    8.14  # detected. You can use 'modprobe -l' to get a list of all kernel modules
    8.15  # available.
    8.16 -LOAD_MODULES=" "
    8.17 +LOAD_MODULES=""
    8.18  
    8.19  # Automatically recharge packages list on each boot and in background.
    8.20  # If new packages or upgrades are available they will be notified with
    8.21 @@ -38,16 +38,16 @@
    8.22  RECHARGE_PACKAGES_LIST="no"
    8.23  
    8.24  # Initialization scripts to run at boot time. Boot order is important:
    8.25 -# bootopts.sh (boot options) must start first, hwconf.sh after network.sh (tazx
    8.26 -# needs an active connection to install Xorg), then you are free to choose.
    8.27 -# Note that the local.sh script exists to let you quickly add some local startup
    8.28 -# commands.
    8.29 -RUN_SCRIPTS="bootopts.sh network.sh hwconf.sh local.sh"
    8.30 +# bootopts.sh (boot options) must start first, system.sh after network.sh
    8.31 +# (tazx needs an active connection to install Xorg), then you are free 
    8.32 +# to choose. Note that the local.sh script exists to let you quickly add
    8.33 +# some local startup commands.
    8.34 +RUN_SCRIPTS="bootopts.sh network.sh system.sh local.sh"
    8.35  
    8.36  # Daemons to start at boot time. SliTaz only provides a few daemons: firewall,
    8.37  # Web server (lighttpd), SSH server (dropbear) and rsyncd, so boot order is
    8.38  # not really important, but dbus/hald should be started before slim.
    8.39 -RUN_DAEMONS="firewall tazpanel"
    8.40 +RUN_DAEMONS="dbus hald slim firewall httpd"
    8.41  
    8.42  # Pre login bold message.
    8.43  MESSAGE="Welcome to your box."