slitaz-boot-scripts rev 35

Mount /home failed with options -o uid=500,gid=500
author Christophe Lincoln <pankso@slitaz.org>
date Sat Feb 23 22:35:46 2008 +0100 (2008-02-23)
parents 85421faee535
children ea584991ebae
files etc/init.d/bootopts.sh
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Sat Feb 23 20:30:54 2008 +0100
     1.2 +++ b/etc/init.d/bootopts.sh	Sat Feb 23 22:35:46 2008 +0100
     1.3 @@ -3,37 +3,6 @@
     1.4  #
     1.5  . /etc/init.d/rc.functions
     1.6  
     1.7 -# Mount /home and check for user hacker home dir.
     1.8 -#
     1.9 -mount_home()
    1.10 -{
    1.11 -	echo "Home has been specified to $DEVICE..."
    1.12 -	echo "Sleeping 10 s to let the kernel detect the device... "
    1.13 -	sleep 10
    1.14 -
    1.15 -	DEVID=$DEVICE
    1.16 -	if [ -x /sbin/blkid ]; then
    1.17 -		# Can be label, uuid or devname. DEVID give us /dev/name and
    1.18 -		# DEVICE give us disk name without /dev/.
    1.19 -		DEVID=`/sbin/blkid | grep $DEVICE | cut -d: -f1`
    1.20 -		DEVID=${DEVID##*/}
    1.21 -	fi
    1.22 -	if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
    1.23 -		echo "Mounting /home on /dev/$DEVID... "
    1.24 -		mv /home/hacker /tmp/hacker-home
    1.25 -		mount -o uid=500,gid=500 /dev/$DEVID /home
    1.26 -	else
    1.27 -		echo "Unable to find $DEVID... "
    1.28 -	fi
    1.29 -	# Move all hacker dir if needed.
    1.30 -	if [ ! -d "/home/hacker" ] ; then
    1.31 -		mv /tmp/hacker-home /home/hacker
    1.32 -		chown -R hacker.hacker /home/hacker
    1.33 -	else
    1.34 -		rm -rf /tmp/hacker-home
    1.35 -	fi
    1.36 -}
    1.37 -
    1.38  # Check if swap file must be generated in /home: swap=size (Mb).
    1.39  # This option is used with home=device.
    1.40  gen_home_swap()
    1.41 @@ -48,6 +17,37 @@
    1.42  	fi
    1.43  }
    1.44  
    1.45 +# Mount /home and check for user hacker home dir.
    1.46 +#
    1.47 +mount_home()
    1.48 +{
    1.49 +	echo "Home has been specified to $DEVICE..."
    1.50 +	echo "Sleeping 10 s to let the kernel detect the device... "
    1.51 +	sleep 10
    1.52 +
    1.53 +	DEVID=$DEVICE
    1.54 +	if [ -x /sbin/blkid ]; then
    1.55 +		# Can be label, uuid or devname. DEVID give us first: /dev/name.
    1.56 +		DEVID=`/sbin/blkid | grep $DEVICE | cut -d: -f1`
    1.57 +		DEVID=${DEVID##*/}
    1.58 +	fi
    1.59 +	if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
    1.60 +		echo "Mounting /home on /dev/$DEVID... "
    1.61 +		mv /home/hacker /tmp/hacker-home
    1.62 +		mount /dev/$DEVID /home
    1.63 +		gen_home_swap
    1.64 +	else
    1.65 +		echo "Unable to find $DEVID... "
    1.66 +	fi
    1.67 +	# Move all hacker dir if needed.
    1.68 +	if [ ! -d "/home/hacker" ] ; then
    1.69 +		mv /tmp/hacker-home /home/hacker
    1.70 +		chown -R hacker.hacker /home/hacker
    1.71 +	else
    1.72 +		rm -rf /tmp/hacker-home
    1.73 +	fi
    1.74 +}
    1.75 +
    1.76  # Parse /proc/cmdline with grep.
    1.77  #
    1.78  
    1.79 @@ -58,11 +58,9 @@
    1.80  if grep -q "home=usb" /proc/cmdline; then
    1.81  	DEVICE=sda1
    1.82  	mount_home
    1.83 -	gen_home_swap
    1.84  elif grep -q "home=" /proc/cmdline; then
    1.85  	DEVICE=`cat /proc/cmdline | sed 's/.*home=\([^ ]*\).*/\1/'`
    1.86  	mount_home
    1.87 -	gen_home_swap
    1.88  fi
    1.89  
    1.90  # Active an eventual swap file in /home and on local hd.