tazlito rev 218

Be less berbose when installing packages and log full tazpkg messages
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 15 17:36:29 2011 +0200 (2011-05-15)
parents c7eaa37cc566
children 310cba6e0eb9
files tazlito
line diff
     1.1 --- a/tazlito	Wed Apr 27 11:57:31 2011 +0200
     1.2 +++ b/tazlito	Sun May 15 17:36:29 2011 +0200
     1.3 @@ -28,6 +28,9 @@
     1.4  MIRROR=$LOCALSTATE/mirror
     1.5  DEFAULT_MIRROR="http://mirror.slitaz.org/packages/`cat /etc/slitaz-release`/"
     1.6  
     1.7 +log=/var/log/tazlito.log
     1.8 +echo "" > $log
     1.9 +
    1.10  # Try to include config file, continue if command is gen-config or exit.
    1.11  # The main config used by default is in /etc/tazlito.
    1.12  if [ -f "/etc/tazlito/tazlito.conf" ] ; then
    1.13 @@ -102,17 +105,14 @@
    1.14  }
    1.15  
    1.16  # Status function.
    1.17 -status()
    1.18 -{
    1.19 -	local CHECK=$?
    1.20 +status() {
    1.21  	echo -en "\\033[70G[ "
    1.22 -	if [ $CHECK = 0 ]; then
    1.23 -		echo -en "\\033[1;33mOK"
    1.24 +	if [ $? = 0 ]; then
    1.25 +		echo -en "\\033[1;32mOK"
    1.26  	else
    1.27  		echo -en "\\033[1;31mFailed"
    1.28  	fi
    1.29  	echo -e "\\033[0;39m ]"
    1.30 -	return $CHECK
    1.31  }
    1.32  
    1.33  yesorno()
    1.34 @@ -631,8 +631,13 @@
    1.35  	echo -n "?"
    1.36  	read answer
    1.37  	case "$answer" in
    1.38 -	y*|Y*|o*|O*)	yes y | tazpkg get-install $1;;
    1.39 -	*)		return 1;;
    1.40 +	y*|Y*|o*|O*)
    1.41 +		# We dont want package on host cache.
    1.42 +		echo -n "Getting and installing package: $1"
    1.43 +		yes y | tazpkg get-install $1 2>&1 >> $log || exit 1 
    1.44 +		status ;;
    1.45 +	*)	
    1.46 +		return 1 ;;
    1.47  	esac
    1.48  }
    1.49  
    1.50 @@ -1351,11 +1356,11 @@
    1.51  		tazpkg recharge
    1.52  		[ -n "$3" ] && while read action pkg; do
    1.53  			case "$action" in
    1.54 -			+)	yes | tazpkg get-install $pkg;;
    1.55 -			-)	yes | tazpkg remove $pkg;;
    1.56 -			!)	echo $pkg >> non-free.list;;
    1.57 -			@)	DESC="$pkg";;
    1.58 -			\?)	echo -en "$pkg"; read action;;
    1.59 +			+)	yes | tazpkg get-install $pkg 2>&1 >> $log || exit 1 ;;
    1.60 +			-)	yes | tazpkg remove $pkg ;;
    1.61 +			!)	echo $pkg >> non-free.list ;;
    1.62 +			@)	DESC="$pkg" ;;
    1.63 +			\?)	echo -en "$pkg"; read action ;;
    1.64  			esac
    1.65  		done < $3
    1.66  		yes '' | tazlito gen-distro
    1.67 @@ -1900,7 +1905,6 @@
    1.68  		# Root fs stuff.
    1.69  		echo "Preparing the rootfs directory..."
    1.70  		mkdir -p $ROOTFS
    1.71 -		sleep 2
    1.72  		for pkg in $LIST
    1.73  		do
    1.74  			[ "$pkg" = "" ] && continue
    1.75 @@ -1947,12 +1951,15 @@
    1.76  				mv $pkg $PACKAGES_REPOSITORY 
    1.77  			done
    1.78  		fi
    1.79 -		echo ""
    1.80  		cp $LIST_NAME $DISTRO/distro-packages.list
    1.81  		sed 's/\(.*\)/\1.tazpkg/' < $DISTRO/distro-packages.list > $DISTRO/list-packages
    1.82  		cd $PACKAGES_REPOSITORY
    1.83 -		yes y | tazpkg install-list \
    1.84 -			$DISTRO/list-packages --root=$ROOTFS
    1.85 +		for pkg in $(cat $DISTRO/list-packages)
    1.86 +		do
    1.87 +			echo -n "Installing package: $pkg"
    1.88 +			yes y | tazpkg install $pkg --root=$ROOTFS 2>&1 >> $log || exit 1 
    1.89 +			status
    1.90 +		done
    1.91  		cd $DISTRO
    1.92  		cp distro-packages.list $ROOTFS/etc/tazlito
    1.93  		# Copy all files from $ADDFILES/rootfs to the rootfs.