slitaz-boot-scripts diff etc/init.d/bootopts.sh @ rev 256

rcS: export SCREEN and source functions in user-home.sh
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 29 17:43:22 2011 +0200 (2011-04-29)
parents 9f875fdcde50
children f1c0f8f8c116
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Tue Apr 05 18:36:50 2011 +0000
     1.2 +++ b/etc/init.d/bootopts.sh	Fri Apr 29 17:43:22 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