slitaz-boot-scripts rev 32

Fix home=*, screen=text and swap opt only with home=*
author Christophe Lincoln <pankso@slitaz.org>
date Sat Feb 23 19:10:03 2008 +0100 (2008-02-23)
parents 7bcff1537b8a
children 7c50c87a68f4
files etc/init.d/bootopts.sh etc/init.d/hwconf.sh etc/init.d/rcS
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Sat Feb 23 11:59:48 2008 +0100
     1.2 +++ b/etc/init.d/bootopts.sh	Sat Feb 23 19:10:03 2008 +0100
     1.3 @@ -16,7 +16,7 @@
     1.4  		#can be label, uuid or devname
     1.5  		DEVID=`/sbin/blkid | grep $DEVICE | cut -d: -f1`
     1.6  	fi
     1.7 -	if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
     1.8 +	if [ -n "$DEVID" ] && grep -q "$DEVICE" /proc/partitions ; then
     1.9  		echo "Mounting /home on /dev/$DEVID... "
    1.10  		mv /home/hacker /tmp/hacker-home
    1.11  		mount -o uid=500,gid=500 /dev/$DEVID /home
    1.12 @@ -32,6 +32,20 @@
    1.13  	fi
    1.14  }
    1.15  
    1.16 +# Check if swap file must be generated in /home: swap=size (Mb).
    1.17 +# This option is used with home=device.
    1.18 +gen_home_swap()
    1.19 +{
    1.20 +	if grep -q "swap=[1-9]*" /proc/cmdline; then
    1.21 +		SWAP_SIZE=`cat /proc/cmdline | sed 's/.*swap=\([^ ]*\).*/\1/'`
    1.22 +		# DD to gen a virtual disk.
    1.23 +		echo "Generating swap file: /home/swap ($SWAP_SIZE)..."
    1.24 +		dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE
    1.25 +		# Make the Linux swap filesystem.
    1.26 +		mkswap /home/swap
    1.27 +	fi
    1.28 +}
    1.29 +
    1.30  # Parse /proc/cmdline with grep.
    1.31  #
    1.32  
    1.33 @@ -42,21 +56,11 @@
    1.34  if grep -q "home=usb" /proc/cmdline; then
    1.35  	DEVICE=sda1
    1.36  	mount_home
    1.37 +	gen_home_swap
    1.38  elif grep -q "home=" /proc/cmdline; then
    1.39  	DEVICE=`cat /proc/cmdline | sed 's/.*home=\([^ ]*\).*/\1/'`
    1.40  	mount_home
    1.41 -fi
    1.42 -
    1.43 -# Check if swap file must be generated: swap=size (Mb).
    1.44 -#
    1.45 -if grep -q "swap=[1-9]*" /proc/cmdline; then
    1.46 -	SWAP_SIZE=`cat /proc/cmdline | sed 's/.*swap=\([^ ]*\).*/\1/'`
    1.47 -	# DD to gen a virtual disk.
    1.48 -	echo -n "Generating swap file: /home/swap ($SWAP_SIZE)..."
    1.49 -	dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE 2>/dev/null
    1.50 -	status
    1.51 -	# Make the Linux swap filesystem.
    1.52 -	mkswap /home/swap
    1.53 +	gen_home_swap
    1.54  fi
    1.55  
    1.56  # Active an eventual swap file in /home and on local hd.
    1.57 @@ -99,6 +103,9 @@
    1.58  		echo -n "Disabling X login manager: slim..."
    1.59  		sed -i s/'slim'/''/ /etc/rcS.conf
    1.60  		status
    1.61 +		# Creat /etc/X11/screen.conf to avoid tazx execution by hwconf.sh
    1.62 +		mkdir -p /etc/X11
    1.63 +		echo 'SCREEN=1024x768x24' > /etc/X11/screen.conf
    1.64  	else
    1.65  		echo "Option not yet implemented: screen=$SCREEN"
    1.66  		sleep 2
     2.1 --- a/etc/init.d/hwconf.sh	Sat Feb 23 11:59:48 2008 +0100
     2.2 +++ b/etc/init.d/hwconf.sh	Sat Feb 23 19:10:03 2008 +0100
     2.3 @@ -41,6 +41,6 @@
     2.4  fi
     2.5  
     2.6  # Screen size config for slim/Xvesa.
     2.7 -if [ ! -f /etc/X11/screen.conf -a -e /usr/bin/slim ]; then
     2.8 +if [ ! -f /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
     2.9  	tazx
    2.10  fi
     3.1 --- a/etc/init.d/rcS	Sat Feb 23 11:59:48 2008 +0100
     3.2 +++ b/etc/init.d/rcS	Sat Feb 23 19:10:03 2008 +0100
     3.3 @@ -133,14 +133,22 @@
     3.4  echo "Executing all initialisation scripts..."
     3.5  for script in $RUN_SCRIPTS
     3.6  do
     3.7 -	/etc/init.d/$script
     3.8 +	if [ -x /etc/init.d/$daemon ]; then
     3.9 +		/etc/init.d/$script
    3.10 +	fi
    3.11  done
    3.12  
    3.13 +# Re-source main config file, in Live mode daemons list ca be modified 
    3.14 +# by boot options.
    3.15 +. /etc/rcS.conf
    3.16 +
    3.17  # Start all daemons specified with $RUN_DAEMONS.
    3.18  echo "Starting all daemons specified in /etc/rcS.conf..."
    3.19  for daemon in $RUN_DAEMONS
    3.20  do
    3.21 -	/etc/init.d/$daemon start
    3.22 +	if [ -x /etc/init.d/$daemon ]; then
    3.23 +		/etc/init.d/$daemon start
    3.24 +	fi
    3.25  done
    3.26  
    3.27  # Reset screen and display a bold message.