slitaz-boot-scripts 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 1ebe324e953a
children 49f03c9f0fd8
files etc/init.d/bootopts.sh etc/init.d/hwconf.sh etc/init.d/i18n.sh etc/init.d/rcS etc/init.d/user-home.sh etc/rcS.conf
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Wed Apr 06 16:18:42 2011 +0100
     1.2 +++ b/etc/init.d/bootopts.sh	Fri Apr 29 16:06:08 2011 +0200
     1.3 @@ -37,15 +37,8 @@
     1.4  	addgroup $USER video
     1.5  	addgroup $USER tty
     1.6  	# /home/$USER files from /etc/skel.
     1.7 -	if [ -d /home/$USER ]; then
     1.8 -		# Path for user desktop files.
     1.9 -		for i in /home/$USER/.local/share/applications/*.desktop
    1.10 -		do
    1.11 -			sed -i s/"user_name"/"$USER"/g $i
    1.12 -		done
    1.13 -	else
    1.14 -		mkdir -p /home/$USER
    1.15 -	fi
    1.16 +	# make user be only read/write by user
    1.17 +	chmod -R 700 /home/$USER
    1.18  	# Slim default user.
    1.19  	if [ -f /etc/slim.conf ]; then
    1.20  		sed -i s/"default_user .*"/"default_user        $USER"/\
    1.21 @@ -62,86 +55,6 @@
    1.22  		eject)
    1.23  			# Eject cdrom.
    1.24  			eject /dev/cdrom ;;
    1.25 -		autologin)
    1.26 -			# Autologin option to skip first graphic login prompt.
    1.27 -			echo "auto_login        yes" >> /etc/slim.conf ;;
    1.28 -		lang=*)
    1.29 -			# Check for a specified locale (lang=*).
    1.30 -			LANG=${opt#lang=}
    1.31 -			echo -n "Setting system locale to: $LANG... "
    1.32 -			echo "LANG=$LANG" > /etc/locale.conf
    1.33 -			echo "LC_ALL=$LANG" >> /etc/locale.conf
    1.34 -			[ ! -d /usr/lib/locale/$LANG ] && localedef \
    1.35 -				-i $LANG -c -f UTF-8 /usr/lib/locale/$LANG &
    1.36 -			tazlocale link-files
    1.37 -			status ;;
    1.38 -		kmap=*)
    1.39 -			# Check for a specified keymap (kmap=*).
    1.40 -			KEYMAP=${opt#kmap=}
    1.41 -			echo -n "Setting system keymap to: $KEYMAP..."
    1.42 -			echo "$KEYMAP" > /etc/keymap.conf
    1.43 -			status ;;
    1.44 -		home=*)
    1.45 -			# Check for a specified home partition (home=*) and check for
    1.46 -			# user home dir. Note: home=usb is a shorter and easier way to
    1.47 -			# have home=/dev/sda1.
    1.48 -			DEVICE=${opt#home=}
    1.49 -			[ "$DEVICE" = "usb" ] && DEVICE=sda1
    1.50 -			echo "Home has been specified to $DEVICE..."
    1.51 -			DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    1.52 -			if [ -z "$DEVID" ]; then
    1.53 -				USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
    1.54 -				USBDELAY=$((2+$USBDELAY))
    1.55 -				echo "Sleeping $USBDELAY s to let the kernel detect the device... "
    1.56 -				sleep $USBDELAY
    1.57 -			fi
    1.58 -			USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'`
    1.59 -			DEVID=$DEVICE
    1.60 -			if [ -x /sbin/blkid ]; then
    1.61 -				# Can be a label, uuid, type or devname. DEVID gives us first: /dev/name.
    1.62 -				DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    1.63 -			fi
    1.64 -			DEVID=${DEVID##*/}
    1.65 -			if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
    1.66 -				echo "Mounting /home on /dev/$DEVID... "
    1.67 -				[ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files
    1.68 -				mount /dev/$DEVID /home -o uid=1000,gid=1000 2>/dev/null \
    1.69 -					|| mount /dev/$DEVID /home
    1.70 -				# Check if swap file must be generated in /home: swap=size (Mb).
    1.71 -				# This option is only used within home=device.
    1.72 -				if grep -q "swap=[1-9]*" /proc/cmdline; then
    1.73 -					SWAP_SIZE=`sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline`
    1.74 -					# DD to gen a virtual disk.
    1.75 -					echo "Generating swap file: /home/swap ($SWAP_SIZE)..."
    1.76 -					dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE
    1.77 -					# Make the Linux swap filesystem.
    1.78 -					mkswap /home/swap
    1.79 -					add_swap_in_fstab /home/swap
    1.80 -				fi
    1.81 -			else
    1.82 -				echo "Unable to find $DEVICE... "
    1.83 -			fi
    1.84 -			# Move all user dir if needed.
    1.85 -			if [ ! -d "/home/$USER" ] ; then
    1.86 -				mv /tmp/$USER-files /home/$USER
    1.87 -				chown -R $USER.users /home/$USER
    1.88 -			else
    1.89 -				rm -rf /tmp/$USER-files
    1.90 -			fi
    1.91 -			# Install all packages in /home/boot/packages. In live CD and
    1.92 -			# USB mode the option home= mounts the device on /home, so we
    1.93 -			# already have a boot directory with the Kernel and rootfs.
    1.94 -			if [ -d "/home/boot/packages" ]; then
    1.95 -				for pkg in /home/boot/packages/*.tazpkg
    1.96 -				do
    1.97 -					tazpkg install $pkg
    1.98 -				done
    1.99 -			fi
   1.100 -			# We can have custom files in /home/boot/rootfs to overwrite
   1.101 -			# the one packed into the Live system.
   1.102 -			if [ -d "/home/boot/rootfs" ]; then
   1.103 -				cp -a /home/boot/rootfs/* /
   1.104 -			fi ;;
   1.105  		laptop)
   1.106  			# Laptop option to load related Kernel modules.
   1.107  			echo "Loading laptop modules: ac, battery, fan, yenta_socket..."
   1.108 @@ -182,29 +95,11 @@
   1.109  				status
   1.110  				/packages/install.sh
   1.111  			fi ;;
   1.112 -		wm=*)
   1.113 -			# Check for a Window Manager (for a flavor, default WM can be changed
   1.114 -			# with boot options or with an addfile in /etc/X11/wm.default.
   1.115 -			WM=${opt#wm=}
   1.116 -			mkdir -p /etc/X11
   1.117 -			case $WM in
   1.118 -				jwm)
   1.119 -					echo "jwm" > /etc/X11/wm.default ;;
   1.120 -				ob|openbox|openbox-session)
   1.121 -					echo "openbox" > /etc/X11/wm.default ;;
   1.122 -				e17|enlightenment|enlightenment_start)
   1.123 -					echo "enlightenment" > /etc/X11/wm.default ;;
   1.124 -			esac ;;
   1.125  		*)
   1.126  			continue ;;
   1.127  	esac
   1.128  done
   1.129  
   1.130 -# If no default WM fallback to Openbox (we never know).
   1.131 -if [ ! -f /etc/X11/wm.default ]; then
   1.132 -	echo "openbox" > /etc/X11/wm.default
   1.133 -fi
   1.134 -
   1.135  # Activate an eventual swap file or partition.
   1.136  if [ "`fdisk -l | grep swap`" ]; then
   1.137  	for SWAP_DEV in `fdisk -l | sed '/swap/!d;s/ .*//'`; do
     2.1 --- a/etc/init.d/hwconf.sh	Wed Apr 06 16:18:42 2011 +0100
     2.2 +++ b/etc/init.d/hwconf.sh	Fri Apr 29 16:06:08 2011 +0200
     2.3 @@ -71,58 +71,3 @@
     2.4  else
     2.5  	echo "Unable to configure sound card."
     2.6  fi
     2.7 -
     2.8 -# Xorg auto configuration.
     2.9 -if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
    2.10 -	echo "Configuring Xorg..."
    2.11 -	# $HOME is not yet set.
    2.12 -	HOME=/root
    2.13 -	sed -i 's|/usr/bin/Xvesa|/usr/bin/Xorg|' /etc/slim.conf
    2.14 -	sed -i s/"^xserver_arguments"/'\#xserver_arguments'/ /etc/slim.conf
    2.15 -	tazx config-xorg
    2.16 -fi
    2.17 -
    2.18 -# Screen size config for slim/Xvesa (last config dialog before login).
    2.19 -#
    2.20 -# NOTE: Xvesa is unmaintained, package will be removed and all related
    2.21 -# code cleaned
    2.22 -#
    2.23 -if [ "$SCREEN" != "text" -a ! -s /etc/X11/screen.conf -a -x /usr/bin/Xvesa ]; then
    2.24 -	# $HOME is not yet set.
    2.25 -	HOME=/root
    2.26 -	if [ -n "$XARG" ]; then
    2.27 -		# Add an extra argument to xserver_arguments (xarg=-2button)
    2.28 -		sed -i "s| -screen|$XARG -screen|" /etc/slim.conf
    2.29 -	fi
    2.30 -	if [ -n "$SCREEN" ]; then
    2.31 -		case "$SCREEN" in
    2.32 -			text)
    2.33 -				# Disable X.
    2.34 -				echo -n "Disabling X login manager: slim..."
    2.35 -				. /etc/rcS.conf
    2.36 -				RUN_DAEMONS=`echo $RUN_DAEMONS | sed s/' slim'/''/`
    2.37 -				sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
    2.38 -				status ;;
    2.39 -			auto)
    2.40 -				# Auto detect screen resolution.
    2.41 -				export NEW_SCREEN=`Xvesa -listmodes 2>&1 | grep ^0x | \
    2.42 -					awk '{ printf "%s %s\n",$2 }' \
    2.43 -					| sort -nr | grep x[1-2][4-6] | head -n 1`
    2.44 -				tazx `cat /etc/X11/wm.default` ;;
    2.45 -			1024x600*|800x480*)
    2.46 -				set -- $(echo $SCREEN | sed 's/x/ /g')
    2.47 -				915resolution -l 2>/dev/null | \
    2.48 -				grep " ${1}x" | awk -v h=$1 -v v=$2 \
    2.49 -				'END {system("915resolution " $2 " " h " " v)}'
    2.50 -				# Use specified screen resolution.
    2.51 -				export NEW_SCREEN=$SCREEN
    2.52 -				tazx `cat /etc/X11/wm.default` ;;
    2.53 -			*)
    2.54 -				# Use specified screen resolution.
    2.55 -				export NEW_SCREEN=$SCREEN
    2.56 -				tazx `cat /etc/X11/wm.default` ;;
    2.57 -		esac
    2.58 -	else
    2.59 -		tazx `cat /etc/X11/wm.default`
    2.60 -	fi
    2.61 -fi
     3.1 --- a/etc/init.d/i18n.sh	Wed Apr 06 16:18:42 2011 +0100
     3.2 +++ b/etc/init.d/i18n.sh	Fri Apr 29 16:06:08 2011 +0200
     3.3 @@ -6,22 +6,21 @@
     3.4  . /etc/init.d/rc.functions
     3.5  
     3.6  # Locale config.
     3.7 -echo "Checking if /etc/locale.conf exists... "
     3.8  if [ -s "/etc/locale.conf" ]; then
     3.9 -	echo -n "Locale configuration file exists... "
    3.10 -	status
    3.11 +	. /etc/locale.conf
    3.12 +	echo -n "Locale configuration: $LANG" && status
    3.13  else
    3.14  	tazlocale
    3.15  fi
    3.16  
    3.17  # Keymap config.
    3.18  if [ -s "/etc/keymap.conf" ]; then
    3.19 -	KEYMAP=`cat /etc/keymap.conf`
    3.20 -	echo "Keymap configuration: $KEYMAP"
    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 +		loadkeys $keymap
    3.26  	else
    3.27 -		loadkmap < /usr/share/kmap/$KEYMAP.kmap
    3.28 +		loadkmap < /usr/share/kmap/$keymap.kmap
    3.29  	fi
    3.30  else
    3.31  	tazkeymap
    3.32 @@ -30,8 +29,8 @@
    3.33  # Timezone config. Set timezone using the keymap config for fr, be, fr_CH
    3.34  # and ca with Montreal.
    3.35  if [ ! -s "/etc/TZ" ]; then
    3.36 -	KEYMAP=`cat /etc/keymap.conf`
    3.37 -	case "$KEYMAP" in
    3.38 +	keymap=`cat /etc/keymap.conf`
    3.39 +	case "$keymap" in
    3.40  		fr-latin1|be-latin1)
    3.41  			echo -n "Setting timezone to Europe/Paris... "
    3.42  			echo "Europe/Paris" > /etc/TZ && status
    3.43 @@ -51,46 +50,3 @@
    3.44  	esac
    3.45  fi
    3.46  
    3.47 -# Firefox hack to get the right locale.
    3.48 -if grep -q "fr_*" /etc/locale.conf; then
    3.49 -	# But is the fox installed ?
    3.50 -	if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then
    3.51 -		. /var/lib/tazpkg/installed/firefox/receipt
    3.52 -		sed -i 's/en-US/fr/' /etc/firefox/pref/firefox-l10n.js
    3.53 -	fi
    3.54 -fi
    3.55 -
    3.56 -# Gen a motd in french if fr_* or in English by default.
    3.57 -if [ ! -s "/etc/motd" ]; then
    3.58 -if grep -q "fr_*" /etc/locale.conf; then
    3.59 -		# FR
    3.60 -		cat > /etc/motd << "EOF"
    3.61 -
    3.62 -
    3.63 -  (°-  { Documentation dans /usr/share/doc. Utiliser 'less -EM' pour,
    3.64 -  //\    lire des fichiers, devenir root avec 'su' et éditer avec 'nano'.
    3.65 -  v_/_   Taper 'startx' pour lancer une session X. }
    3.66 -
    3.67 -  SliTaz GNU/Linux est distribuée dans l'espoir qu'elle sera utile, mais
    3.68 -  alors SANS AUCUNE GARANTIE.
    3.69 -
    3.70 -
    3.71 -EOF
    3.72 -	else
    3.73 -		# EN
    3.74 -		cat > /etc/motd << "EOF"
    3.75 -
    3.76 -
    3.77 -  (°-  { Documentation in /usr/share/doc. Use 'less -EM' to read files,
    3.78 -  //\    become root with 'su' and edit using 'nano'.
    3.79 -  v_/_   Type 'startx' to start a X window session. }
    3.80 -
    3.81 -  SliTaz GNU/Linux is distributed in the hope that it will be useful, but
    3.82 -  with ABSOLUTELY NO WARRANTY.
    3.83 -
    3.84 -
    3.85 -EOF
    3.86 -
    3.87 -	fi
    3.88 -
    3.89 -fi
     4.1 --- a/etc/init.d/rcS	Wed Apr 06 16:18:42 2011 +0100
     4.2 +++ b/etc/init.d/rcS	Fri Apr 29 16:06:08 2011 +0200
     4.3 @@ -29,29 +29,54 @@
     4.4  /bin/mount proc
     4.5  status
     4.6  
     4.7 -[ "$FBSPLASH" == "yes" ] && echo "10" > /etc/fbsplash/fifo
     4.8 +# Set time zone now to get system events at local time
     4.9 +if [ -s /etc/TZ ]; then
    4.10 +	export TZ=$(cat /etc/TZ)
    4.11 +fi
    4.12 +
    4.13 +[ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo
    4.14  
    4.15  # Parse cmdline args for earlier boot options. All other boot options
    4.16  # are in /etc/init./bootopts.sh.
    4.17 -echo -n "Searching for early boot options..."
    4.18 +echo "Checking for early boot options..."
    4.19  for opt in `cat /proc/cmdline`
    4.20  do
    4.21  	case $opt in
    4.22 -		fastbootx|fbx)
    4.23 -			export FAST_BOOT_X="yes" ;;
    4.24  		cdrom=*)
    4.25  			export CDROM=${opt#cdrom=} ;;
    4.26  		modprobe=*)
    4.27  			export MODPROBE="yes" ;;
    4.28  		config=*)
    4.29  			export CONFIG=${opt#config=} ;;
    4.30 +		xarg=*)
    4.31 +			XARG="$XARG ${opt#xarg=}" ;;
    4.32 +		screen=text)
    4.33 +			echo -n "Text mode option detected..."
    4.34 +			SCREEN=text
    4.35 +			status ;;
    4.36 +		screen=[0-9]*)
    4.37 +			SCREEN=${opt#screen=} ;;
    4.38 +		autologin)
    4.39 +			# Autologin option to skip first graphic login prompt.
    4.40 +			echo "auto_login        yes" >> /etc/slim.conf ;;
    4.41 +		lang=*)
    4.42 +			# Check for a specified locale (lang=*).
    4.43 +			LANG=${opt#lang=}
    4.44 +			echo -n "Setting system locale to: $LANG... "
    4.45 +			tazlocale init $LANG
    4.46 +			status ;;
    4.47 +		kmap=*)
    4.48 +			# Check for a specified keymap (kmap=*).
    4.49 +			KEYMAP=${opt#kmap=}
    4.50 +			echo -n "Setting system keymap to: $KEYMAP..."
    4.51 +			tazkeymap init $KEYMAP
    4.52 +			status ;;
    4.53  		*)
    4.54  			continue ;;
    4.55  	esac
    4.56  done
    4.57 -status
    4.58  
    4.59 -[ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo
    4.60 +[ "$FBSPLASH" == "yes" ] && echo "40" > /etc/fbsplash/fifo
    4.61  
    4.62  # Before mounting filesystems we check fs specified in the file
    4.63  # /etc/rcS.conf and variable $CHECK_FS.
    4.64 @@ -73,9 +98,6 @@
    4.65  	echo -n "Starting udev daemon..."
    4.66  	/sbin/udevd --daemon
    4.67  	status
    4.68 -	echo -n "Udevadm requesting events from the Kernel..."
    4.69 -	udevadm trigger
    4.70 -	status
    4.71  	echo -n "Udevadm waiting for the event queue to finish..."
    4.72  	udevadm settle
    4.73  	status
    4.74 @@ -84,7 +106,7 @@
    4.75  	status
    4.76  fi
    4.77  
    4.78 -[ "$FBSPLASH" == "yes" ] && echo "30" > /etc/fbsplash/fifo
    4.79 +[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo
    4.80  
    4.81  # Mount filesystems in /etc/fstab.
    4.82  echo "Mounting filesystems in fstab..."
    4.83 @@ -110,7 +132,7 @@
    4.84  	status
    4.85  fi
    4.86  
    4.87 -[ "$FBSPLASH" == "yes" ] && echo "40" > /etc/fbsplash/fifo
    4.88 +[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo
    4.89  
    4.90  # Set up tmp X11 and ICE dir.
    4.91  echo -n "Setting up tmp X11 and ICE unix dir..."
    4.92 @@ -118,15 +140,43 @@
    4.93  /bin/chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix
    4.94  status
    4.95  
    4.96 -# Fast boot into X for HD install or custom Live system. We need
    4.97 -# keymap settings since Xvesa dumps the console mapping and a correct
    4.98 -# slim configuration for screen resolution. DBUS and HAL must also start
    4.99 -# before X session (manual login or autologin) to have devices in PCmanFM.
   4.100 -if [ "$FAST_BOOT_X" = "yes" ]; then
   4.101 -	/etc/init.d/i18n.sh
   4.102 -	/etc/init.d/dbus start
   4.103 -	/etc/init.d/hald start
   4.104 -	/etc/init.d/slim start &
   4.105 +# Start DBUS and HAL deamon so we can use Xorg and a WM to configure
   4.106 +# system locale and keybord on first boot.
   4.107 +[ -x /etc/init.d/dbus ] && /etc/init.d/dbus start
   4.108 +[ -x /etc/init.d/hald ] && /etc/init.d/hald start
   4.109 +
   4.110 +# Requested screen is not text mode and keymap.conf is empty so go
   4.111 +# for an i18n configuration in GUI mode. In cas of screen=text we
   4.112 +# configure locale and keymap just after via i18n.sh
   4.113 +if [ "$SCREEN" != "text" -a ! -s "/etc/locale.conf" -a -x /usr/bin/Xorg ]; then
   4.114 +	tazbox boot
   4.115 +fi
   4.116 +
   4.117 +[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo
   4.118 +
   4.119 +# Set the console keymap and configure i18n in case of screen=text and
   4.120 +# no locale.conf or keymap.conf. Add default user for live mode and
   4.121 +# mount an eventual /home partition.
   4.122 +/etc/init.d/i18n.sh
   4.123 +/etc/init.d/user-home.sh
   4.124 +
   4.125 +[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo
   4.126 +
   4.127 +# Now that we have a keymap configuration we can auto configure Xorg.
   4.128 +# We need to set $HOME.
   4.129 +if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
   4.130 +	echo "Configuring Xorg..."
   4.131 +	HOME=/root
   4.132 +	tazx config-xorg
   4.133 +fi
   4.134 +
   4.135 +# Here we finish bootsplash since we start Xorg session.
   4.136 +[ "$FBSPLASH" == "yes" ] && sleep 1 && echo "exit" > /etc/fbsplash/fifo
   4.137 +
   4.138 +# No text mode requested, we have i18n and Xorg settings as well as a 
   4.139 +# user, so start a desktop and let boot process finih in backgroud.
   4.140 +if [ "$screen" != "text" -a -x /etc/init.d/slim ]; then
   4.141 +	/etc/init.d/slim start
   4.142  fi
   4.143  
   4.144  # Create /dev/cdrom if needed (symlink does not exist on LiveCD).
   4.145 @@ -134,7 +184,7 @@
   4.146  if [ -n "$CDROM" ]; then
   4.147  	DRIVE_NAME=${CDROM#/dev/}
   4.148  else
   4.149 -	DRIVE_NAME=`grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3`
   4.150 +	DRIVE_NAME=$(grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3)
   4.151  fi
   4.152  if [ -n "$DRIVE_NAME" -a ! "`readlink /dev/cdrom`" ]; then
   4.153  	echo -n "Creating symlink : /dev/cdrom..."
   4.154 @@ -148,6 +198,7 @@
   4.155  		>> /etc/fstab
   4.156  	status
   4.157  fi
   4.158 +
   4.159  # Chmod hack on each boot for Asunder and burnbox. Allowing all users
   4.160  # to burn/rip CD/DVD.
   4.161  if [ -n "$DRIVE_NAME" -a "`readlink /dev/cdrom`" ]; then
   4.162 @@ -158,8 +209,6 @@
   4.163  	status
   4.164  fi
   4.165  
   4.166 -[ "$FBSPLASH" == "yes" ] && echo "50" > /etc/fbsplash/fifo
   4.167 -
   4.168  # Handle kernel cmdline parameter modprobe=<module_list>
   4.169  if [ -n "$MODPROBE" ]; then
   4.170  	MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
   4.171 @@ -202,8 +251,6 @@
   4.172  	status
   4.173  fi
   4.174  
   4.175 -[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo
   4.176 -
   4.177  # Start syslogd and klogd.
   4.178  if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then
   4.179  	echo -n "Starting system log deamon: syslogd..."
   4.180 @@ -225,23 +272,14 @@
   4.181  # Be quiet on configuration to avoid messages overwriting ncurses dialog
   4.182  echo "0 0 0 0" > /proc/sys/kernel/printk
   4.183  
   4.184 -[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo
   4.185 -
   4.186  # Detect PCI and USB devices with Tazhw from slitaz-tools. We load
   4.187  # kernel modules only at first boot or in LiveCD mode.
   4.188  if [ ! -s /var/lib/detected-modules ]; then
   4.189  	/sbin/tazhw init
   4.190  fi
   4.191  
   4.192 -[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo
   4.193 -
   4.194 -# Call udevadm trigger to ensure /dev is fully populate now that all 
   4.195 -# modules are loaded.
   4.196 -if [ "$UDEV" = "yes" ]; then
   4.197 -	echo -n "Requesting events from the Kernel..."
   4.198 -	udevadm trigger
   4.199 -	status
   4.200 -fi
   4.201 +# Auto recharge packages list (after network connection of course)
   4.202 +[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge &
   4.203  
   4.204  # Start all scripts specified with $RUN_SCRIPTS.
   4.205  echo "Executing all initialization scripts..."
   4.206 @@ -252,15 +290,6 @@
   4.207  	fi
   4.208  done
   4.209  
   4.210 -[ "$FBSPLASH" == "yes" ] && echo "90" > /etc/fbsplash/fifo
   4.211 -
   4.212 -# Re-source main config file. In Live mode, daemons list can be modified
   4.213 -# by boot options (screen=text will remove slim).
   4.214 -. /etc/rcS.conf
   4.215 -
   4.216 -# Auto recharge packages list (after network connection of course)
   4.217 -[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge &
   4.218 -
   4.219  # Start all daemons specified with $RUN_DAEMONS.
   4.220  echo "Starting all daemons specified in /etc/rcS.conf..."
   4.221  for daemon in $RUN_DAEMONS
   4.222 @@ -270,8 +299,6 @@
   4.223  	fi
   4.224  done
   4.225  
   4.226 -[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo
   4.227 -
   4.228  # Back to a verbose mode.
   4.229  echo "7 4 1 7" > /proc/sys/kernel/printk
   4.230  
   4.231 @@ -285,6 +312,5 @@
   4.232  time=$((`date +%s` - $bootdate))
   4.233  echo $time > /var/log/boot-time
   4.234  echo "SliTaz boot time: ${time}s"
   4.235 -[ "$FBSPLASH" == "yes" ] && echo "exit" > /etc/fbsplash/fifo
   4.236  
   4.237  fi # logged
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/etc/init.d/user-home.sh	Fri Apr 29 16:06:08 2011 +0200
     5.3 @@ -0,0 +1,105 @@
     5.4 +#!/bin/sh
     5.5 +# /etc/init.d/user.sh - SliTaz default user for live mode and /home.
     5.6 +#
     5.7 +# This script is called from the main boot script /etc/init/rcS
     5.8 +# to add a user for live mode and mount /home before we start Slim
     5.9 +# since we need a user to autologin and provide a desktop
    5.10 +#
    5.11 +# Default user account without password (uid=1000). In live mode the option
    5.12 +# user=name can be used, but user must be added before home= to have home dir.
    5.13 +# This option is not handled by a loop and case like others and has no
    5.14 +# effect on an installed system.
    5.15 +#
    5.16 +
    5.17 +if ! grep -q "100[0-9]:100[0-9]" /etc/passwd; then
    5.18 +	if grep -q "user=" /proc/cmdline; then
    5.19 +		USER=`cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/'`
    5.20 +		# Avoid usage of an existing system user or root.
    5.21 +		if grep -q ^$USER /etc/passwd; then
    5.22 +			USER=tux
    5.23 +		fi
    5.24 +	else
    5.25 +		USER=tux
    5.26 +	fi
    5.27 +	echo -n "Configuring user and group: $USER..."
    5.28 +	adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER
    5.29 +	passwd -d $USER >/dev/null
    5.30 +	status
    5.31 +	# Audio and cdrom group.
    5.32 +	addgroup $USER audio
    5.33 +	addgroup $USER cdrom
    5.34 +	addgroup $USER video
    5.35 +	addgroup $USER tty
    5.36 +	# /home/$USER files from /etc/skel.
    5.37 +	# make user be only read/write by user
    5.38 +	chmod -R 700 /home/$USER
    5.39 +	# Slim default user.
    5.40 +	if [ -f /etc/slim.conf ]; then
    5.41 +		sed -i s/"default_user .*"/"default_user        $USER"/\
    5.42 +			/etc/slim.conf
    5.43 +	fi
    5.44 +fi
    5.45 +
    5.46 +# Check for a specified home partition (home=*) and check for
    5.47 +# user home dir. Note: home=usb is a shorter and easier way to
    5.48 +# have home=/dev/sda1.
    5.49 +#
    5.50 +if grep -q "home=" /proc/cmdline; then
    5.51 +	DEVICE=${opt#home=}
    5.52 +	[ "$DEVICE" = "usb" ] && DEVICE=sda1
    5.53 +	echo "Home has been specified to $DEVICE..."
    5.54 +	DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    5.55 +	if [ -z "$DEVID" ]; then
    5.56 +		USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
    5.57 +		USBDELAY=$((2+$USBDELAY))
    5.58 +		echo "Sleeping $USBDELAY s to let the kernel detect the device... "
    5.59 +		sleep $USBDELAY
    5.60 +	fi
    5.61 +	USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'`
    5.62 +	DEVID=$DEVICE
    5.63 +	if [ -x /sbin/blkid ]; then
    5.64 +		# Can be a label, uuid, type or devname. DEVID gives us first: /dev/name.
    5.65 +		DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    5.66 +	fi
    5.67 +	DEVID=${DEVID##*/}
    5.68 +	if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
    5.69 +		echo "Mounting /home on /dev/$DEVID... "
    5.70 +		[ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files
    5.71 +		mount /dev/$DEVID /home -o uid=1000,gid=1000 2>/dev/null \
    5.72 +			|| mount /dev/$DEVID /home
    5.73 +		# Check if swap file must be generated in /home: swap=size (Mb).
    5.74 +		# This option is only used within home=device.
    5.75 +		if grep -q "swap=[1-9]*" /proc/cmdline; then
    5.76 +			SWAP_SIZE=`sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline`
    5.77 +			# DD to gen a virtual disk.
    5.78 +			echo "Generating swap file: /home/swap ($SWAP_SIZE)..."
    5.79 +			dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE
    5.80 +			# Make the Linux swap filesystem.
    5.81 +			mkswap /home/swap
    5.82 +			add_swap_in_fstab /home/swap
    5.83 +		fi
    5.84 +	else
    5.85 +		echo "Unable to find $DEVICE... "
    5.86 +	fi
    5.87 +	# Move all user dir if needed.
    5.88 +	if [ ! -d "/home/$USER" ] ; then
    5.89 +		mv /tmp/$USER-files /home/$USER
    5.90 +		chown -R $USER.users /home/$USER
    5.91 +	else
    5.92 +		rm -rf /tmp/$USER-files
    5.93 +	fi
    5.94 +	# Install all packages in /home/boot/packages. In live CD and
    5.95 +	# USB mode the option home= mounts the device on /home, so we
    5.96 +	# already have a boot directory with the Kernel and rootfs.
    5.97 +	if [ -d "/home/boot/packages" ]; then
    5.98 +		for pkg in /home/boot/packages/*.tazpkg
    5.99 +		do
   5.100 +			tazpkg install $pkg
   5.101 +		done
   5.102 +	fi
   5.103 +	# We can have custom files in /home/boot/rootfs to overwrite
   5.104 +	# the one packed into the Live system.
   5.105 +	if [ -d "/home/boot/rootfs" ]; then
   5.106 +		cp -a /home/boot/rootfs/* /
   5.107 +	fi
   5.108 +fi
     6.1 --- a/etc/rcS.conf	Wed Apr 06 16:18:42 2011 +0100
     6.2 +++ b/etc/rcS.conf	Fri Apr 29 16:06:08 2011 +0200
     6.3 @@ -47,7 +47,7 @@
     6.4  # Daemons to start at boot time. SliTaz only provides a few daemons: firewall,
     6.5  # Web server (lighttpd), SSH server (dropbear) and rsyncd, so boot order is
     6.6  # not really important, but dbus/hald should be started before slim.
     6.7 -RUN_DAEMONS="dbus hald firewall slim"
     6.8 +RUN_DAEMONS="dbus hald firewall slim tazpanel"
     6.9  
    6.10  # Pre login bold message.
    6.11  MESSAGE="Welcome to your box."