tazpkg rev 653

tazpkg: some clean up and fix clean chache cont
author Christophe Lincoln <pankso@slitaz.org>
date Sun Feb 16 13:06:34 2014 +0100 (2014-02-16)
parents a78eec2822e9
children cdbf3b175b19
files tazpkg
line diff
     1.1 --- a/tazpkg	Sun Feb 16 12:42:43 2014 +0100
     1.2 +++ b/tazpkg	Sun Feb 16 13:06:34 2014 +0100
     1.3 @@ -17,7 +17,7 @@
     1.4  # Script variables #
     1.5  ####################
     1.6  
     1.7 -# TazPkg version
     1.8 +# TazPKG version
     1.9  VERSION=5.2
    1.10  
    1.11  . /etc/slitaz/slitaz.conf
    1.12 @@ -58,7 +58,7 @@
    1.13  }
    1.14  
    1.15  #
    1.16 -# TazPkg output functions
    1.17 +# TazPKG output functions
    1.18  #
    1.19  # Print localized title
    1.20  title() { newline; boldify "$(eval_gettext "$1")"; separator; }
    1.21 @@ -148,7 +148,7 @@
    1.22    clean-cache|-cc  $(gettext 'Clean all packages downloaded in cache directory.')
    1.23    depends          $(gettext 'Display dependencies tree.')
    1.24    rdepends         $(gettext 'Display reverse dependencies tree.')
    1.25 -  convert          $(gettext 'Convert a deb/rpm/tgz/pet/sfs/sb/arch/ipk package to a slitaz (.tazpkg).')
    1.26 +  convert          $(gettext 'Convert deb/rpm/tgz/pet/sfs/sb/arch/ipk package to tazpkg).')
    1.27    link             $(gettext 'Link a package from another slitaz installation.')
    1.28    setup-mirror|-sm $(gettext 'Change the mirror url configuration.')
    1.29    list-undigest    $(gettext 'List undigest mirrors.')
    1.30 @@ -162,9 +162,9 @@
    1.31  
    1.32  usage_up() {
    1.33  	cat << EOT
    1.34 -$(emsg "<b>$(gettext 'TazPkg usage for command up:')</b>")
    1.35 -  tazpkg up [$(gettext 'option')]
    1.36 -* $(gettext 'Without options run in interactive mode and ask before install')
    1.37 +$(emsg "<b>$(gettext 'Usage for command up:')</b>") tazpkg up [$(gettext 'option')]
    1.38 +
    1.39 + * $(gettext 'Without options run in interactive mode and ask before install')
    1.40  
    1.41  $(boldify "$(gettext 'Where options are:')")
    1.42    --check    |-c   $(gettext 'Check only for available upgrades')
    1.43 @@ -189,7 +189,7 @@
    1.44  	fi
    1.45  }
    1.46  
    1.47 -# Check if the directories and files used by TazPkg
    1.48 +# Check if the directories and files used by TazPKG
    1.49  # exist. If not and user is root we create them.
    1.50  check_base_dir()
    1.51  {
    1.52 @@ -287,9 +287,10 @@
    1.53  {
    1.54  	if [ -n "$(get_installed_package_pathname $PACKAGE $1)" ]; then
    1.55  		newline
    1.56 -		eval_gettext "\$PACKAGE package is already installed.
    1.57 -You can use the --forced option to force installation or remove it
    1.58 -and reinstall."; echo
    1.59 +		cat << EOT
    1.60 +$(colorize 34 $PACKAGE) $(gettext "package is already installed.
    1.61 +You can use the --forced option to force installation.")
    1.62 +EOT
    1.63  		newline
    1.64  		exit 0
    1.65  	fi
    1.66 @@ -501,13 +502,9 @@
    1.67  	cpio -idm --quiet < ${PACKAGE_FILE##*/} && rm -f ${PACKAGE_FILE##*/}
    1.68  	status
    1.69  	if [ -f fs.cpio.lzma ]; then
    1.70 -		action "Extracting the pseudo fs..."
    1.71  		unlzma -c fs.cpio.lzma | cpio -idm --quiet && rm fs.cpio.lzma
    1.72 -		status
    1.73  	elif [ -f fs.cpio.gz ]; then
    1.74 -		action "Extracting the pseudo fs..."
    1.75  		zcat fs.cpio.gz | cpio -idm --quiet && rm fs.cpio.gz
    1.76 -		status
    1.77  	fi
    1.78  }
    1.79  
    1.80 @@ -1620,7 +1617,7 @@
    1.81  }
    1.82  
    1.83  ###################
    1.84 -# TazPkg commands #
    1.85 +# TazPKG commands #
    1.86  ###################
    1.87  
    1.88  case "$COMMAND" in
    1.89 @@ -1731,7 +1728,7 @@
    1.90  		check_for_receipt
    1.91  		EXTRAVERSION=""
    1.92  		. $INSTALLED/$PACKAGE/receipt
    1.93 -		title 'TazPkg information'
    1.94 +		title 'TazPKG information'
    1.95  		# Display localized short description
    1.96  		if [ -e "$LOCALSTATE/packages-desc.$LANG" ]; then
    1.97  			LOCDESC=$(grep -e "^$PACKAGE	" $LOCALSTATE/packages-desc.$LANG | cut -d'	' -f2)
    1.98 @@ -2818,19 +2815,22 @@
    1.99  		[ "$AUTOEXEC" != "no" ] && $PACKAGE $ROOT
   1.100  		update_desktop_database $ROOT
   1.101  		update_mime_database $ROOT ;;
   1.102 +	
   1.103  	clean-cache|-cc)
   1.104  		# Remove all downloaded packages.
   1.105  		check_root $@
   1.106  		files=$(find $CACHE_DIR -name *.tazpkg | wc -l)
   1.107 -		title 'Clean cache: $CACHE_DIR'
   1.108 +		title 'Path: $CACHE_DIR'
   1.109  		action "Cleaning cache directory..."
   1.110  		rm -rf $CACHE_DIR/*
   1.111  		status
   1.112 -		num=$(emsg "<c 32>$new_pkgs</c>")
   1.113 -		footer "$(eval_ngettext \
   1.114 -			'$num file removed from cache.' \
   1.115 -			'$num files removed from cache.' $files)"
   1.116 -		;;
   1.117 +		num=$(colorize 32 "$files")
   1.118 +		if [ "$files" == 0 ]; then
   1.119 +			footer "$(eval_gettext '$num file removed from cache.')"
   1.120 +		else
   1.121 +			footer "$(eval_gettext '$num files removed from cache.')"
   1.122 +		fi ;;
   1.123 +	
   1.124  	list-undigest)
   1.125  		# list undigest URLs.
   1.126  		if [ "$2" = "--box" ]; then
   1.127 @@ -2920,7 +2920,7 @@
   1.128  			newline
   1.129  		fi ;;
   1.130  	shell)
   1.131 -		# TazPkg SHell
   1.132 +		# TazPKG SHell
   1.133  		if test $(id -u) = 0 ; then
   1.134  			PROMPT="\\033[1;33mtazpkg\\033[0;39m# "
   1.135  		else
   1.136 @@ -2928,7 +2928,7 @@
   1.137  		fi
   1.138  		if [ ! "$2" = "--noheader" ]; then
   1.139  			clear
   1.140 -			title 'TazPkg SHell.'
   1.141 +			title 'TazPKG SHell.'
   1.142  			gettext "Type 'usage' to list all available commands or 'quit' or 'q' to exit."; echo
   1.143  			newline
   1.144  		fi
   1.145 @@ -2939,7 +2939,7 @@
   1.146  				q|quit)
   1.147  					break ;;
   1.148  				shell)
   1.149 -					gettext "You are already running a TazPkg SHell."; echo ;;
   1.150 +					gettext "You are already running a TazPKG SHell."; echo ;;
   1.151  				su)
   1.152  					su -c 'exec tazpkg shell --noheader' && break ;;
   1.153  				"")