tazpkg rev 600

Use newline(), more shortcut for cmds and improve list output
author Christophe Lincoln <pankso@slitaz.org>
date Thu May 24 14:15:09 2012 +0200 (2012-05-24)
parents eb1a1a0d392a
children 0ae7d245757b
files tazpkg
line diff
     1.1 --- a/tazpkg	Thu May 24 13:39:03 2012 +0200
     1.2 +++ b/tazpkg	Thu May 24 14:15:09 2012 +0200
     1.3 @@ -65,17 +65,19 @@
     1.4  # Print the usage.
     1.5  usage ()
     1.6  {
     1.7 +	newline
     1.8  	echo -e "`gettext \"SliTaz package manager - Version\"`: $VERSION
     1.9 +
    1.10  \033[1m`gettext \"Usage\"`:\033[0m `gettext \"tazpkg [command] [package|dir|pattern|list|cat|--opt] [dir|--opt]\"`
    1.11 -		tazpkg shell\n
    1.12 +$(boldify SHell:) tazpkg shell\n
    1.13  \033[1m`gettext \"Commands\"`: \033[0m
    1.14    usage            `gettext \"Print this short usage.\"`
    1.15    bugs             `gettext \"Show known bugs in packages.\"`
    1.16    list|-l          `gettext \"List installed packages on the system by category or all.\"`
    1.17 -  list-mirror      `gettext \"List all available packages on the mirror (--diff for new).\"`
    1.18 +  list-mirror|-lm  `gettext \"List all available packages on the mirror (--diff for new).\"`
    1.19    info             `gettext \"Print information about a package.\"`
    1.20    desc             `gettext \"Print description of a package (if it exists).\"`
    1.21 -  list-files       `gettext \"List the files installed with a package.\"`
    1.22 +  list-files|-lf   `gettext \"List the files installed with a package.\"`
    1.23    list-config      `gettext \"List the configuration files.\"`
    1.24    search|-s        `gettext \"Search for a package by pattern or name (options: -i|-l|-m).\"`
    1.25    search-pkgname   `gettext \"Search on mirror for package having a particular file.\"`
    1.26 @@ -83,7 +85,7 @@
    1.27    install|-i       `gettext \"Install a local (*.tazpkg) package (--forced to force).\"`
    1.28    install-list     `gettext \"Install all packages from a list of packages.\"`
    1.29    remove|-r        `gettext \"Remove the specified package and all installed files.\"`
    1.30 -  extract          `gettext \"Extract a (*.tazpkg) package into a directory.\"`
    1.31 +  extract|-e       `gettext \"Extract a (*.tazpkg) package into a directory.\"`
    1.32    pack             `gettext \"Pack an unpacked or prepared package tree.\"`
    1.33    recharge         `gettext \"Recharge your packages.list from the mirror.\"`
    1.34    up|--help-up     `gettext \"Check packages $CHECKSUM to list and install latest upgrades.\"`
    1.35 @@ -103,12 +105,13 @@
    1.36    rdepends         `gettext \"Display reverse dependencies tree.\"`
    1.37    convert          `gettext \"Convert a deb/rpm/tgz/arch package to a slitaz (.tazpkg).\"`
    1.38    link             `gettext \"Link a package from another slitaz installation.\"`
    1.39 -  setup-mirror     `gettext \"Change the mirror url configuration.\"`
    1.40 +  setup-mirror|-sm `gettext \"Change the mirror url configuration.\"`
    1.41    list-undigest    `gettext \"List undigest mirrors.\"`
    1.42    remove-undigest  `gettext \"Remove an undigest mirror.\"`
    1.43    add-undigest     `gettext \"Add an undigest mirror.\"`
    1.44    setup-undigest   `gettext \"Update an undigest mirror.\"`
    1.45    reconfigure      `gettext \"Replay post install script from package.\"`"
    1.46 +	newline
    1.47  }
    1.48  
    1.49  usage_up() {
    1.50 @@ -158,9 +161,9 @@
    1.51  check_for_package_on_cmdline()
    1.52  {
    1.53  	if [ -z "$PACKAGE" ]; then
    1.54 -		echo ""
    1.55 +		newline
    1.56  		gettext "Please specify a package name on the command line."; echo
    1.57 -		echo ""
    1.58 +		newline
    1.59  		exit 0
    1.60  	fi
    1.61  }
    1.62 @@ -169,9 +172,9 @@
    1.63  check_for_package_file()
    1.64  {
    1.65  	if [ ! -f "$PACKAGE_FILE" ]; then
    1.66 -		echo ""
    1.67 +		newline
    1.68  		eval_gettext "Unable to find: \$PACKAGE_FILE"; echo
    1.69 -		echo "" && exit 0
    1.70 +		newline && exit 0
    1.71  	fi
    1.72  }
    1.73  
    1.74 @@ -180,9 +183,9 @@
    1.75  {
    1.76  	if [ ! -f "$1$INSTALLED/$PACKAGE/receipt" ]; then
    1.77  		FS=$1
    1.78 -		echo ""
    1.79 +		newline
    1.80  		eval_gettext "Unable to find the receipt: \$FS\$INSTALLED/\$PACKAGE/receipt"; echo
    1.81 -		echo "" && exit 0
    1.82 +		newline && exit 0
    1.83  	fi
    1.84  }
    1.85  
    1.86 @@ -233,10 +236,10 @@
    1.87  check_for_installed_package()
    1.88  {
    1.89  	if [ -n "$(get_installed_package_pathname $PACKAGE $1)" ]; then
    1.90 -		echo ""
    1.91 +		newline
    1.92  		eval_gettext "\$PACKAGE package is already installed. You can
    1.93  use the --forced option to force installation or remove it and reinstall."; echo
    1.94 -		echo "" && exit 0
    1.95 +		newline && exit 0
    1.96  	fi
    1.97  }
    1.98  
    1.99 @@ -247,12 +250,12 @@
   1.100  		if test $(id -u) = 0 ; then
   1.101  			tazpkg recharge
   1.102  		else
   1.103 -			echo ""
   1.104 +			newline
   1.105  			eval_gettext "Unable to find the list: \$LOCALSTATE/packages.list"; echo
   1.106  			gettext \
   1.107  "You must probably run 'tazpkg recharge' as root to get the latest list of
   1.108 -packages available on the mirror."; echo
   1.109 -			echo "" && exit 0
   1.110 +packages available on the mirror."; newline
   1.111 +			newline && exit 0
   1.112  		fi
   1.113  	fi
   1.114  }
   1.115 @@ -366,9 +369,9 @@
   1.116  		rep=$(cat $tmp/rep)
   1.117  		rm -f $tmp/rep $tmp/cachedir
   1.118  	else
   1.119 -		echo ""
   1.120 +		newline
   1.121  		eval_gettext "Unable to find: \$PACKAGE in the mirrored packages list."; echo
   1.122 -		echo ""
   1.123 +		newline
   1.124  		[ -n "$check_only" ] && return 1
   1.125  		exit 0
   1.126  	fi
   1.127 @@ -427,7 +430,6 @@
   1.128  	status
   1.129  	if [ -f fs.cpio.lzma ]; then
   1.130  		gettext "Extracting the pseudo fs... "
   1.131 -		echo -n "(lzma) "
   1.132  		unlzma -c fs.cpio.lzma | cpio -idm --quiet && rm fs.cpio.lzma
   1.133  		status
   1.134  	elif [ -f fs.cpio.gz ]; then
   1.135 @@ -494,7 +496,7 @@
   1.136  	fi
   1.137  	mkdir -p $TMP_DIR
   1.138  	[ -n "$INSTALL_LIST" ] && echo "$PACKAGE_FILE" >> $ROOT$LOCALSTATE/$INSTALL_LIST-processed
   1.139 -	echo ""
   1.140 +	newline
   1.141  	boldify "$(gettext "Installation of :") $PACKAGE"
   1.142  	separator
   1.143  	eval_gettext "Copying \$PACKAGE... "
   1.144 @@ -642,7 +644,7 @@
   1.145  	cd $TOP_DIR
   1.146  	separator
   1.147  	eval_gettext "\$PACKAGE (\$VERSION\$EXTRAVERSION) is installed."; echo
   1.148 -	echo ""
   1.149 +	newline
   1.150  	# Log this activity
   1.151  	[ -n "$ROOT" ] || log Installed
   1.152  }
   1.153 @@ -722,11 +724,11 @@
   1.154  	if [ "$AUTO_INSTALL_DEPS" == "yes" ]; then
   1.155  		answer=`translate_querry y`
   1.156  	else
   1.157 -		echo ""
   1.158 +		newline
   1.159  		gettext "Install all missing dependencies"
   1.160  		echo -n " (`translate_querry y`/`translate_querry N`) ? "
   1.161  		read answer
   1.162 -		echo ""
   1.163 +		newline
   1.164  	fi
   1.165  	if [ "$answer" == "$(translate_querry y)" ]; then
   1.166  		for pkgorg in $DEPENDS
   1.167 @@ -765,11 +767,11 @@
   1.168  			fi
   1.169  		done
   1.170  	else
   1.171 -		echo ""
   1.172 +		newline
   1.173  		eval_gettext \
   1.174  "Leaving dependencies for \$PACKAGE unresolved. The package is installed but
   1.175  will probably not work."; echo
   1.176 -		echo ""
   1.177 +		newline
   1.178  	fi
   1.179  }
   1.180  
   1.181 @@ -792,11 +794,11 @@
   1.182  	# Set correct ending messages.
   1.183  	if [ "$packages" = "" ]; then
   1.184  		eval_gettext "0 installed packages found for : \$PATTERN"; echo
   1.185 -		echo ""
   1.186 +		newline
   1.187  	else
   1.188  		separator
   1.189  		eval_gettext "\$packages installed package(s) found for : \$PATTERN"; echo
   1.190 -		echo ""
   1.191 +		newline
   1.192  	fi
   1.193  }
   1.194  
   1.195 @@ -811,19 +813,19 @@
   1.196  		packages=$(($packages + `grep -is "$PATTERN" $i | wc -l`))
   1.197  	done
   1.198  	if [ ! -f "$LOCALSTATE/packages.list" ]; then
   1.199 -		echo ""
   1.200 +		newline
   1.201  		gettext \
   1.202  "No 'packages.list' found to check for mirrored packages. For more results,
   1.203  please run 'tazpkg recharge' once as root before searching."; echo
   1.204 -		echo ""
   1.205 +		newline
   1.206  	fi
   1.207  	if [ "$packages" = "0" ]; then
   1.208  		eval_gettext "0 available packages found for : \$PATTERN"; echo
   1.209 -		echo ""
   1.210 +		newline
   1.211  	else
   1.212  		separator
   1.213  		eval_gettext "\$packages available package(s) found for : \$PATTERN"; echo
   1.214 -		echo ""
   1.215 +		newline
   1.216  	fi
   1.217  }
   1.218  
   1.219 @@ -839,19 +841,19 @@
   1.220  		packages=$(($packages + `grep -is "^$PATTERN" $i | wc -l`))
   1.221  	done
   1.222  	if [ ! -f "$LOCALSTATE/packages.txt" ]; then
   1.223 -		echo ""
   1.224 +		newline
   1.225  		gettext \
   1.226  "No 'packages.txt' found to check for mirrored packages. For more results,
   1.227  please run 'tazpkg recharge' once as root before searching."; echo
   1.228 -		echo ""
   1.229 +		newline
   1.230  	fi
   1.231  	if [ "$packages" = "0" ]; then
   1.232  		eval_gettext "0 available packages found for : \$PATTERN"; echo
   1.233 -		echo ""
   1.234 +		newline
   1.235  	else
   1.236  		separator
   1.237  		eval_gettext "\$packages available package(s) found for : \$PATTERN"; echo
   1.238 -		echo ""
   1.239 +		newline
   1.240  	fi
   1.241  }
   1.242  
   1.243 @@ -910,14 +912,14 @@
   1.244  	if [ -f "$1/mirror" ]; then
   1.245  		cp -f $1/mirror $1/mirror.bak
   1.246  	fi
   1.247 -	echo ""
   1.248 +	newline
   1.249  	boldify "$(gettext "Current mirror(s)")"
   1.250  	separator
   1.251  	echo "  `cat $1/mirror 2> /dev/null`"
   1.252  	gettext \
   1.253  "Please enter URL of the new mirror (http, ftp or local path). You must specify
   1.254  the complete address to the directory of the packages and packages.list file."; echo
   1.255 -	echo ""
   1.256 +	newline
   1.257  	gettext "New mirror(s) URL : "
   1.258  	NEW_MIRROR_URL=$2
   1.259  	if [ -n "$NEW_MIRROR_URL" ]; then
   1.260 @@ -934,7 +936,7 @@
   1.261  			echo "$i" >> $1/mirror
   1.262  		done
   1.263  	fi
   1.264 -	echo ""
   1.265 +	newline
   1.266  }
   1.267  
   1.268  # recursive dependencies scan
   1.269 @@ -1418,7 +1420,7 @@
   1.270  	list|-l)
   1.271  		# List all installed packages or a specific category.
   1.272  		if [ "$2" = "blocked" ]; then
   1.273 -			echo ""
   1.274 +			newline
   1.275  			echo -e "\033[1m`gettext \"Blocked packages\"`\033[0m"
   1.276  			separator
   1.277  			if [ -s "$BLOCKED" ];then
   1.278 @@ -1426,11 +1428,11 @@
   1.279  			else
   1.280  				gettext "No blocked packages found."; echo
   1.281  			fi
   1.282 -			echo "" && exit 0
   1.283 +			newline && exit 0
   1.284  		fi
   1.285  		# Display the list of categories.
   1.286  		if [ "$2" = "cat" -o "$2" = "categories" ]; then
   1.287 -			echo ""
   1.288 +			newline
   1.289  			echo -e "\033[1m`gettext \"Packages categories\"`\033[0m"
   1.290  			separator
   1.291  			for i in $CATEGORIES
   1.292 @@ -1440,14 +1442,14 @@
   1.293  			done
   1.294  			separator
   1.295  			eval_gettext "\$categories categories"; echo
   1.296 -			echo ""
   1.297 +			newline
   1.298  			exit 0
   1.299  		fi
   1.300 +		newline
   1.301  		# Check for an asked category.
   1.302  		if [ -n "$2" ]; then
   1.303  			ASKED_CATEGORY_I18N=$2
   1.304  			ASKED_CATEGORY=$(reverse_translate_category $2)
   1.305 -			echo ""
   1.306  			echo -e "\033[1m`gettext \"Installed packages of category:\"`\033[0m $ASKED_CATEGORY_I18N"
   1.307  			separator
   1.308  			for pkg in $INSTALLED/*
   1.309 @@ -1462,11 +1464,11 @@
   1.310  				fi
   1.311  			done
   1.312  			separator
   1.313 -			eval_gettext "\$packages packages installed of category \$ASKED_CATEGORY_I18N."; echo
   1.314 -			echo ""
   1.315 +			echo -n $(colorize 32 "$packages ")
   1.316 +			echo -n $(boldify $(gettext "packages installed of category:"))
   1.317 +			colorize 34 " $ASKED_CATEGORY_I18N"
   1.318  		else
   1.319  			# By default list all packages and versions.
   1.320 -			echo ""
   1.321  			echo -e "\033[1m`gettext \"List of all installed packages\"`\033[0m"
   1.322  			separator
   1.323  			for pkg in $INSTALLED/*
   1.324 @@ -1480,64 +1482,67 @@
   1.325  				packages=$(($packages+1))
   1.326  			done
   1.327  			separator
   1.328 -			eval_gettext "\$packages packages installed."; echo
   1.329 -			echo ""
   1.330 -		fi ;;
   1.331 -	list-mirror)
   1.332 +			echo -n $(colorize 32 "$packages ")
   1.333 +			boldify $(gettext "packages installed")
   1.334 +		fi && newline ;;
   1.335 +	list-mirror|-lm)
   1.336  		# List all available packages on the mirror. Option --diff displays
   1.337  		# last mirrored packages diff (see recharge).
   1.338  		check_for_packages_list
   1.339  		case $2 in
   1.340  			--diff)
   1.341  				if [ -f "$LOCALSTATE/packages.diff" ]; then
   1.342 -					echo ""
   1.343 +					newline
   1.344  					echo -e "\033[1m`gettext \"Mirrored packages diff\"`\033[0m"
   1.345  					separator
   1.346  					cat $LOCALSTATE/packages.diff
   1.347  					separator
   1.348  					pkgs=`cat $LOCALSTATE/packages.diff | wc -l`
   1.349  					eval_gettext "\$pkgs new packages listed on the mirror."; echo
   1.350 -					echo ""
   1.351 +					newline
   1.352  				else
   1.353 -					echo ""
   1.354 +					newline
   1.355  					gettext "Unable to list anything, no packages.diff found."; echo
   1.356  					gettext "Recharge your current list to create a first diff."; echo
   1.357 -					echo ""
   1.358 +					newline
   1.359  				fi && exit 0 ;;
   1.360  			--text|--txt)
   1.361 -				echo ""
   1.362 +				newline
   1.363  				echo -e "\033[1m`gettext \"List of available packages on the mirror\"`\033[0m"
   1.364  				separator
   1.365  				cat $LOCALSTATE/packages.txt ;;
   1.366  			--raw|*)
   1.367 -				echo ""
   1.368 +				newline
   1.369  				echo -e "\033[1m`gettext \"List of available packages on the mirror\"`\033[0m"
   1.370  				separator
   1.371  				cat $LOCALSTATE/packages.list ;;
   1.372  		esac
   1.373  		separator
   1.374 -		pkgs=`cat $LOCALSTATE/packages.list | wc -l`
   1.375 -		eval_gettext "\$pkgs packages in the last recharged list."; echo
   1.376 -		echo "" ;;
   1.377 -	list-files)
   1.378 +		pkgs=$(cat $LOCALSTATE/packages.list | wc -l)
   1.379 +		echo -n $(colorize 32 "$pkgs ")
   1.380 +		boldify $(gettext "packages in the last recharged list")
   1.381 +		newline ;;
   1.382 +	list-files|-lf)
   1.383  		# List files installed with the package.
   1.384  		check_for_package_on_cmdline
   1.385  		check_for_receipt
   1.386 -		echo ""
   1.387 -		echo -e "\033[1m`gettext \"Installed files with:\"`\033[0m $PACKAGE"
   1.388 +		newline
   1.389 +		echo -n $(boldify $(gettext "Installed files by:"))
   1.390 +		colorize 32 " $PACKAGE"
   1.391  		separator
   1.392  		cat $INSTALLED/$PACKAGE/files.list | sort
   1.393  		separator
   1.394 -		files=`cat $INSTALLED/$PACKAGE/files.list | wc -l`
   1.395 -		eval_gettext "\$files files installed with \$PACKAGE."; echo
   1.396 -		echo "" ;;
   1.397 +		files=$(cat $INSTALLED/$PACKAGE/files.list | wc -l)
   1.398 +		echo -n $(colorize 32 "$files ")
   1.399 +		eval_gettext "files installed with \$PACKAGE"; newline
   1.400 +		newline ;;
   1.401  	info)
   1.402  		# Information about package.
   1.403  		check_for_package_on_cmdline
   1.404  		check_for_receipt
   1.405  		EXTRAVERSION=""
   1.406  		. $INSTALLED/$PACKAGE/receipt
   1.407 -		echo ""
   1.408 +		newline
   1.409  		echo -e "\033[1m`gettext \"Tazpkg information\"`\033[0m
   1.410  ================================================================================
   1.411  `gettext \"Package    :\"` $PACKAGE
   1.412 @@ -1561,34 +1566,34 @@
   1.413  			echo -e "`gettext \"Web site   :\"` $WEB_SITE"
   1.414  		fi
   1.415  		separator
   1.416 -		echo "" ;;
   1.417 +		newline ;;
   1.418  	desc)
   1.419  		# Display package description.txt if available.
   1.420  		if [ -f "$INSTALLED/$PACKAGE/description.txt" ]; then
   1.421 -			echo ""
   1.422 +			newline
   1.423  			echo -e "\033[1m`gettext \"Description of:\"`\033[0m $PACKAGE"
   1.424  			separator
   1.425  			cat $INSTALLED/$PACKAGE/description.txt
   1.426  			separator
   1.427 -			echo ""
   1.428 +			newline
   1.429  		else
   1.430 -			echo ""
   1.431 +			newline
   1.432  			gettext "Sorry, no description available for this package."; echo
   1.433 -			echo ""
   1.434 +			newline
   1.435  		fi ;;
   1.436  	search|-s)
   1.437  		# Search for a package by pattern or name.
   1.438  		PATTERN="$2"
   1.439  		if [ -z "$PATTERN" ]; then
   1.440 -			echo ""
   1.441 +			newline
   1.442  			gettext "Please specify a pattern or package name to search for."; echo
   1.443  			gettext "Example : 'tazpkg search paint'"; echo
   1.444 -			echo ""
   1.445 +			newline
   1.446  			exit 0
   1.447  		fi
   1.448 -		echo ""
   1.449 +		newline
   1.450  		echo -e "\033[1m`gettext \"Search result for:\"`\033[0m $PATTERN"
   1.451 -		echo ""
   1.452 +		newline
   1.453  		# Default is to search in installed pkgs and the raw list.
   1.454  		case $3 in
   1.455  			-i|--installed)
   1.456 @@ -1604,13 +1609,13 @@
   1.457  	search-file|-sf)
   1.458  		# Search for a file by pattern or name in all files.list.
   1.459  		if [ -z "$2" ]; then
   1.460 -			echo ""
   1.461 +			newline
   1.462  			gettext "Please specify a pattern or file name to search for."; echo
   1.463  			gettext "Example : 'tazpkg search-file libnss'"; echo
   1.464 -			echo ""
   1.465 +			newline
   1.466  			exit 0
   1.467  		fi
   1.468 -		echo ""
   1.469 +		newline
   1.470  		echo -e "\033[1m`gettext \"Search result for file\"`\033[0m $2"
   1.471  		separator
   1.472  
   1.473 @@ -1642,7 +1647,7 @@
   1.474  		do
   1.475  			if grep -qs "$2" $pkg/files.list; then
   1.476  				. $pkg/receipt
   1.477 -				echo ""
   1.478 +				newline
   1.479  				echo -e "\033[1m`gettext \"Package\"` $PACKAGE:\033[0m"
   1.480  				grep "$2" $pkg/files.list
   1.481  				files=`grep $2 $pkg/files.list | wc -l`
   1.482 @@ -1654,23 +1659,23 @@
   1.483  		pkg=$2
   1.484  		if [ "$match" = "" ]; then
   1.485  			eval_gettext "0 file found for: \$pkg"; echo
   1.486 -			echo ""
   1.487 +			newline
   1.488  		else
   1.489 -			echo ""
   1.490 +			newline
   1.491  			separator
   1.492  			eval_gettext "\$match file(s) found for: \$pkg"; echo
   1.493 -			echo ""
   1.494 +			newline
   1.495  		fi ;;
   1.496  	search-pkgname)
   1.497  		# Search for a package name
   1.498  		if [ -z "$2" ]; then
   1.499 -			echo ""
   1.500 +			newline
   1.501  			gettext "Please specify a pattern or file name to search for."; echo
   1.502  			gettext "Example : 'tazpkg search-pkgname libnss'"; echo
   1.503 -			echo ""
   1.504 +			newline
   1.505  			exit 0
   1.506  		fi
   1.507 -		echo ""
   1.508 +		newline
   1.509  		echo -e "\033[1m`gettext \"Search result for file\"`\033[0m $2"
   1.510  		separator
   1.511  
   1.512 @@ -1685,12 +1690,12 @@
   1.513  		file=$2
   1.514  		if [ "$match" = "" ]; then
   1.515  			eval_gettext "0 file found for : \$file"; echo
   1.516 -			echo ""
   1.517 +			newline
   1.518  		else
   1.519 -			echo ""
   1.520 +			newline
   1.521  			separator
   1.522  			eval_gettext "$match pkg(s) found with file: \$file"; echo
   1.523 -			echo ""
   1.524 +			newline
   1.525  		fi
   1.526  		;;
   1.527  	install|-i)
   1.528 @@ -1728,11 +1733,11 @@
   1.529  		# Install a set of packages from a list.
   1.530  		check_root
   1.531  		if [ -z "$2" ]; then
   1.532 -			echo ""
   1.533 +			newline
   1.534  			gettext \
   1.535  "Please change directory (cd) to the packages repository and specify the
   1.536  list of packages to install. Example : tazpkg install-list packages.list"
   1.537 -			echo "" && exit 0
   1.538 +			newline && exit 0
   1.539  		fi
   1.540  		# Check if the packages list exist.
   1.541  		list_file=$2
   1.542 @@ -1781,10 +1786,10 @@
   1.543  		# Change curent release and upgrade packages.
   1.544  		RELEASE=$2
   1.545  		if [ -z "$RELEASE" ]; then
   1.546 -			echo ""
   1.547 +			newline
   1.548  			gettext "Please specify the release you want on the command line."; echo
   1.549  			gettext "Example: tazpkg set-release cooking"; echo
   1.550 -			echo ""
   1.551 +			newline
   1.552  			exit 0
   1.553  		fi
   1.554  		rm $LOCALSTATE/mirror
   1.555 @@ -1807,7 +1812,7 @@
   1.556  
   1.557  		[ "$root" ] && ROOT="$root"
   1.558  		if [ ! -f "$ROOT$INSTALLED/$PACKAGE/receipt" ]; then
   1.559 -			echo ""
   1.560 +			newline
   1.561  			eval_gettext "\$PACKAGE is not installed."; echo
   1.562  			exit 0
   1.563  		else
   1.564 @@ -1824,7 +1829,7 @@
   1.565  			EXTRAVERSION=""
   1.566  			. $ROOT$INSTALLED/$THE_PACKAGE/receipt
   1.567  		fi
   1.568 -		echo ""
   1.569 +		newline
   1.570  		if [ -n "$ALTERED" ]; then
   1.571  			eval_gettext "The following packages depend on \$PACKAGE:"; echo
   1.572  			for i in $ALTERED; do
   1.573 @@ -1846,7 +1851,7 @@
   1.574  			echo -n " (`translate_querry y`/`translate_querry N`) : "; read answer
   1.575  		fi
   1.576  		if [ "$answer" = "$(translate_querry y)" ]; then
   1.577 -			echo ""
   1.578 +			newline
   1.579  			echo -e "\033[1m`gettext \"Removing:\"`\033[0m $PACKAGE"
   1.580  			separator
   1.581  			# Pre remove commands.
   1.582 @@ -1917,15 +1922,15 @@
   1.583  				fi
   1.584  			fi
   1.585  		else
   1.586 -			echo ""
   1.587 +			newline
   1.588  			eval_gettext "Uninstallation of \$PACKAGE cancelled."; echo
   1.589  		fi
   1.590 -		echo "" ;;
   1.591 -	extract)
   1.592 +		newline ;;
   1.593 +	extract|-e)
   1.594  		# Extract .tazpkg cpio archive into a directory.
   1.595  		check_for_package_on_cmdline
   1.596  		check_for_package_file
   1.597 -		echo ""
   1.598 +		newline
   1.599  		echo -e "\033[1m`gettext \"Extracting:\"`\033[0m $PACKAGE"
   1.600  		separator
   1.601  		# If no directory destination is found on the cmdline
   1.602 @@ -1943,12 +1948,12 @@
   1.603  		extract_package
   1.604  		separator
   1.605  		eval_gettext "\$PACKAGE is extracted to: \$DESTDIR"; echo
   1.606 -		echo "" ;;
   1.607 +		newline ;;
   1.608  	recompress)
   1.609  		# Recompress .tazpkg cpio archive with lzma.
   1.610  		check_for_package_on_cmdline
   1.611  		check_for_package_file
   1.612 -		echo ""
   1.613 +		newline
   1.614  		echo -e "\033[1m`gettext \"Recompressing:\"`\033[0m $PACKAGE"
   1.615  		separator
   1.616  		mkdir -p $TMP_DIR
   1.617 @@ -1992,7 +1997,7 @@
   1.618  			cd $TOP_DIR
   1.619  			rm -rf $TMP_DIR
   1.620  		else
   1.621 -			echo ""
   1.622 +			newline
   1.623  			echo -e "\033[1m`gettext \"Configuration files\"`\033[0m"
   1.624  			separator
   1.625  			for i in $INSTALLED/*/volatile.cpio.gz; do
   1.626 @@ -2001,7 +2006,7 @@
   1.627  				zcat $i | cpio -t --quiet
   1.628  			done | sed 's|^|/|' | sort
   1.629  			separator
   1.630 -			echo ""
   1.631 +			newline
   1.632  		fi ;;
   1.633  	repack-config)
   1.634  		# Create SliTaz package archive from configuration files.
   1.635 @@ -2044,7 +2049,7 @@
   1.636  		check_for_receipt
   1.637  		EXTRAVERSION=""
   1.638  		. $INSTALLED/$PACKAGE/receipt
   1.639 -		echo ""
   1.640 +		newline
   1.641  		echo -e "\033[1mRepacking :\033[0m $PACKAGE-$VERSION$EXTRAVERSION.tazpkg"
   1.642  		separator
   1.643  		if grep -qs ^NO_REPACK= $INSTALLED/$PACKAGE/receipt; then
   1.644 @@ -2104,16 +2109,17 @@
   1.645  		\rm -R $TMP_DIR
   1.646  		eval_gettext "Package \$PACKAGE repacked successfully."; echo
   1.647  		echo -e "`gettext \"Size\"` : `du -sh $PACKAGE-$VERSION$EXTRAVERSION.tazpkg`"
   1.648 -		echo "" ;;
   1.649 +		newline ;;
   1.650  	pack)
   1.651 -		# Create SliTaz package archive using cpio and gzip.
   1.652 +		# Create SliTaz package archive using cpio and lzma.
   1.653 +		# TODO: Cook also pack packages, we should share code in libpkg.sh
   1.654  		check_for_package_on_cmdline
   1.655  		cd $PACKAGE
   1.656  		if [ ! -f "receipt" ]; then
   1.657  			gettext "Receipt is missing. Please read the documentation."; echo
   1.658  			exit 0
   1.659  		else
   1.660 -			echo ""
   1.661 +			newline
   1.662  			echo -e "\033[1mPacking :\033[0m $PACKAGE"
   1.663  			separator
   1.664  			# Create files.list with redirecting find outpout.
   1.665 @@ -2158,7 +2164,7 @@
   1.666  			separator
   1.667  			eval_gettext "Package \$PACKAGE compressed successfully."; echo
   1.668  			echo "`gettext \"Size\"` : `du -sh $PACKAGE.tazpkg`"
   1.669 -			echo ""
   1.670 +			newline
   1.671  		fi ;;
   1.672  	recharge)
   1.673  		# Recharge packages.list from a mirror.
   1.674 @@ -2210,7 +2216,7 @@
   1.675  				rm ID.bak
   1.676  			fi
   1.677  
   1.678 -			echo ""
   1.679 +			newline
   1.680  			if [ "$path" != "$LOCALSTATE" ]; then
   1.681  				echo -e "`gettext \"Recharging undigest\"` $(basename $path):"
   1.682  			fi
   1.683 @@ -2235,7 +2241,7 @@
   1.684  			if [ -f "packages.list.bak" ]; then
   1.685  				diff -u packages.list.bak packages.list | grep ^+[a-z] > packages.diff
   1.686  				sed -i s/+// packages.diff
   1.687 -				echo ""
   1.688 +				newline
   1.689  				echo -e "\033[1m`gettext \"Mirrored packages diff\"`\033[0m"
   1.690  				separator
   1.691  				cat packages.diff
   1.692 @@ -2243,10 +2249,10 @@
   1.693  				if [ "$new_pkgs" != 0 ]; then
   1.694  					separator
   1.695  					eval_gettext "\$new_pkgs new packages on the mirror."; echo
   1.696 -					echo ""
   1.697 +					newline
   1.698  				else
   1.699  					gettext "No new packages on the mirror."; echo
   1.700 -					echo ""
   1.701 +					newline
   1.702  				fi
   1.703  			else
   1.704  				echo -e "
   1.705 @@ -2255,7 +2261,7 @@
   1.706  "Last packages.list is ready to use. Note that next time you recharge the
   1.707  list, a list of differences will be displayed to show new and upgradeable
   1.708  packages."
   1.709 -			echo ""
   1.710 +			newline
   1.711  			fi
   1.712  		done ;;
   1.713  	up|upgrade|--help-up)
   1.714 @@ -2303,7 +2309,7 @@
   1.715  		$(echo -n $(indent 48 $(gettext "Status")))
   1.716  		separator
   1.717  		cd $INSTALLED
   1.718 -		echo "" > $UP_LIST
   1.719 +		newline > $UP_LIST
   1.720  		blocked_count=0
   1.721  		for pkg in *
   1.722  		do
   1.723 @@ -2385,7 +2391,7 @@
   1.724  					exit 0 ;;
   1.725  			esac
   1.726  		fi
   1.727 -		echo "" ;;
   1.728 +		newline ;;
   1.729  	bugs)
   1.730  		# Show known bugs in package(s)
   1.731  		cd $INSTALLED
   1.732 @@ -2399,7 +2405,7 @@
   1.733  			. $PACKAGE/receipt
   1.734  			if [ -n "$BUGS" ]; then
   1.735  				MSG=$(gettext "Bug list completed")
   1.736 -				echo ""
   1.737 +				newline
   1.738  				eval_gettext "Bugs in package \$PACKAGE version \$VERSION\$EXTRAVERSION:"; echo
   1.739  				cat <<EOT
   1.740    $BUGS
   1.741 @@ -2483,7 +2489,7 @@
   1.742  					if [ -f $pkg/modifiers ]; then
   1.743  						echo -en " (`gettext \"overridden by\"`) $(echo "$(cat $pkg/modifiers)"))"
   1.744  					fi
   1.745 -					echo ""
   1.746 +					newline
   1.747  				done
   1.748  			done
   1.749  			MSG="$(gettext "No package has installed the following files"):\n"
   1.750 @@ -2500,10 +2506,10 @@
   1.751  		# Add a pkg name to the list of blocked packages.
   1.752  		check_root
   1.753  		check_for_package_on_cmdline
   1.754 -		echo ""
   1.755 +		newline
   1.756  		if grep -qs "^$PACKAGE" $BLOCKED; then
   1.757  			eval_gettext "\$PACKAGE is already in the blocked packages list."; echo
   1.758 -			echo ""
   1.759 +			newline
   1.760  			exit 0
   1.761  		else
   1.762  			eval_gettext "Add \$PACKAGE to : \$BLOCKED..."
   1.763 @@ -2513,12 +2519,12 @@
   1.764  			. $INSTALLED/$PACKAGE/receipt
   1.765  			log Blocked
   1.766  		fi
   1.767 -		echo "" ;;
   1.768 +		newline ;;
   1.769  	unblock)
   1.770  		# Remove a pkg name from the list of blocked packages.
   1.771  		check_root
   1.772  		check_for_package_on_cmdline
   1.773 -		echo ""
   1.774 +		newline
   1.775  		if grep -qs "^$PACKAGE" $BLOCKED; then
   1.776  			eval_gettext "Removing \$PACKAGE from : \$BLOCKED..."
   1.777  			sed -i s/$PACKAGE/''/ $BLOCKED
   1.778 @@ -2529,10 +2535,10 @@
   1.779  			log Unblocked
   1.780  		else
   1.781  			eval_gettext "\$PACKAGE is not in the blocked packages list."; echo
   1.782 -			echo ""
   1.783 +			newline
   1.784  			exit 0
   1.785  		fi
   1.786 -		echo "" ;;
   1.787 +		newline ;;
   1.788  	get)
   1.789  		# Downlowd a package with wget.
   1.790  		check_root
   1.791 @@ -2627,7 +2633,7 @@
   1.792  				download $PACKAGE.tazpkg
   1.793  			fi
   1.794  		else
   1.795 -			echo ""
   1.796 +			newline
   1.797  			download $PACKAGE.tazpkg
   1.798  		fi
   1.799  		PACKAGE_FILE=$CACHE_DIR/$PACKAGE.tazpkg
   1.800 @@ -2640,7 +2646,7 @@
   1.801  		# Remove all downloaded packages.
   1.802  		check_root
   1.803  		files=$(find $CACHE_DIR -name *.tazpkg | wc -l)
   1.804 -		echo ""
   1.805 +		newline
   1.806  		boldify "$(gettext "Clean cache:") $CACHE_DIR"
   1.807  		separator
   1.808  		gettext "Cleaning cache directory..."
   1.809 @@ -2655,7 +2661,7 @@
   1.810  				echo "$(basename $(dirname $i))|$(cat $i)"
   1.811  			done
   1.812  		else
   1.813 -			echo ""
   1.814 +			newline
   1.815  			boldify "$(gettext "Current undigest(s)")"
   1.816  			separator
   1.817  			for i in $LOCALSTATE/undigest/*/mirror; do
   1.818 @@ -2665,7 +2671,7 @@
   1.819  				fi
   1.820  				echo "$(basename $(dirname $i))	$(cat $i)"
   1.821  			done
   1.822 -			echo ""
   1.823 +			newline
   1.824  		fi ;;
   1.825  	remove-undigest)
   1.826  		# remove undigest URL.
   1.827 @@ -2701,7 +2707,7 @@
   1.828  			mkdir $LOCALSTATE/undigest/$undigest
   1.829  		fi
   1.830  		setup_mirror $LOCALSTATE/undigest/$undigest $3 ;;
   1.831 -	setup-mirror)
   1.832 +	setup-mirror|-sm)
   1.833  		# Change mirror URL.
   1.834  		check_root
   1.835  		setup_mirror $LOCALSTATE $2 ;;
   1.836 @@ -2729,14 +2735,14 @@
   1.837  				# Log this activity
   1.838  				[ -n "$ROOT" ] || log Reconfigured
   1.839  			else
   1.840 -				echo ""
   1.841 +				newline
   1.842  				eval_gettext "Nothing to do for \$PACKAGE."; echo
   1.843  			fi
   1.844  		else
   1.845 -			echo ""
   1.846 +			newline
   1.847  			eval_gettext "Package \$PACKAGE is not installed."; echo
   1.848  			gettext "Install package with 'tazpkg install' or 'tazpkg get-install'"; echo
   1.849 -			echo ""
   1.850 +			newline
   1.851  		fi ;;
   1.852  	shell)
   1.853  		# Tazpkg SHell
   1.854 @@ -2747,11 +2753,11 @@
   1.855  		fi
   1.856  		if [ ! "$2" = "--noheader" ]; then
   1.857  			clear
   1.858 -			echo ""
   1.859 +			newline
   1.860  			echo -e "\033[1m`gettext \"Tazpkg SHell\"`.\033[0m"
   1.861  			separator
   1.862  			gettext "Type 'usage' to list all available commands or 'quit' or 'q' to exit."; echo
   1.863 -			echo ""
   1.864 +			newline
   1.865  		fi
   1.866  		while true
   1.867  		do
   1.868 @@ -2832,20 +2838,20 @@
   1.869  			eval_gettext "Missing : \$i"; echo
   1.870  		done
   1.871  		if [ -n "$MISSING" ]; then
   1.872 -			echo ""
   1.873 +			newline
   1.874  			gettext "Link all missing dependencies"
   1.875  			echo -n " (`translate_querry y`/`translate_querry N`) ? "
   1.876  			read answer
   1.877 -			echo ""
   1.878 +			newline
   1.879  			if [ "$answer" = "$(translate_querry y)" ]; then
   1.880  				for i in $MISSING; do
   1.881  					tazpkg link $i $TARGET_DIR
   1.882  				done
   1.883  			else
   1.884 -				echo ""
   1.885 -				eval_gettext "Leaving dependencies for \$PACKAGE unresolved."; echo
   1.886 -				gettext "The package is installed but probably will not work."; echo
   1.887 -				echo ""
   1.888 +				newline
   1.889 +				gettext "Leaving dependencies unresolved for:"; echo " $PACKAGE"
   1.890 +				gettext "The package is installed but probably will not work."; newline
   1.891 +				newline
   1.892  			fi
   1.893  		fi
   1.894  		. $INSTALLED/$PACKAGE/receipt