tazlito rev 333

tazlito: code clean-up, use more libtaz.sh functions
author Christophe Lincoln <pankso@slitaz.org>
date Sun Feb 16 15:28:59 2014 +0100 (2014-02-16)
parents 29f2100e2208
children 8c271470b47b
files tazlito tazlito.conf
line diff
     1.1 --- a/tazlito	Sun Feb 16 14:37:24 2014 +0100
     1.2 +++ b/tazlito	Sun Feb 16 15:28:59 2014 +0100
     1.3 @@ -32,7 +32,7 @@
     1.4  
     1.5  log=/var/log/tazlito.log
     1.6  if check_root; then
     1.7 -	echo "" > $log
     1.8 +	newline > $log
     1.9  fi
    1.10  
    1.11  # Try to include config file, continue if command is gen-config or exit.
    1.12 @@ -75,9 +75,13 @@
    1.13  
    1.14  # Print the usage.
    1.15  usage () {
    1.16 -	echo -e "\nSliTaz Live Tool - Version: $VERSION\n
    1.17 -\033[1mUsage: \033[0m `basename $0` [command] [list|iso|flavor|compression] [dir|iso]
    1.18 -\033[1mCommands: \033[0m\n
    1.19 +	cat << EOT
    1.20 +
    1.21 +SliTaz Live Tool - Version: $(colorize 34 "$VERSION")
    1.22 +
    1.23 +$(boldify "Usage:") $(basename $0) [command] [list|iso|flavor|compression] [dir|iso]
    1.24 +
    1.25 +$(boldify "Commands:")
    1.26    usage           Print this short usage.
    1.27    stats           View Tazlito and distro configuration statistics.
    1.28    gen-config      Generate a new configuration file for a distro.
    1.29 @@ -104,11 +108,12 @@
    1.30    repack          Recompress rootfs into iso with maximum ratio.
    1.31    build-loram     Generate a live-CD for low ram systems.
    1.32    emu-iso         Emulate an ISO image with Qemu.
    1.33 -  burn-iso        Burn ISO image to a cdrom using Wodim.\n"
    1.34 +  burn-iso        Burn ISO image to a cdrom using Wodim.
    1.35 +
    1.36 +EOT
    1.37  }
    1.38  
    1.39 -yesorno()
    1.40 -{
    1.41 +yesorno() {
    1.42  	echo -n "$1"
    1.43  	case "$DEFAULT_ANSWER" in
    1.44  		Y|y) answer="y";;
    1.45 @@ -117,19 +122,16 @@
    1.46  	esac
    1.47  }
    1.48  
    1.49 -field()
    1.50 -{
    1.51 +field() {
    1.52  	grep "^$1" "$2" | sed 's/.*: \([0-9KMG\.]*\).*/\1/'
    1.53  }
    1.54  
    1.55 -todomsg()
    1.56 -{
    1.57 +todomsg() {
    1.58  	echo -e "\\033[70G[ \\033[1;31mTODO\\033[0;39m ]"
    1.59  }
    1.60  
    1.61  # Download a file from this mirror
    1.62 -download_from()
    1.63 -{
    1.64 +download_from() {
    1.65  	local i
    1.66  	local mirrors
    1.67  	mirrors="$1"
    1.68 @@ -169,8 +171,7 @@
    1.69  }
    1.70  
    1.71  # Echo the package name if the tazpkg is already installed
    1.72 -installed_package_name()
    1.73 -{
    1.74 +installed_package_name() {
    1.75  	local tazpkg
    1.76  	local package
    1.77  	local VERSION
    1.78 @@ -199,8 +200,7 @@
    1.79  }
    1.80  
    1.81  # Check for the rootfs tree.
    1.82 -check_rootfs()
    1.83 -{
    1.84 +check_rootfs() {
    1.85  	if [ ! -d "$ROOTFS/etc" ] ; then
    1.86  		echo -e "\nUnable to find a distro rootfs...\n"
    1.87  		exit 0
    1.88 @@ -225,8 +225,8 @@
    1.89  		-e '/  boot\/isolinux\/boot.cat$/d' md5sum
    1.90  	status
    1.91  	cd - > /dev/null
    1.92 -	echo ""
    1.93 -	echo -e "\033[1mGenerating ISO image\033[0m"
    1.94 +	newline
    1.95 +	boldify "Generating ISO image"
    1.96  	separator
    1.97  	echo "Generating $1"
    1.98  	if [ $(ls $2/boot/vmlinuz* $2/boot/bzImage | wc -l) -eq 2 ]; then
    1.99 @@ -255,7 +255,6 @@
   1.100  	if [ -x /usr/bin/iso2exe ]; then
   1.101  		echo "Creating EXE header..."
   1.102  		/usr/bin/iso2exe $1 2> /dev/null
   1.103 -		status
   1.104  	fi
   1.105  }
   1.106  
   1.107 @@ -439,12 +438,13 @@
   1.108  EOT
   1.109  	separator
   1.110  	echo "Image is ready: $ISO_NAME.iso"
   1.111 +	newline
   1.112  }
   1.113  
   1.114  # Print ISO and rootfs size.
   1.115  distro_stats() {
   1.116  	newline
   1.117 -	boldify "Distro statistics ($DISTRO)"
   1.118 +	echo "$(boldify 'Distro statistics:') $DISTRO"
   1.119  	separator
   1.120  	distro_sizes
   1.121  }
   1.122 @@ -835,7 +835,7 @@
   1.123  	fi
   1.124  	if ! $need_lib && [ -x /usr/share/boot/busybox-static ]; then
   1.125  		cp /usr/share/boot/busybox-static $TMP_DIR/initfs/bin/busybox
   1.126 -		sed -i 's/LD_T.*ot/echo ""/;s/".*ld-.*) /"/' $TMP_DIR/initfs/init
   1.127 +		sed -i 's/LD_T.*ot/newline/;s/".*ld-.*) /"/' $TMP_DIR/initfs/init
   1.128  	else
   1.129  		cp /bin/busybox $TMP_DIR/initfs/bin
   1.130  		need_lib=true
   1.131 @@ -1153,9 +1153,10 @@
   1.132  	stats)
   1.133  		# Tazlito general statistics from the config file.
   1.134  		#
   1.135 -		echo ""
   1.136 -		echo -e "\033[1mTazlito statistics\033[0m
   1.137 -===============================================================================
   1.138 +		newline
   1.139 +		boldify "Tazlito statistics"
   1.140 +		separator
   1.141 +		echo "\
   1.142  Config file         : $CONFIG_FILE
   1.143  ISO name            : $ISO_NAME.iso
   1.144  Volume name         : $VOLUM_NAME
   1.145 @@ -1165,15 +1166,15 @@
   1.146  		if [ ! "$ADDFILES" = "" ] ; then
   1.147  			echo -e "Additional files    : $ADDFILES"
   1.148  		fi
   1.149 -		separator
   1.150 -		echo ""
   1.151 -	    ;;
   1.152 +		separator && newline ;;
   1.153 +	
   1.154  	list-addfiles)
   1.155  		# Simple list of additional files in the rootfs
   1.156 -		echo ""
   1.157 +		newline
   1.158  		cd $ADDFILES
   1.159  		find rootfs -type f
   1.160 -		echo "" ;;
   1.161 +		newline ;;
   1.162 +	
   1.163  	gen-config)
   1.164  		# Generate a new config file in the current dir or the specified
   1.165  		# directory by $2.
   1.166 @@ -1184,13 +1185,13 @@
   1.167  		echo -n "Generating empty tazlito.conf..."
   1.168  		empty_config_file
   1.169  		status
   1.170 -		echo ""
   1.171 +		newline
   1.172  		if [ -f "tazlito.conf" ] ; then
   1.173  			echo "Configuration file is ready to edit."
   1.174  			echo "File location : `pwd`/tazlito.conf"
   1.175 -			echo ""
   1.176 -		fi
   1.177 -		;;
   1.178 +			newline
   1.179 +		fi ;;
   1.180 +	
   1.181  	configure)
   1.182  		# Configure a tazlito.conf config file. Start by getting
   1.183  		# a empty config file and sed it.
   1.184 @@ -1225,16 +1226,16 @@
   1.185  		separator
   1.186  		echo "Config file is ready to use."
   1.187  		echo "You can now extract an ISO or generate a distro."
   1.188 -		echo ""
   1.189 -		;;
   1.190 +		newline ;;
   1.191 +	
   1.192  	gen-iso)
   1.193  		# Simply generate a new iso.
   1.194  		#
   1.195  		check_root
   1.196  		verify_rootcd
   1.197  		gen_livecd_isolinux
   1.198 -		distro_stats
   1.199 -		;;
   1.200 +		distro_stats ;;
   1.201 +	
   1.202  	gen-initiso)
   1.203  		# Simply generate a new initramfs with a new iso.
   1.204  		#
   1.205 @@ -1242,8 +1243,8 @@
   1.206  		verify_rootcd
   1.207  		gen_initramfs $ROOTFS
   1.208  		gen_livecd_isolinux
   1.209 -		distro_stats
   1.210 -		;;
   1.211 +		distro_stats ;;
   1.212 +	
   1.213  	extract-distro)
   1.214  		# Extract an ISO image to a directory and rebuild the LiveCD tree.
   1.215  		#
   1.216 @@ -1266,11 +1267,11 @@
   1.217  			echo -e "Please clean the distro tree or change directory path.\n"
   1.218  			exit 0
   1.219  		fi
   1.220 -		echo ""
   1.221 +		newline
   1.222  		echo -e "\033[1mTazlito extracting :\033[0m `basename $ISO_IMAGE`"
   1.223  		separator
   1.224  		# Start to mount the ISO.
   1.225 -		echo ""
   1.226 +		newline
   1.227  		echo "Mounting ISO image..."
   1.228  		mkdir -p $TMP_DIR
   1.229  		# Get ISO file size.
   1.230 @@ -1324,26 +1325,26 @@
   1.231  		# Umount and remove temp directory and cd to $TARGET to get stats.
   1.232  		umount $TMP_DIR && rm -rf $TMP_DIR
   1.233  		cd ..
   1.234 -		echo ""
   1.235 +		newline
   1.236  		separator
   1.237  		echo "Extracted       : `basename $ISO_IMAGE` ($isosize)"
   1.238  		echo "Distro tree     : `pwd`"
   1.239  		echo "Rootfs size     : `du -sh rootfs`"
   1.240  		echo "Rootcd size     : `du -sh rootcd`"
   1.241  		separator
   1.242 -		echo ""
   1.243 -		;;
   1.244 +		newline ;;
   1.245 +	
   1.246  	list-flavors)
   1.247  		# Show available flavors.
   1.248  		if [ ! -s /etc/tazlito/flavors.list -o "$2" == "--recharge" ]; then
   1.249  			download flavors.list -O - > /etc/tazlito/flavors.list
   1.250  		fi
   1.251 -		echo ""
   1.252 +		newline
   1.253  		echo -e "\033[1mList of flavors\033[0m"
   1.254  		separator
   1.255  		cat /etc/tazlito/flavors.list
   1.256 -		echo ""
   1.257 -		;;
   1.258 +		newline ;;
   1.259 +		
   1.260  	show-flavor)
   1.261  		# Show flavor description.
   1.262  		FLAVOR=${2%.flavor}
   1.263 @@ -1366,8 +1367,8 @@
   1.264  			separator
   1.265  			cat $TMP_DIR/$FLAVOR.desc
   1.266  		fi
   1.267 -		rm -Rf $TMP_DIR
   1.268 -		;;
   1.269 +		rm -Rf $TMP_DIR ;;
   1.270 +		
   1.271  	gen-liveflavor)
   1.272  		# Generate a new flavor from the live system.
   1.273  		FLAVOR=${2%.flavor}
   1.274 @@ -1411,12 +1412,12 @@
   1.275  		yes '' | tazlito gen-distro
   1.276  		echo "$DESC" | tazlito gen-flavor "$FLAVOR"
   1.277  		mv /etc/tazlito/distro-packages.list.$$ \
   1.278 -		   /etc/tazlito/distro-packages.list 2> /dev/null
   1.279 -		;;
   1.280 +		   /etc/tazlito/distro-packages.list 2> /dev/null ;;
   1.281 +		
   1.282  	gen-flavor)
   1.283  		# Generate a new flavor from the last iso image generated.
   1.284  		FLAVOR=${2%.flavor}
   1.285 -		echo ""
   1.286 +		newline
   1.287  		echo -e "\033[1mFlavor generation\033[0m"
   1.288  		separator
   1.289  		if [ -z "$FLAVOR" ]; then
   1.290 @@ -1469,8 +1470,8 @@
   1.291  		status
   1.292  		separator
   1.293  		echo "Flavor size : `du -sh $FLAVOR.flavor`"
   1.294 -		echo ""
   1.295 -		;;
   1.296 +		newline ;;
   1.297 +		
   1.298  	upgrade-flavor)
   1.299  		# Update package list to the latest versions available.
   1.300  		FLAVOR=${2%.flavor}
   1.301 @@ -1521,8 +1522,8 @@
   1.302  				$FLAVOR.flavor
   1.303  			status
   1.304  			rm -Rf $TMP_DIR
   1.305 -		fi
   1.306 -		;;
   1.307 +		fi ;;
   1.308 +	
   1.309  	extract-flavor)
   1.310  		# Extract a flavor into $FLAVORS_REPOSITORY.
   1.311  		FLAVOR=${2%.flavor}
   1.312 @@ -1580,8 +1581,8 @@
   1.313  			     > $FLAVORS_REPOSITORY/$FLAVOR/packages.list
   1.314  			status
   1.315  			rm -Rf $TMP_DIR
   1.316 -		fi
   1.317 -		;;
   1.318 +		fi ;;
   1.319 +	
   1.320  	pack-flavor)
   1.321  		# Create a flavor from $FLAVORS_REPOSITORY.
   1.322  		FLAVOR=${2%.flavor}
   1.323 @@ -1703,8 +1704,8 @@
   1.324  			rm -Rf $TMP_DIR
   1.325  		else
   1.326  			echo "No $FLAVOR flavor in $FLAVORS_REPOSITORY."
   1.327 -		fi
   1.328 -		;;
   1.329 +		fi ;;
   1.330 +	
   1.331  	get-flavor)
   1.332  		# Get a flavor's files and prepare for gen-distro.
   1.333  		FLAVOR=${2%.flavor}
   1.334 @@ -1717,7 +1718,7 @@
   1.335  			status
   1.336  			mkdir $TMP_DIR
   1.337  			echo -n "Extracting flavor $FLAVOR.flavor... "
   1.338 -			zcat < $FLAVOR.flavor | ( cd $TMP_DIR; cpio -i >/dev/null )
   1.339 +			zcat < $FLAVOR.flavor | ( cd $TMP_DIR; cpio -i --quiet >/dev/null )
   1.340  			status
   1.341  			echo -n "Creating distro-packages.list..."
   1.342  			mv $TMP_DIR/$FLAVOR.nonfree non-free.list 2> /dev/null
   1.343 @@ -1739,7 +1740,7 @@
   1.344  					echo -n "Adding $i files... "
   1.345  					mkdir -p "$ADDFILES/$i"
   1.346  					zcat < $TMP_DIR/$FLAVOR.$i | \
   1.347 -						( cd "$ADDFILES/$i"; cpio -id > /dev/null)
   1.348 +						( cd "$ADDFILES/$i"; cpio -id --quiet > /dev/null)
   1.349  					zcat < $TMP_DIR/$FLAVOR.$i | cpio -tv 2> /dev/null \
   1.350  						> $TMP_DIR/$FLAVOR.list$i
   1.351  					infos="$infos\n$FLAVOR.list$i"
   1.352 @@ -1772,8 +1773,7 @@
   1.353  			rm -Rf $TMP_DIR
   1.354  		fi
   1.355  		separator
   1.356 -		echo -e "Flavor is ready to be generated by: tazlito gen-distro\n"
   1.357 -		;;
   1.358 +		echo -e "Flavor is ready to be generated by: tazlito gen-distro\n" ;;
   1.359  
   1.360  	iso2flavor)
   1.361  		if [ -z "$3" -o ! -s "$2" ]; then
   1.362 @@ -1854,8 +1854,7 @@
   1.363  EOT
   1.364  			fi
   1.365  		fi
   1.366 -		rm -rf $TMP_DIR
   1.367 -		;;
   1.368 +		rm -rf $TMP_DIR ;;
   1.369  
   1.370  	check-list)
   1.371  		# Use current packages list in $PWD by default.
   1.372 @@ -1863,7 +1862,7 @@
   1.373  		[ -d "$2" ] && DISTRO_PKGS_LIST=$2/distro-packages.list
   1.374  		[ -f "$2" ] && DISTRO_PKGS_LIST=$2
   1.375  		[ ! -f $DISTRO_PKGS_LIST ] && echo "No packages list found." && exit 0
   1.376 -		echo ""
   1.377 +		newline
   1.378  		echo -e "\033[1mLiveCD packages list check\033[0m"
   1.379  		separator
   1.380  		for pkg in `cat $DISTRO_PKGS_LIST`
   1.381 @@ -1876,42 +1875,28 @@
   1.382  		[ -z $up ] && echo -e "List is up-to-date\n" && exit 0
   1.383  		separator
   1.384  		echo -e "Updates: $up\n" ;;
   1.385 +	
   1.386  	gen-distro)
   1.387  		# Generate a live distro tree with a set of packages.
   1.388  		#
   1.389  		check_root
   1.390  		time=$(date +%s)
   1.391  
   1.392 +		# Libtaz will set $iso or $cdrom
   1.393 +		CDROM=""
   1.394 +		[ "$iso" ] && CDROM="-o loop $iso"
   1.395 +		[ "$cdrom" ] && CDROM="/dev/cdrom"
   1.396  		# Check if a package list was specified on cmdline.
   1.397 -		LIST_NAME="distro-packages.list"
   1.398 -		CDROM=""
   1.399 -		while [ -n "$2" ]; do
   1.400 -			case "$2" in
   1.401 -			--iso=*)
   1.402 -				CDROM="-o loop ${2#--iso=}"
   1.403 -				;;
   1.404 -			--cdrom)
   1.405 -				CDROM="/dev/cdrom"
   1.406 -				;;
   1.407 -			--force)
   1.408 -				DELETE_ROOTFS="true"
   1.409 -				;;
   1.410 -			*)	if [ ! -f "$2" ] ; then
   1.411 -					echo -e "\nUnable to find the specified packages list."
   1.412 -					echo -e "List name : $2\n"
   1.413 -					exit 1
   1.414 -				fi
   1.415 -				LIST_NAME=$2
   1.416 -				;;
   1.417 -			esac
   1.418 -			shift
   1.419 -		done
   1.420 +		if [ -f "$2" ]; then
   1.421 +			LIST_NAME=$2
   1.422 +		else
   1.423 +			LIST_NAME="distro-packages.list"
   1.424 +		fi
   1.425  
   1.426 -		if [ -d $ROOTFS ] ; then
   1.427 +		if [ -d "$ROOTFS" ] ; then
   1.428  			# Delete $ROOTFS if --force is set on command line
   1.429 -			if [ ! -z $DELETE_ROOTFS ]; then
   1.430 -				rm -rf $ROOTFS
   1.431 -				unset $DELETE_ROOTFS
   1.432 +			if [ "$forced" ]; then
   1.433 +				rm -rf $ROOTFS $ROOTCD
   1.434  			else
   1.435  				echo -e "\nA rootfs exists in : $DISTRO"
   1.436  				echo -e "Please clean the distro tree or change directory path.\n"
   1.437 @@ -1937,7 +1922,7 @@
   1.438  			exit 0
   1.439  		fi
   1.440  		# Start generation.
   1.441 -		echo ""
   1.442 +		newline
   1.443  		echo -e "\033[1mTazlito generating a distro\033[0m"
   1.444  		separator
   1.445  		# Misc checks
   1.446 @@ -2158,13 +2143,13 @@
   1.447  		fi
   1.448  		gen_livecd_isolinux
   1.449  		distro_stats
   1.450 -		cleanup
   1.451 -		;;
   1.452 +		cleanup ;;
   1.453 +		
   1.454  	clean-distro)
   1.455  		# Remove old distro tree.
   1.456  		#
   1.457  		check_root
   1.458 -		echo ""
   1.459 +		newline
   1.460  		boldify "Cleaning : $DISTRO"
   1.461  		separator
   1.462  		if [ -d "$DISTRO" ] ; then
   1.463 @@ -2185,12 +2170,13 @@
   1.464  			status
   1.465  		fi
   1.466  		separator
   1.467 -		echo "" ;;
   1.468 +		newline ;;
   1.469 +	
   1.470  	check-distro)
   1.471  		# Check for a few LiveCD needed files not installed by packages.
   1.472  		#
   1.473  		check_rootfs
   1.474 -		echo ""
   1.475 +		newline
   1.476  		echo -e "\033[1mChecking distro :\033[0m $ROOTFS"
   1.477  		separator
   1.478  		# SliTaz release info.
   1.479 @@ -2218,8 +2204,8 @@
   1.480  			status
   1.481  		fi
   1.482  		separator
   1.483 -		echo ""
   1.484 -		;;
   1.485 +		newline ;;
   1.486 +	
   1.487  	writeiso)
   1.488  		# Writefs to ISO image including /home unlike gen-distro we dont use
   1.489  		# packages to generate a rootfs, we build a compressed rootfs with all
   1.490 @@ -2279,16 +2265,16 @@
   1.491  				exit 0 ;;
   1.492  			y|Y|yes|Yes)
   1.493  				echo "Removing current locale/keymap settings..."
   1.494 -				echo "" > /etc/locale.conf
   1.495 -				echo "" > /etc/keymap.conf ;;
   1.496 +				newline > /etc/locale.conf
   1.497 +				newline > /etc/keymap.conf ;;
   1.498  			*)
   1.499  				echo "Keeping current locale/keymap settings..." ;;
   1.500  		esac
   1.501  		status
   1.502  		
   1.503  		# Clean-up files by default
   1.504 -		echo "" > /etc/udev/rules.d/70-persistent-net.rules
   1.505 -		echo "" > /etc/udev/rules.d/70-persistant-cd.rules
   1.506 +		newline > /etc/udev/rules.d/70-persistent-net.rules
   1.507 +		newline > /etc/udev/rules.d/70-persistant-cd.rules
   1.508  
   1.509  		# Create list of files including default user files since it is defined in /etc/passwd
   1.510  		# and some new users might have been added.
   1.511 @@ -2356,7 +2342,7 @@
   1.512  
   1.513  		echo "==============================================================================="
   1.514  		echo "ISO image: `du -sh /home/slitaz/distro/$ISO_NAME.iso`"
   1.515 -		echo ""
   1.516 +		newline
   1.517  		echo -n "Exit or burn ISO to cdrom (Exit|burn)? "; read anser
   1.518  		case $anser in
   1.519  			burn)
   1.520 @@ -2368,6 +2354,7 @@
   1.521  			*)
   1.522  				exit 0 ;;
   1.523  		esac ;;
   1.524 +	
   1.525  	burn-iso)
   1.526  		# Guess cdrom device, ask user and burn the ISO.
   1.527  		#
   1.528 @@ -2384,17 +2371,17 @@
   1.529  			echo -e "\nUnable to find ISO : $iso\n"
   1.530  			exit 0
   1.531  		fi
   1.532 -		echo ""
   1.533 +		newline
   1.534  		echo -e "\033[1mTazlito burn ISO\033[0m "
   1.535  		separator
   1.536  		echo "Cdrom device  : /dev/$DRIVE_NAME"
   1.537  		echo "Drive speed   : $DRIVE_SPEED"
   1.538  		echo "ISO image     : $iso"
   1.539  		separator
   1.540 -		echo ""
   1.541 +		newline
   1.542  		yesorno "Burn ISO image (y/N) ? "
   1.543  		if [ "$answer" == "y" ]; then
   1.544 -			echo ""
   1.545 +			newline
   1.546  			echo "Starting Wodim to burn the iso..." && sleep 2
   1.547  			separator
   1.548  			wodim speed=$DRIVE_SPEED dev=/dev/$DRIVE_NAME $iso
   1.549 @@ -2403,8 +2390,8 @@
   1.550  		else
   1.551  			echo -e "\nExiting. No ISO burned."
   1.552  		fi
   1.553 -		echo ""
   1.554 -		;;
   1.555 +		newline ;;
   1.556 +	
   1.557  	merge)
   1.558  		# Merge multiple rootfs into one iso.
   1.559  		#
   1.560 @@ -2487,16 +2474,14 @@
   1.561  		rm -f $TMP_DIR/iso/boot/rootfs.gz
   1.562  		update_bootconfig $TMP_DIR/iso/boot/isolinux "$append"
   1.563  		create_iso $ISO $TMP_DIR/iso
   1.564 -		rm -rf $TMP_DIR
   1.565 -		;;
   1.566 +		rm -rf $TMP_DIR ;;
   1.567  
   1.568  	repack)
   1.569  		# Repack an iso with maximum lzma compression ratio.
   1.570  		#
   1.571 -
   1.572  		ISO=$2
   1.573 -
   1.574  		mkdir -p $TMP_DIR/mnt
   1.575 +		
   1.576  		# Extract filesystems
   1.577  		echo -n "Mounting $ISO"
   1.578  		mount -o loop,ro $ISO $TMP_DIR/mnt 2> /dev/null
   1.579 @@ -2520,7 +2505,6 @@
   1.580  	build-loram)
   1.581  		# Build a Live CD for low ram systems.
   1.582  		#
   1.583 -
   1.584  		ISO=$2
   1.585  		OUTPUT=$3
   1.586  		if [ -z "$3" ]; then
   1.587 @@ -2536,11 +2520,10 @@
   1.588  			rm -rf $TMP_DIR
   1.589  			exit 1
   1.590  		fi
   1.591 -
   1.592  		case "$4" in
   1.593 -		cdrom)		build_loram_cdrom ;;
   1.594 -		http)		build_loram_http ;;
   1.595 -		*)		build_loram_ram ;;
   1.596 +			cdrom)		build_loram_cdrom ;;
   1.597 +			http)		build_loram_http ;;
   1.598 +			*)		build_loram_ram ;;
   1.599  		esac
   1.600  		umount $TMP_DIR/iso	# no -d: needs /proc
   1.601  		losetup -d $loopdev
   1.602 @@ -2569,10 +2552,9 @@
   1.603  		# Deduplicate files in a tree
   1.604  		shift
   1.605  		deduplicate "$@" ;;
   1.606 +	
   1.607  	usage|*)
   1.608 -		# Clear and print usage also for all unknown commands.
   1.609 -		#
   1.610 -		clear
   1.611 +		# Print usage also for all unknown commands.
   1.612  		usage ;;
   1.613  esac
   1.614  
     2.1 --- a/tazlito.conf	Sun Feb 16 14:37:24 2014 +0100
     2.2 +++ b/tazlito.conf	Sun Feb 16 15:28:59 2014 +0100
     2.3 @@ -3,11 +3,11 @@
     2.4  #
     2.5  
     2.6  # SliTaz version to use for ISO name and files path.
     2.7 -SLITAZ_VERSION=`cat /etc/slitaz-release`
     2.8 +SLITAZ_VERSION=$(cat /etc/slitaz-release)
     2.9  
    2.10  # Name of the ISO image to generate.
    2.11  ISO_NAME="slitaz-$SLITAZ_VERSION"
    2.12 -#ISO_NAME="slitaz-cooking-`date +%Y%m%d`"
    2.13 +#ISO_NAME="slitaz-cooking-$(date +%Y%m%d)"
    2.14  
    2.15  # ISO image volume name.
    2.16  VOLUM_NAME="SliTaz LiveCD"