tazpkg rev 187 2.5

Add undigest support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Oct 27 23:12:36 2008 +0000 (2008-10-27)
parents 7e9bd92fa8b5
children 3db7dbf0fe52
files lib/tazpkgbox/list lib/tazpkgbox/package_infos tazpkg tazpkgbox
line diff
     1.1 --- a/lib/tazpkgbox/list	Sun Oct 26 20:21:13 2008 -0700
     1.2 +++ b/lib/tazpkgbox/list	Mon Oct 27 23:12:36 2008 +0000
     1.3 @@ -4,13 +4,28 @@
     1.4  # List mirrored packages using the packages.desc file.
     1.5  #
     1.6  
     1.7 +undigest_list()
     1.8 +{
     1.9 +	IFS="|"
    1.10 +	if [ -n "$1" ]; then
    1.11 +		cat /var/lib/tazpkg/undigest/$1/packages.desc
    1.12 +	else
    1.13 +		cat /var/lib/tazpkg/undigest/*/packages.desc
    1.14 +	fi 2> /dev/null | sort | while read PACKAGE VERSION SHORT_DESC; do
    1.15 +		echo "$PACKAGE|$VERSION|$SHORT_DESC"
    1.16 +	done
    1.17 +	unset IFS
    1.18 +}
    1.19 +
    1.20  installable_list()
    1.21  {
    1.22  	IFS="|"
    1.23 +	cat /var/lib/tazpkg/packages.desc \
    1.24 +	    /var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | sort | \
    1.25  	while read PACKAGE VERSION SHORT_DESC; do
    1.26  		[ -d /var/lib/tazpkg/installed/${PACKAGE%% *} ] && continue
    1.27  		echo "$PACKAGE|$VERSION|$SHORT_DESC"
    1.28 -	done < /var/lib/tazpkg/packages.desc 2> /dev/null
    1.29 +	done
    1.30  	unset IFS
    1.31  }
    1.32  
    1.33 @@ -49,6 +64,13 @@
    1.34  		else
    1.35  			installable_list | grep "$CAT"
    1.36  		fi ;;
    1.37 +	undigest)
    1.38 +		set -- `cat /tmp/tazpkgbox/undigest-category`
    1.39 +		if [ "$1" == "all" -o "$1" == "" ]; then
    1.40 +			undigest_list $2
    1.41 +		else
    1.42 +			undigest_list $2 | grep "$1"
    1.43 +		fi ;;
    1.44  	mirrored)
    1.45  		CAT=`cat /tmp/tazpkgbox/mirrored-category`
    1.46  		if [ "$CAT" == "all" ]; then
    1.47 @@ -59,7 +81,7 @@
    1.48  	blocked)
    1.49  		blocked_list;;
    1.50  	*)
    1.51 -		echo "Usage: /usr/lib/slitaz/tazpkgbox/list [installed|installable|mirrored|blocked]" ;;
    1.52 +		echo "Usage: /usr/lib/slitaz/tazpkgbox/list [installed|installable|mirrored|undigest|blocked]" ;;
    1.53  esac
    1.54  
    1.55  exit 0
     2.1 --- a/lib/tazpkgbox/package_infos	Sun Oct 26 20:21:13 2008 -0700
     2.2 +++ b/lib/tazpkgbox/package_infos	Mon Oct 27 23:12:36 2008 +0000
     2.3 @@ -41,8 +41,11 @@
     2.4  fi
     2.5  
     2.6  if [ "$1" = "list_files_mirror" ]; then
     2.7 -	unlzma -c /var/lib/tazpkg/files.list.lzma | grep -- "^$2:" | \
     2.8 -		awk '{ print substr($0,index($0,":")+2) }'
     2.9 +	for i in /var/lib/tazpkg/files.list.lzma \
    2.10 +		/var/lib/tazpkg/undigest/*/files.list.lzma ; do
    2.11 +		[ -f $i ] || continue
    2.12 +		unlzma -c $i
    2.13 +	done | grep -- "^$2:" | awk '{ print substr($0,index($0,":")+2) }'
    2.14  	exit 0
    2.15  fi
    2.16  
    2.17 @@ -65,11 +68,16 @@
    2.18  	<item icon=\"tazpkg\">$i|$VERSION|Installed|$SHORT_DESC</item>
    2.19  "
    2.20  			else
    2.21 -				RES=`grep "^$i " /var/lib/tazpkg/packages.desc`
    2.22 +				RES=`grep -sh "^$i " \
    2.23 +				/var/lib/tazpkg/packages.desc \
    2.24 +				/var/lib/tazpkg/undigest/*/packages.desc`
    2.25  				PACKAGE=`echo "$RES" | cut -d "|" -f 1`
    2.26  				VERSION=`echo "$RES" | cut -d "|" -f 2`
    2.27  				SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
    2.28 -				SIZE=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1 | sed 's/.*(\(.*\) .*/\1/'`
    2.29 +				SIZE=`grep -sh -A 3 "^$(echo $PACKAGE)$" \
    2.30 +				/var/lib/tazpkg/packages.txt \
    2.31 +				/var/lib/tazpkg/undigest/*/packages.txt | \
    2.32 +				tail -1 | sed 's/.*(\(.*\) .*/\1/'`
    2.33  				LIST_PKGS="$LIST_PKGS
    2.34  	<item icon=\"tazpkg\">$i|$VERSION|$SIZE|$SHORT_DESC</item>
    2.35  "
    2.36 @@ -236,13 +244,15 @@
    2.37  "
    2.38  	export PACKAGE_INFOS
    2.39  else
    2.40 -	RES=`grep "^$PKG " /var/lib/tazpkg/packages.desc`
    2.41 +	RES=`grep -sh "^$PKG " /var/lib/tazpkg/packages.desc \
    2.42 +		/var/lib/tazpkg/undigest/*/packages.desc`
    2.43  	PACKAGE=`echo "$RES" | cut -d "|" -f 1`
    2.44  	VERSION=`echo "$RES" | cut -d "|" -f 2`
    2.45  	SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
    2.46  	CATEGORY=`echo "$RES" | cut -d "|" -f 4`
    2.47  	WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
    2.48 -	SIZES=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1`
    2.49 +	SIZES=`grep -sh -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt \
    2.50 +		/var/lib/tazpkg/undigest/*/packages.txt | tail -1`
    2.51  	PACKAGE_INFOS="
    2.52  <window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
    2.53  <vbox>
     3.1 --- a/tazpkg	Sun Oct 26 20:21:13 2008 -0700
     3.2 +++ b/tazpkg	Mon Oct 27 23:12:36 2008 +0000
     3.3 @@ -13,7 +13,7 @@
     3.4  #           Pascal Bellard <pascal.bellard@slitaz.org>
     3.5  #           Eric Joseph-Alexandre <erjo@slitaz.org>
     3.6  #
     3.7 -VERSION=2.4.1
     3.8 +VERSION=2.5
     3.9  
    3.10  ####################
    3.11  # Script variables #
    3.12 @@ -120,7 +120,11 @@
    3.13    set-release      Change release and update packages
    3.14    clean-cache      Clean all packages downloaded in cache directory.
    3.15    setup-mirror     Change the mirror url configuration.
    3.16 -  reconfigure	   Replay post install script from package."
    3.17 +  list-undigest    List undigest mirrors.
    3.18 +  remove-undigest  Remove an undigest mirror.
    3.19 +  add-undigest     Add an undigest mirror.
    3.20 +  setup-undigest   Update an undigest mirror.
    3.21 +  reconfigure      Replay post install script from package."
    3.22  }
    3.23  
    3.24  # Status function with color (supported by Ash).
    3.25 @@ -228,8 +232,11 @@
    3.26  check_for_package_in_list()
    3.27  {
    3.28  	local pkg
    3.29 -	pkg=$(grep "^$PACKAGE-[0-9]" $LOCALSTATE/packages.list | head -1)
    3.30 -	[ -n "$pkg" ] || pkg=$(grep "^$PACKAGE-.[\.0-9]" $LOCALSTATE/packages.list | head -1)
    3.31 +	pkg=$(grep -sh "^$PACKAGE-[0-9]" $LOCALSTATE/packages.list \
    3.32 +		$LOCALSTATE/undigest/*/packages.list | head -1)
    3.33 +	[ -n "$pkg" ] || pkg=$(grep -sh "^$PACKAGE-.[\.0-9]" \
    3.34 +		$LOCALSTATE/packages.list \
    3.35 +		$LOCALSTATE/undigest/*/packages.list | head -1)
    3.36  	if [ -n "$pkg" ]; then
    3.37  		PACKAGE=$pkg
    3.38  	else
    3.39 @@ -247,14 +254,27 @@
    3.40  	echo "$DATE - $1 - $PACKAGE ($VERSION$EXTRAVERSION)" >> $LOG
    3.41  }
    3.42  
    3.43 +# Download a file from this mirror
    3.44 +download_from()
    3.45 +{
    3.46 +	local i
    3.47 +	local mirrors
    3.48 +	mirrors="$1"
    3.49 +	shift
    3.50 +	for i in $mirrors; do
    3.51 +		case "$i" in
    3.52 +		http://*|ftp://*) wget -c $i$@ && break;;
    3.53 +		*) cp $i/$1 . && break;;
    3.54 +		esac
    3.55 +	done
    3.56 +}
    3.57 +
    3.58  # Download a file trying all mirrors
    3.59  download()
    3.60  {
    3.61 -	for i in $(cat $MIRROR); do
    3.62 -		case "$i" in
    3.63 -		http://*|ftp://*) wget -c $i$@ && break;;
    3.64 -		*) cp $i$1 . && break;;
    3.65 -		esac
    3.66 +	local i
    3.67 +	for i in $(cat $MIRROR $LOCALSTATE/undigest/*/mirror 2> /dev/null); do
    3.68 +		download_from "$i" "$@"
    3.69  	done
    3.70  }
    3.71  
    3.72 @@ -622,10 +642,12 @@
    3.73  {
    3.74  	echo "Available packages name-version"
    3.75  	echo "================================================================================"
    3.76 -	if [ -f "$LOCALSTATE/packages.list" ]; then
    3.77 -		cat $LOCALSTATE/packages.list | grep -i "$PATTERN"
    3.78 -		packages=`cat $LOCALSTATE/packages.list | grep "$PATTERN" | wc -l`
    3.79 -	else
    3.80 +	packages=0
    3.81 +	for i in $LOCALSTATE/packages.list $LOCALSTATE/undigest/*/packages.list; do
    3.82 +		grep -is "$PATTERN" $i
    3.83 +		packages=$(($packages + `grep -is "$PATTERN" $i | wc -l`))
    3.84 +	done
    3.85 +	if [ ! -f "$LOCALSTATE/packages.list" ]; then
    3.86  		echo -e "
    3.87  No 'packages.list' found to check for mirrored packages. For more results,
    3.88  please run 'tazpkg recharge' once as root before searching.\n"
    3.89 @@ -646,10 +668,12 @@
    3.90  {
    3.91  	echo "Matching packages name with version and desc"
    3.92  	echo "================================================================================"
    3.93 -	if [ -f "$LOCALSTATE/packages.txt" ]; then
    3.94 -		cat $LOCALSTATE/packages.txt | grep -A 2 "^$PATTERN"
    3.95 -		packages=`cat $LOCALSTATE/packages.txt | grep -i "^$PATTERN" | wc -l`
    3.96 -	else
    3.97 +	packages=0
    3.98 +	for i in $LOCALSTATE/packages.txt $LOCALSTATE/undigest/*/packages.txt; do
    3.99 +		grep -is -A 2 "^$PATTERN" $i
   3.100 +		packages=$(($packages + `grep -is "^$PATTERN" $i | wc -l`))
   3.101 +	done
   3.102 +	if [ ! -f "$LOCALSTATE/packages.txt" ]; then
   3.103  		echo -e "
   3.104  No 'packages.txt' found to check for mirrored packages. For more results,
   3.105  please run 'tazpkg recharge' once as root before searching.\n"
   3.106 @@ -708,6 +732,40 @@
   3.107  	rm -rf $TMP_DIR
   3.108  }
   3.109  
   3.110 +# Update mirror urls
   3.111 +setup_mirror()
   3.112 +{
   3.113 +	# Backup old list.
   3.114 +	if [ -f "$1/mirror" ]; then
   3.115 +		cp -f $1/mirror $1/mirror.bak
   3.116 +	fi
   3.117 +	echo ""
   3.118 +	echo -e "\033[1mCurrent mirror(s)\033[0m"
   3.119 +	echo "================================================================================"
   3.120 +	echo "  `cat $1/mirror 2> /dev/null`"
   3.121 +	echo "
   3.122 +Please enter URL of the new mirror (http, ftp or local path). You must specify
   3.123 +the complete address to the directory of the packages and packages.list file."
   3.124 +	echo ""
   3.125 +	echo -n "New mirror(s) URL : "
   3.126 +	NEW_MIRROR_URL=$2
   3.127 +	if [ -n "$NEW_MIRROR_URL" ]; then
   3.128 +		echo $NEW_MIRROR_URL
   3.129 +	else
   3.130 +		read NEW_MIRROR_URL
   3.131 +	fi
   3.132 +	if [ "$NEW_MIRROR_URL" = "" ]; then
   3.133 +		echo "Nothing has been changed."
   3.134 +	else
   3.135 +		echo "Setting mirror(s) to : $NEW_MIRROR_URL"
   3.136 +		rm -f $1/mirror
   3.137 +		for i in $NEW_MIRROR_URL; do
   3.138 +			echo "$i" >> $1/mirror
   3.139 +		done 
   3.140 +	fi
   3.141 +	echo ""
   3.142 +}
   3.143 +
   3.144  ###################
   3.145  # Tazpkg commands #
   3.146  ###################
   3.147 @@ -951,7 +1009,11 @@
   3.148  
   3.149  		if [ "$3" == "--mirror" ]; then
   3.150  		
   3.151 -		unlzma -c $LOCALSTATE/files.list.lzma | grep -- ".*:.*$2" | awk '
   3.152 +			match=0
   3.153 +			for i in $LOCALSTATE/files.list.lzma \
   3.154 +				 $LOCALSTATE/undigest/*/files.list.lzma; do
   3.155 +				 [ -f $i ] || continue
   3.156 +				unlzma -c $i | grep -- ".*:.*$2" | awk '
   3.157                              BEGIN { last="" }
   3.158                              {
   3.159  			    	pkg=substr($0,0,index($0,":")-1);
   3.160 @@ -962,8 +1024,8 @@
   3.161  				}
   3.162                                  printf("%s\n",file);
   3.163                              }'
   3.164 -		match=`unlzma -c $LOCALSTATE/files.list.lzma | \
   3.165 -			grep -- ".*:.*$2" | wc -l`
   3.166 +				match=$(($match + `unlzma -c $i | grep -- ".*:.*$2" | wc -l`))
   3.167 +			done
   3.168  
   3.169  		else
   3.170  
   3.171 @@ -1397,43 +1459,51 @@
   3.172  		# Recharge packages.list from a mirror.
   3.173  		#
   3.174  		check_root
   3.175 -		cd $LOCALSTATE
   3.176 -		echo ""
   3.177 -		if [ -f "$LOCALSTATE/packages.list" ]; then
   3.178 -			echo -n "Creating backup of the last packages list..."
   3.179 -			mv -f packages.desc packages.desc.bak 2>/dev/null
   3.180 -			mv -f packages.txt packages.txt.bak 2>/dev/null
   3.181 -			mv -f packages.list packages.list.bak 2>/dev/null
   3.182 -			mv -f packages.equiv packages.equiv.bak 2>/dev/null
   3.183 -			mv -f files.list.lzma files.list.lzma.bak 2> /dev/nul
   3.184 -			status
   3.185 -		fi
   3.186 -		download packages.desc
   3.187 -		download packages.txt
   3.188 -		download packages.list
   3.189 -		download packages.equiv
   3.190 -		download files.list.lzma
   3.191 -		if [ -f "$LOCALSTATE/packages.list.bak" ]; then
   3.192 -			diff -u packages.list.bak packages.list | grep ^+[a-z] > packages.diff
   3.193 -			sed -i s/+// packages.diff
   3.194 +		for path in $LOCALSTATE $LOCALSTATE/undigest/*; do
   3.195 +			[ -f $path/mirror ] || continue
   3.196  			echo ""
   3.197 -			echo -e "\033[1mMirrored packages diff\033[0m"
   3.198 -			echo "================================================================================"
   3.199 -			cat packages.diff
   3.200 -			if [ ! "`cat packages.diff | wc -l`" = 0 ]; then
   3.201 +			if [ "$path" != "$LOCALSTATE" ]; then
   3.202 +				echo "Recharge undigest $(basename $path):"
   3.203 +			fi
   3.204 +			cd $path
   3.205 +			if [ -f "packages.list" ]; then
   3.206 +				echo -n "Creating backup of the last packages list..."
   3.207 +				mv -f packages.desc packages.desc.bak 2>/dev/null
   3.208 +				mv -f packages.md5 packages.md5.txt 2>/dev/null
   3.209 +				mv -f packages.txt packages.txt.bak 2>/dev/null
   3.210 +				mv -f packages.list packages.list.bak 2>/dev/null
   3.211 +				mv -f packages.equiv packages.equiv.bak 2>/dev/null
   3.212 +				mv -f files.list.lzma files.list.lzma.bak 2> /dev/nul
   3.213 +				status
   3.214 +			fi
   3.215 +			download_from "$(cat mirror)" packages.desc
   3.216 +			download_from "$(cat mirror)" packages.md5
   3.217 +			download_from "$(cat mirror)" packages.txt
   3.218 +			download_from "$(cat mirror)" packages.list
   3.219 +			download_from "$(cat mirror)" packages.equiv
   3.220 +			download_from "$(cat mirror)" files.list.lzma
   3.221 +			if [ -f "packages.list.bak" ]; then
   3.222 +				diff -u packages.list.bak packages.list | grep ^+[a-z] > packages.diff
   3.223 +				sed -i s/+// packages.diff
   3.224 +				echo ""
   3.225 +				echo -e "\033[1mMirrored packages diff\033[0m"
   3.226  				echo "================================================================================"
   3.227 -				echo "`cat packages.diff | wc -l` new packages on the mirror."
   3.228 -				echo ""
   3.229 +				cat packages.diff
   3.230 +				if [ ! "`cat packages.diff | wc -l`" = 0 ]; then
   3.231 +					echo "================================================================================"
   3.232 +					echo "`cat packages.diff | wc -l` new packages on the mirror."
   3.233 +					echo ""
   3.234 +				else
   3.235 +					echo "`cat packages.diff | wc -l` new packages on the mirror."
   3.236 +					echo ""
   3.237 +				fi
   3.238  			else
   3.239 -				echo "`cat packages.diff | wc -l` new packages on the mirror."
   3.240 -				echo ""
   3.241 -			fi
   3.242 -		else
   3.243 -			echo -e "
   3.244 +				echo -e "
   3.245  ================================================================================
   3.246  Last packages.list is ready to use. Note that next time you recharge the list,
   3.247  a list of differencies will be displayed to show new and upgradeable packages.\n"
   3.248 -		fi
   3.249 +			fi
   3.250 +		done
   3.251  		;;
   3.252  	upgrade)
   3.253  		# Upgrade all installed packages with the new version from the mirror.
   3.254 @@ -1784,31 +1854,68 @@
   3.255  		echo "$files file(s) removed from cache."
   3.256  		echo ""
   3.257  		;;
   3.258 +	list-undigest)
   3.259 +		# list undigest URLs.
   3.260 +		#
   3.261 +		if [ "$2" = "--box" ]; then
   3.262 +			for i in $LOCALSTATE/undigest/*/mirror; do
   3.263 +				[ -f $i ] || continue
   3.264 +				echo "$(basename $(dirname $i))|$(cat $i)"
   3.265 +			done
   3.266 +		else
   3.267 +			echo ""
   3.268 +			echo -e "\033[1mCurrent undigest(s)\033[0m"
   3.269 +			echo "================================================================================"
   3.270 +			for i in $LOCALSTATE/undigest/*/mirror; do
   3.271 +				if [ ! -f $i ]; then
   3.272 +					echo "No undigest mirror found."
   3.273 +					exit 1
   3.274 +				fi
   3.275 +				echo "$(basename $(dirname $i))	$(cat $i)"
   3.276 +			done
   3.277 +			echo ""
   3.278 +		fi
   3.279 +		;;
   3.280 +	remove-undigest)
   3.281 +		# remove undigest URL.
   3.282 +		#
   3.283 +		check_root
   3.284 +		if [ -d $LOCALSTATE/undigest/$2 ]; then
   3.285 +			echo -n "Remove $2 undigest (y/N) ? "; read anser
   3.286 +			if [ "$anser" = "y" ]; then
   3.287 +				echo -n "Removing $2 undigest..."
   3.288 +				rm -rf $LOCALSTATE/undigest/$2
   3.289 +				status
   3.290 +				rmdir $LOCALSTATE/undigest 2> /dev/null
   3.291 +			fi
   3.292 +		else
   3.293 +			echo "Undigest $2 not found"
   3.294 +		fi
   3.295 +		;;
   3.296 +	add-undigest|setup-undigest)
   3.297 +		# Add undigest URL.
   3.298 +		#
   3.299 +		check_root
   3.300 +		undigest=$2
   3.301 +		[ -d $LOCALSTATE/undigest ] || mkdir $LOCALSTATE/undigest
   3.302 +		if [ -z "$undigest" ]; then
   3.303 +			i=1
   3.304 +			while [ -d $LOCALSTATE/undigest/$i ]; do
   3.305 +				i=$(($i+1))
   3.306 +			done
   3.307 +			undigest=$i
   3.308 +		fi
   3.309 +		if [ ! -d $LOCALSTATE/undigest/$undigest ]; then
   3.310 +			echo "Creating new undigest $undigest."
   3.311 +			mkdir $LOCALSTATE/undigest/$undigest
   3.312 +		fi
   3.313 +		setup_mirror $LOCALSTATE/undigest/$undigest $3
   3.314 +		;;
   3.315  	setup-mirror)
   3.316  		# Change mirror URL.
   3.317  		#
   3.318  		check_root
   3.319 -		# Backup old list.
   3.320 -		if [ -f "$LOCALSTATE/mirror" ]; then
   3.321 -			cp -f $LOCALSTATE/mirror $LOCALSTATE/mirror.bak
   3.322 -		fi
   3.323 -		echo ""
   3.324 -		echo -e "\033[1mCurrent mirror(s)\033[0m"
   3.325 -		echo "================================================================================"
   3.326 -		echo "  `cat $MIRROR`"
   3.327 -		echo "
   3.328 -Please enter URL of the new mirror (http or ftp). You must specify the complete
   3.329 -address to the directory of the packages and packages.list file."
   3.330 -		echo ""
   3.331 -		echo -n "New mirror URL : "
   3.332 -		read NEW_MIRROR_URL
   3.333 -		if [ "$NEW_MIRROR_URL" = "" ]; then
   3.334 -			echo "Nothing has been changed."
   3.335 -		else
   3.336 -			echo "Setting mirror(s) to : $NEW_MIRROR_URL"
   3.337 -			echo "$NEW_MIRROR_URL" > $LOCALSTATE/mirror
   3.338 -		fi
   3.339 -		echo ""
   3.340 +		setup_mirror $LOCALSTATE $2
   3.341  		;;
   3.342  	reconfigure)
   3.343  		# Replay post_install from receipt
     4.1 --- a/tazpkgbox	Sun Oct 26 20:21:13 2008 -0700
     4.2 +++ b/tazpkgbox	Mon Oct 27 23:12:36 2008 +0000
     4.3 @@ -6,7 +6,7 @@
     4.4  #
     4.5  # (C) GNU gpl v3 - SliTaz GNU/Linux 2008.
     4.6  #
     4.7 -VERSION=2.3
     4.8 +VERSION=2.5
     4.9  
    4.10  # Tazpkgbox is only for root.
    4.11  if test $(id -u) != 0 ; then
    4.12 @@ -25,6 +25,7 @@
    4.13  echo "all" > /tmp/tazpkgbox/installed-category
    4.14  echo "all" > /tmp/tazpkgbox/installable-category
    4.15  echo "all" > /tmp/tazpkgbox/mirrored-category
    4.16 +echo "all" > /tmp/tazpkgbox/undigest-category
    4.17  echo "" > /tmp/tazpkgbox/search-installed
    4.18  echo "" > /tmp/tazpkgbox/search-mirrored
    4.19  
    4.20 @@ -97,6 +98,58 @@
    4.21  </window>
    4.22  '
    4.23  
    4.24 +export SETUP_UNDIGEST='
    4.25 +<window title="undigest mirrors" icon-name="tazpkg">
    4.26 +  <vbox>
    4.27 +	<tree>
    4.28 +		<width>560</width><height>160</height>
    4.29 +		<variable>UNDIGEST_LIST</variable>
    4.30 +		<label>Name | URL</label>
    4.31 +		<input>tazpkg list-undigest --box</input>
    4.32 +		<action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_LIST; sleep 2"</action>
    4.33 +	</tree>
    4.34 +	<hbox>
    4.35 +		<text>
    4.36 +			<label>URL:</label>
    4.37 +		</text>
    4.38 +		<entry>
    4.39 +			<variable>UNDIGEST_URL</variable>
    4.40 +		</entry>
    4.41 +	</hbox>
    4.42 +	<hbox>
    4.43 +		<text>
    4.44 +			<label>Name:</label>
    4.45 +		</text>
    4.46 +		<entry>
    4.47 +			<variable>UNDIGEST_NAME</variable>
    4.48 +		</entry>
    4.49 +		<button>
    4.50 +			<label>Add</label>
    4.51 +			<input file icon="gtk-add"></input>
    4.52 +			<action>tazpkg add-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
    4.53 +			<action>refresh:UNDIGEST_LIST</action>
    4.54 +		</button>
    4.55 +		<button>
    4.56 +			<label>Remove</label>
    4.57 +			<input file icon="gtk-remove"></input>
    4.58 +			<action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_NAME; sleep 2"</action>
    4.59 +			<action>refresh:UNDIGEST_LIST</action>
    4.60 +		</button>
    4.61 +		<button>
    4.62 +			<label>Update</label>
    4.63 +			<input file icon="reload"></input>
    4.64 +			<action>tazpkg setup-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
    4.65 +			<action>refresh:UNDIGEST_LIST</action>
    4.66 +		</button>
    4.67 +		<button>
    4.68 +			<input file icon="gtk-close"></input>
    4.69 +			<action type="closewindow">SETUP_UNDIGEST</action>
    4.70 +		</button>
    4.71 +	</hbox>
    4.72 +  </vbox>
    4.73 +</window>
    4.74 +'
    4.75 +
    4.76  # Main dialog
    4.77  export TAZPKG_DIALOG='
    4.78  <window title="SliTaz Packages Manager" icon-name="package-x-generic">
    4.79 @@ -111,7 +164,7 @@
    4.80  		</pixmap>
    4.81  	</hbox>
    4.82  
    4.83 -	<notebook labels="Installed|Installable|Mirrored|Blocked|Search|Configuration">
    4.84 +	<notebook labels="Installed|Installable|Mirrored|Undigest|Blocked|Search|Configuration">
    4.85  
    4.86  	<vbox>
    4.87  		<tree>
    4.88 @@ -122,6 +175,7 @@
    4.89  			<action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
    4.90  			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
    4.91  			<action>refresh:PKG</action>
    4.92 +			<action>refresh:GETIT</action>
    4.93  			<action>refresh:PKG_STATS</action>
    4.94  			<action>refresh:CACHE_STATS</action>
    4.95  		</tree>
    4.96 @@ -209,6 +263,8 @@
    4.97  				<label>Recharge list</label>
    4.98  				<input file icon="system-software-update"></input>
    4.99  				<action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
   4.100 +				<action>refresh:DEV</action>
   4.101 +				<action>refresh:GET</action>
   4.102  				<action>refresh:GETIT</action>
   4.103  				<action>refresh:PKG_STATS</action>
   4.104  			</button>
   4.105 @@ -224,6 +280,7 @@
   4.106  			<action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
   4.107  			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
   4.108  			<action>refresh:PKG</action>
   4.109 +			<action>refresh:GETIT</action>
   4.110  			<action>refresh:PKG_STATS</action>
   4.111  			<action>refresh:CACHE_STATS</action>
   4.112  		</tree>
   4.113 @@ -259,7 +316,9 @@
   4.114  				<label>Recharge list</label>
   4.115  				<input file icon="system-software-update"></input>
   4.116  				<action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
   4.117 +				<action>refresh:DEV</action>
   4.118  				<action>refresh:GET</action>
   4.119 +				<action>refresh:GETIT</action>
   4.120  				<action>refresh:PKG_STATS</action>
   4.121  			</button>
   4.122  		</hbox>
   4.123 @@ -268,6 +327,73 @@
   4.124  	<vbox>
   4.125  		<tree>
   4.126  			<width>620</width><height>240</height>
   4.127 +			<variable>DEV</variable>
   4.128 +			<label>Package name|Version|Description</label>
   4.129 +			<input>/usr/lib/slitaz/tazpkgbox/list undigest</input>
   4.130 +			<action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
   4.131 +			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
   4.132 +			<action>refresh:PKG</action>
   4.133 +			<action>refresh:GETIT</action>
   4.134 +			<action>refresh:PKG_STATS</action>
   4.135 +			<action>refresh:CACHE_STATS</action>
   4.136 +		</tree>
   4.137 +		<hbox>
   4.138 +			<button>
   4.139 +				<label>Setup undigest mirrors</label>
   4.140 +				<input file icon="go-next"></input>
   4.141 +				<action type="launch">SETUP_UNDIGEST</action>
   4.142 +			</button>
   4.143 +			<button>
   4.144 +				<label>Recharge list</label>
   4.145 +				<input file icon="system-software-update"></input>
   4.146 +				<action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
   4.147 +				<action>refresh:DEV</action>
   4.148 +				<action>refresh:GET</action>
   4.149 +				<action>refresh:GETIT</action>
   4.150 +				<action>refresh:PKG_STATS</action>
   4.151 +			</button>
   4.152 +		</hbox>
   4.153 +		<hbox>
   4.154 +			<text>
   4.155 +				<label>"Undigest:"</label>
   4.156 +			</text>
   4.157 +			<combobox>
   4.158 +				<variable>UNDIGEST_ENTRY</variable>
   4.159 +				<input>echo all; ls /var/lib/tazpkg/undigest 2> /dev/null</input>
   4.160 +			</combobox>
   4.161 +			<text>
   4.162 +				<label>"Category:"</label>
   4.163 +			</text>
   4.164 +			<combobox>
   4.165 +				<variable>UNDIGEST_CAT</variable>
   4.166 +				<item>all</item>
   4.167 +				<item>base-system</item>
   4.168 +				<item>x-window</item>
   4.169 +				<item>utilities</item>
   4.170 +				<item>network</item>
   4.171 +				<item>graphics</item>
   4.172 +				<item>multimedia</item>
   4.173 +				<item>office</item>
   4.174 +				<item>development</item>
   4.175 +				<item>system-tools</item>
   4.176 +				<item>security</item>
   4.177 +				<item>games</item>
   4.178 +				<item>misc</item>
   4.179 +				<item>meta</item>
   4.180 +				<item>non-free</item>
   4.181 +			</combobox>
   4.182 +			<button>
   4.183 +				<label>List</label>
   4.184 +				<input file icon="reload"></input>
   4.185 +				<action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY" > /tmp/tazpkgbox/undigest-category</action>
   4.186 +				<action>refresh:DEV</action>
   4.187 +			</button>
   4.188 +		</hbox>
   4.189 +	</vbox>
   4.190 +
   4.191 +	<vbox>
   4.192 +		<tree>
   4.193 +			<width>620</width><height>240</height>
   4.194  			<variable>BLOCKED</variable>
   4.195  			<label>Package name|Version|Available|Description</label>
   4.196  			<input>/usr/lib/slitaz/tazpkgbox/list blocked</input>
   4.197 @@ -430,7 +556,7 @@
   4.198  
   4.199  	<hbox>
   4.200  		<text wrap="false">
   4.201 -			<input>installed=`ls /var/lib/tazpkg/installed | wc -l`; mirrored=`cat /var/lib/tazpkg/packages.list | wc -l`; blocked=`cat /var/lib/tazpkg/blocked-packages.list | wc -l`; installable=$(($mirrored - $installed)); [ $installable -lt 0 ] && installable=0; echo "Packages: $installed installed, $blocked blocked, $installable installable, $mirrored mirrored, `cat /var/lib/tazpkg/upgradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
   4.202 +			<input>installed=`ls /var/lib/tazpkg/installed | wc -l`; mirrored=`cat /var/lib/tazpkg/packages.list | wc -l`; undigest=`cat /var/lib/tazpkg/undigest/*/packages.list 2> /dev/null | wc -l`; blocked=`cat /var/lib/tazpkg/blocked-packages.list 2> /dev/null | wc -l`; installable=$(($mirrored + $undigest - $installed)); [ $installable -lt 0 ] && installable=0; echo "Packages: $installed installed, $blocked blocked, $installable installable, $undigest undigest, $mirrored mirrored, `cat /var/lib/tazpkg/upgradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
   4.203  			<variable>PKG_STATS</variable>
   4.204  		</text>
   4.205  	</hbox>