slitaz-boot-scripts rev 6

SliTaz boot options handler script
author Christophe Lincoln <pankso@slitaz.org>
date Fri Nov 30 12:30:38 2007 +0100 (2007-11-30)
parents 698d63c56ba9
children 1ceb004d3c43
files etc/init.d/bootopts.sh
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/etc/init.d/bootopts.sh	Fri Nov 30 12:30:38 2007 +0100
     1.3 @@ -0,0 +1,76 @@
     1.4 +#!/bin/sh
     1.5 +# /etc/init.d/bootopts.sh - SliTaz boot options from the cmdline.
     1.6 +#
     1.7 +. /etc/init.d/rc.functions
     1.8 +
     1.9 +# Mount /home and check for user hacker home dir.
    1.10 +#
    1.11 +mount_home()
    1.12 +{
    1.13 +	echo "Home has been specified to $DEVICE..."
    1.14 +	echo -n "Sleeping 10 s to let the kernel detect the device... "
    1.15 +	sleep 10
    1.16 +	status
    1.17 +	if grep -q "$DEVICE" /proc/partitions ; then
    1.18 +		echo "Mounting /home on /dev/$DEVICE... "
    1.19 +		mv /home/hacker /tmp/hacker-home
    1.20 +		mount -t ext3 /dev/$DEVICE /home
    1.21 +	else
    1.22 +		echo "Unable to find $DEVICE in /proc/partitions... "
    1.23 +	fi
    1.24 +	# Move all hacker dir if needed.
    1.25 +	if [ ! -d "/home/hacker" ] ; then
    1.26 +		mv /tmp/hacker-home /home/hacker
    1.27 +		chown -R hacker.hacker /home/hacker
    1.28 +	else
    1.29 +		rm -rf /tmp/hacker-home
    1.30 +	fi
    1.31 +}
    1.32 +
    1.33 +# Parse /proc/cmdline with grep.
    1.34 +#
    1.35 +
    1.36 +echo "Parsing kernel cmdline for SliTaz live options... "
    1.37 +
    1.38 +# Check for a specified home directory on cmdline (home=*).
    1.39 +#
    1.40 +if grep -q "home=usb" /proc/cmdline; then
    1.41 +	DEVICE=sda1
    1.42 +	mount_home
    1.43 +elif grep -q "home=" /proc/cmdline; then
    1.44 +	DEVICE=`cat /proc/cmdline | sed 's/.*home=\([^ ]*\).*/\1/'`
    1.45 +	mount_home
    1.46 +fi
    1.47 +
    1.48 +# Active an eventual swap file in /home and on local hd.
    1.49 +#
    1.50 +if [ -f "/home/swap" ]; then
    1.51 +	echo "Activing swap (/home/swap) memory..."
    1.52 +	swapon /home/swap
    1.53 +fi
    1.54 +if [ "`fdisk -l | grep swap`" ]; then
    1.55 +	for SWAP_DEV in `fdisk -l | grep swap | awk '{ print $1 }'`; do
    1.56 +		echo "Swap memory detected on : $SWAP_DEV"
    1.57 +		swapon $SWAP_DEV
    1.58 +	done
    1.59 +fi
    1.60 +
    1.61 +# Check for a specified locale (lang=*).
    1.62 +#
    1.63 +if grep -q "lang=*" /proc/cmdline; then
    1.64 +	LANG=`cat /proc/cmdline | sed 's/.*lang=\([^ ]*\).*/\1/'`
    1.65 +	echo -n "Setting system locale to: $LANG... "
    1.66 +	echo "LANG=$LANG" > /etc/locale.conf
    1.67 +	echo "LC_ALL=$LANG" >> /etc/locale.conf
    1.68 +	status
    1.69 +fi
    1.70 +
    1.71 +# Check for a specified keymap (kmap=*).
    1.72 +#
    1.73 +if grep -q "kmap=*" /proc/cmdline; then
    1.74 +	KMAP=`cat /proc/cmdline | sed 's/.*kmap=\([^ ]*\).*/\1/'`
    1.75 +	echo -n "Setting system keymap to: $KMAP..."
    1.76 +	echo "KMAP=$KMAP.kmap" > /etc/kmap.conf
    1.77 +	status
    1.78 +fi
    1.79 +