tazpkg rev 350

Move all splited functions to libtazpkgbox (easier for translation)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jun 20 23:46:40 2010 +0200 (2010-06-20)
parents 7b162f03d79a
children 4f41dee74425
files Makefile lib/libtazpkgbox lib/tazpkgbox/list lib/tazpkgbox/package_infos lib/tazpkgbox/search tazpkgbox
line diff
     1.1 --- a/Makefile	Sun Jun 20 21:44:57 2010 +0100
     1.2 +++ b/Makefile	Sun Jun 20 23:46:40 2010 +0200
     1.3 @@ -36,7 +36,7 @@
     1.4  	install -m 0777 tazpkgbox $(DESTDIR)$(PREFIX)/bin
     1.5  	# Tazpkgbox GUI
     1.6  	install -m 0755 -d $(DESTDIR)$(LIBDIR)
     1.7 -	cp -a lib/tazpkgbox $(DESTDIR)$(LIBDIR)
     1.8 +	cp -a lib/libtazpkgbox $(DESTDIR)$(LIBDIR)
     1.9  	# Configuration files
    1.10  	install -m 0755 -d $(DESTDIR)$(SYSCONFDIR)
    1.11  	install -m 0644 tazpkg.conf $(DESTDIR)$(SYSCONFDIR)
    1.12 @@ -56,6 +56,7 @@
    1.13  	rm -f $(DESTDIR)$(PREFIX)/bin/tazpkg
    1.14  	rm -f $(DESTDIR)$(PREFIX)/bin/tazpkgbox
    1.15  	rm -rf $(DESTDIR)$(LIBDIR)/tazpkgbox
    1.16 +	rm -f $(DESTDIR)$(LIBDIR)/libtazpkgbox
    1.17  	rm -rf $(DESTDIR)$(DOCDIR)/tazpkg
    1.18  	rm -f $(DESTDIR)$(SYSCONFDIR)/tazpkg.conf 
    1.19  	rm -rf $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/tazpkg*.mo
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/lib/libtazpkgbox	Sun Jun 20 23:46:40 2010 +0200
     2.3 @@ -0,0 +1,695 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# The libtazpkgbox - Libraries used by tazpkg GUI box.
     2.7 +# There is functions to list installed packages in a suitable format for 
     2.8 +# GTK tree and list mirrored packages using the packages.desc file.
     2.9 +#
    2.10 +
    2.11 +export LIB=/usr/lib/slitaz/libtazpkgbox
    2.12 +
    2.13 +usage()
    2.14 +{
    2.15 +	echo -e "\nTazpkgbox library\n
    2.16 +Usage    : $0 [function] [pkg|args]	[pkg]
    2.17 +Functions:
    2.18 +  list-all          List all packages
    2.19 +  list-undigest     List undigest packages
    2.20 +  list-blocked      List blocked packages
    2.21 +  list-upgradeable  List all upgradable packages
    2.22 +  search-packages   Search for packages
    2.23 +  search-files      Search for files
    2.24 +  search-tags       Search for TAGS
    2.25 +  package-infos     Display box with pkg information"
    2.26 +}
    2.27 +
    2.28 +# List functions.
    2.29 +undigest_list()
    2.30 +{
    2.31 +	IFS="|"
    2.32 +	if [ -n "$1" -a "$1" != "all" ]; then
    2.33 +		cat undigest/$1/packages.desc
    2.34 +	else
    2.35 +		cat undigest/*/packages.desc
    2.36 +	fi 2> /dev/null | sort | while read PACKAGE VERSION SHORT_DESC; do
    2.37 +		ICON=tazpkg
    2.38 +		PACKAGE=${PACKAGE%% *}
    2.39 +		if [ -d installed/$PACKAGE ]; then
    2.40 +			[ "$2" == "installable" ] && continue
    2.41 +			ICON=tazpkg-installed
    2.42 +			if grep -qs "^$PACKAGE$" blocked-packages.list; then
    2.43 +				ICON=stop
    2.44 +			fi
    2.45 +		else
    2.46 +			[ "$2" == "installed" ] && continue
    2.47 +		fi
    2.48 +		[ "$2" == "blocked" -a "$ICON" != "stop" ] && continue
    2.49 +		[ "$2" == "upgradeable" ] && 
    2.50 +		! grep -q ^$PACKAGE$ upgradeable-packages.list && continue
    2.51 +		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    2.52 +	done
    2.53 +	unset IFS
    2.54 +}
    2.55 +
    2.56 +installable_list()
    2.57 +{
    2.58 +	local cache
    2.59 +	cache=packages.installable_list.$CAT
    2.60 +	if [ -s $cache -a $cache -nt packages.desc -a $cache -nt installed ]; then
    2.61 +	     cat $cache
    2.62 +	     return
    2.63 +	fi
    2.64 +	IFS="|"
    2.65 +	cat packages.desc undigest/*/packages.desc 2> /dev/null | sort | \
    2.66 +	while read PACKAGE VERSION SHORT_DESC CATEGORY; do
    2.67 +		# Check first for category for more speed.
    2.68 +		CATEGORY=${CATEGORY%| *}
    2.69 +		ICON=tazpkg
    2.70 +		[ $CAT == all -o $CATEGORY == " $CAT " ] || continue
    2.71 +		[ -d installed/${PACKAGE%% *} ] && continue
    2.72 +		grep -qs "^$PACKAGE" undigest/*/packages.desc && ICON=add
    2.73 +		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    2.74 +	done | tee $cache
    2.75 +	unset IFS
    2.76 +}
    2.77 +
    2.78 +installed_list()
    2.79 +{
    2.80 +	for pkg in ${1}installed/*
    2.81 +	do
    2.82 +		[ -n "$1" -a -s installed/$(basename $pkg)/receipt ] && continue
    2.83 +		. $pkg/receipt
    2.84 +		ICON=tazpkg-installed
    2.85 +		[ $CAT == all -o $CATEGORY == $CAT ] || continue
    2.86 +		if [ -n "$1" -o -L $pkg ]; then
    2.87 +			ICON=media-flash
    2.88 +		else
    2.89 +			grep -qs "^$PACKAGE" undigest/*/packages.desc && ICON=add
    2.90 +		fi
    2.91 +		grep -qs "^$PACKAGE$" blocked-packages.list && ICON=stop
    2.92 +		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    2.93 +	done
    2.94 +}
    2.95 +
    2.96 +all_list()
    2.97 +{
    2.98 +	local cache
    2.99 +	cache=packages.all_list.$CAT
   2.100 +	if [ -s $cache -a $cache -nt packages.desc -a $cache -nt installed ]; then
   2.101 +	     cat $cache
   2.102 +	     return
   2.103 +	fi
   2.104 +	( installable_list ; installed_list ) | sort -t \| -k 2 -u | tee $cache
   2.105 +}
   2.106 +
   2.107 +blocked_list()
   2.108 +{
   2.109 +	ICON=tazpkg-installed
   2.110 +	[ "$1" = "blocked" ] && ICON=stop
   2.111 +	for pkg in $(cat $1-packages.list 2> /dev/null); do
   2.112 +		[ -f installed/$pkg/receipt ] || continue
   2.113 +		. installed/$pkg/receipt
   2.114 +		[ $CAT == all -o $CATEGORY == $CAT ] || continue
   2.115 +		AVAILABLE=$(grep -s "^$pkg " packages.desc \
   2.116 +			undigest/*/packages.desc | awk '{ print $3 }')
   2.117 +		echo "$ICON|$PACKAGE|$VERSION (Available: $AVAILABLE)|$SHORT_DESC"
   2.118 +	done
   2.119 +}
   2.120 +
   2.121 +# Search functions
   2.122 +
   2.123 +clean_search()
   2.124 +{
   2.125 +	# Clean preview results.
   2.126 +	rm -f /tmp/tazpkgbox/search
   2.127 +	touch /tmp/tazpkgbox/search
   2.128 +}
   2.129 +
   2.130 +list_files()
   2.131 +{
   2.132 +	sed 's/.\[[01]m//g' | awk 'BEGIN { show=0 } {
   2.133 +		if (/^===/) show=1-show;
   2.134 +		else if (/^Package/) pkg=$2;
   2.135 +		else if ($0 != "" && show != 0) printf("%s %s\n",pkg,$0);
   2.136 +	}' | while read pkg file; do
   2.137 +		[ "$pkg" = "0" ] && continue
   2.138 +		version=$(grep -hs "^$pkg " /var/lib/tazpkg/packages.desc \
   2.139 +		  /var/lib/tazpkg/undigest/*/packages.desc | awk '{ print $3 }')
   2.140 +		if [ -d /var/lib/tazpkg/installed/$pkg ]; then
   2.141 +			if [ -x $file ]; then
   2.142 +				echo "exec|$pkg|$version|$file"
   2.143 +			elif [ -f $file ]; then
   2.144 +				echo "txt|$pkg|$version|$file"
   2.145 +			elif [ -d $file ] ; then
   2.146 +				echo "folder|$pkg|$version|$file"
   2.147 +			else
   2.148 +				# Missing installed file.
   2.149 +				echo "dialog-warning|$pkg|$version|$file"
   2.150 +			fi
   2.151 +		else
   2.152 +			echo "tazpkg|$pkg|$version|$file"
   2.153 +		fi
   2.154 +	done
   2.155 +}
   2.156 +
   2.157 +list_package()
   2.158 +{
   2.159 +		if [ -d /var/lib/tazpkg/installed/$1 ]; then
   2.160 +			. /var/lib/tazpkg/installed/$1/receipt
   2.161 +			echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC"
   2.162 +		else
   2.163 +			echo "tazpkg|$PACKAGE|$VERSION|$SHORT_DESC"
   2.164 +		fi
   2.165 +}
   2.166 +
   2.167 +search_package()
   2.168 +{
   2.169 +	IFS="|"
   2.170 +	cat /var/lib/tazpkg/packages.desc \
   2.171 +	    /var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | sort | \
   2.172 +	while read PACKAGE VERSION SHORT_DESC; do
   2.173 +	if echo "$PACKAGE $SHORT_DESC" | grep -iq "$SEARCH"; then
   2.174 +		list_package ${PACKAGE%% *}
   2.175 +	fi
   2.176 +	done 
   2.177 +	unset IFS
   2.178 +}
   2.179 +
   2.180 +case "$1" in
   2.181 +	list-all)
   2.182 +		cd /var/lib/tazpkg
   2.183 +		CAT=`cat /tmp/tazpkgbox/category`
   2.184 +		STATUS=`cat /tmp/tazpkgbox/status`
   2.185 +		case $STATUS in
   2.186 +			blocked|upgradeable)
   2.187 +				blocked_list $STATUS;;
   2.188 +			linkable)
   2.189 +				[ -d fslink ] && installed_list \
   2.190 +					$(readlink fslink)/var/lib/tazpkg/;;
   2.191 +			installed)
   2.192 +				installed_list ;;
   2.193 +			installable)
   2.194 +				installable_list ;;
   2.195 +			*)
   2.196 +				all_list ;;
   2.197 +		esac ;;
   2.198 +	list-undigest)
   2.199 +		cd /var/lib/tazpkg
   2.200 +		CAT=`cat /tmp/tazpkgbox/category`
   2.201 +		set -- `cat /tmp/tazpkgbox/undigest-category`
   2.202 +		if [ "$1" == "all" -o "$1" == "" ]; then
   2.203 +			undigest_list $2 $3
   2.204 +		else
   2.205 +			undigest_list $2 $3 | grep "$1"
   2.206 +		fi ;;
   2.207 +	list-blocked|list-upgradeable)
   2.208 +		cd /var/lib/tazpkg
   2.209 +		CAT=`cat /tmp/tazpkgbox/category`
   2.210 +		blocked_list $1 ;;
   2.211 +	search-files)
   2.212 +		# Search for files
   2.213 +		clean_search
   2.214 +		tazpkg search-file "$SEARCH" --mirror | list_files > \
   2.215 +			/tmp/tazpkgbox/search ;;
   2.216 +	search-packages)
   2.217 +		clean_search
   2.218 +		( search_package ;
   2.219 +		  for i in $(grep ^$SEARCH= /var/lib/tazpkg/packages.equiv | \
   2.220 +		          cut -d= -f2); do
   2.221 +		        SEARCH=${i#*:}
   2.222 +		        search_package
   2.223 +		  done ) > /tmp/tazpkgbox/search ;;
   2.224 +	search-tags)
   2.225 +		clean_search
   2.226 +		grep -ls TAGS /home/slitaz/wok/*/receipt | while read file; do
   2.227 +			TAGS=""
   2.228 +			. $file
   2.229 +			case "$TAGS" in
   2.230 +			*$SEARCH*) list_package $PACKAGE ;;
   2.231 +			esac
   2.232 +		done > /tmp/tazpkgbox/search ;;
   2.233 +	package-infos)
   2.234 +		# Dialog box to provide package info and actions
   2.235 +		XTERM_OPTS="-geometry 80x16+120+120"	
   2.236 +		PKG=`cat /tmp/tazpkgbox/pkg | sed s/" "/""/g`
   2.237 +		ROOT=/var/lib/tazpkg
   2.238 +		if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   2.239 +			ROOT=$(readlink /var/lib/tazpkg/fslink)$ROOT
   2.240 +		fi
   2.241 +		TMP_DIR=/tmp/tazpkg-$$-$RANDOM
   2.242 +		if [ "$2" = "sizes" ]; then
   2.243 +			cat <<EOT
   2.244 +Dependancies for $3:
   2.245 +$(tazpkg depends $3)
   2.246 +
   2.247 +Reverse dependancies for $3:
   2.248 +$(tazpkg rdepends $3)
   2.249 +EOT
   2.250 +			exit 0
   2.251 +		fi
   2.252 +		if [ "$2" = "info" ]; then
   2.253 +			RECEIPT=$ROOT/installed/$4/receipt
   2.254 +			. $RECEIPT
   2.255 +			case "$3" in
   2.256 +			Web*) browser $WEB_SITE &;;
   2.257 +			Tip*) browser http://hg.slitaz.org/wok/raw-file/tip/$4/receipt &;;
   2.258 +			Siz*) xterm -T "$4 depends (q to quit)" -e "$0 sizes $4 | less";;
   2.259 +			Upg*) xterm -T "$4 upgrade" -e "tazpkg get-install $4 --forced ; sleep 2";;
   2.260 +			Hand*) browser $HANDBOOK_URL &;;
   2.261 +			Sug*) $0 package-infos list_packages $SUGGESTED;;
   2.262 +			Dep*) $0 package-infos list_packages $DEPENDS;;
   2.263 +			Mod*) $0 package-infos list_packages $(xargs echo < $ROOT/installed/$3/modifiers);;
   2.264 +			Con*) tazpkgbox list_config $4;;
   2.265 +			Ver*) xterm -T "$4 receipt (q to quit)" -e "cat $RECEIPT | less";;
   2.266 +			esac
   2.267 +			exit 0
   2.268 +		fi
   2.269 +		
   2.270 +		if [ "$2" = "list_files" ]; then
   2.271 +			CONF_FILES="$(tazpkg list-config $3 | awk "$AWK_FILTER")"
   2.272 +			if [ -n "$CONF_FILES" ]; then
   2.273 +				mkdir $TMP_DIR
   2.274 +				zcat $ROOT/installed/$3/volatile.cpio.gz | \
   2.275 +					( cd $TMP_DIR ; cpio -id > /dev/null )
   2.276 +			fi
   2.277 +			cat $ROOT/installed/$3/files.list | grep ^/ | while read file; do
   2.278 +				realfile="$file"
   2.279 +				if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   2.280 +					realfile="$(readlink /var/lib/tazpkg/fslink)$file"
   2.281 +				fi
   2.282 +				echo -n "$(stat -c "%A|%U|%G|%s|$file|" "$realfile" || \
   2.283 +					   echo "File lost !||||$file|")"
   2.284 +				if [ -L "$realfile" ]; then
   2.285 +					echo -n "$(readlink "$realfile")"
   2.286 +				elif [ -f "$file" ]; then
   2.287 +					case "$CONF_FILES" in
   2.288 +					*$file*) 
   2.289 +						if cmp $file $TMP_DIR$file > /dev/null 2>&1; then
   2.290 +							echo -n "[configuration]"
   2.291 +						else
   2.292 +							echo -n "$(stat -c "[configuration: %.16y]" $file)"
   2.293 +						fi;;
   2.294 +					#*	if [ "$(tazpkg check-file $file $2)" = "failure" ]; then
   2.295 +					#		echo -n "Invalid md5"
   2.296 +					#	fi;;
   2.297 +					esac
   2.298 +				fi
   2.299 +				echo ""
   2.300 +			done
   2.301 +			[ -n "$CONF_FILES" ] && rm -rf $TMP_DIR
   2.302 +			exit 0
   2.303 +		fi
   2.304 +		
   2.305 +		if [ "$2" = "list_files_mirror" ]; then
   2.306 +			for i in /var/lib/tazpkg/files.list.lzma \
   2.307 +				/var/lib/tazpkg/undigest/*/files.list.lzma ; do
   2.308 +				[ -f $i ] || continue
   2.309 +				unlzma -c $i
   2.310 +			done | grep -- "^$3:" | awk '{ print substr($0,index($0,":")+2) }'
   2.311 +			exit 0
   2.312 +		fi
   2.313 +		
   2.314 +		if [ "$2" = "list_packages" ]; then
   2.315 +			PKG="$3"
   2.316 +			if [ -n "$4" ]; then
   2.317 +				shift
   2.318 +				export LIST_PKGS='
   2.319 +		<window title="Packages" icon-name="tazpkg">
   2.320 +		  <vbox>
   2.321 +		     <tree>
   2.322 +			<width>600</width><height>160</height>
   2.323 +			<label>Package|Version|Size|Description</label>
   2.324 +			<variable>PKG</variable>
   2.325 +		'
   2.326 +				for i in "$@"; do
   2.327 +					if [ -d $ROOT/installed/$i ]; then
   2.328 +						. $ROOT/installed/$i/receipt
   2.329 +						LIST_PKGS="$LIST_PKGS
   2.330 +			<item icon=\"tazpkg\">$i|$VERSION|Installed|$SHORT_DESC</item>
   2.331 +		"
   2.332 +					else
   2.333 +						RES=`grep -sh "^$i " \
   2.334 +						/var/lib/tazpkg/packages.desc \
   2.335 +						/var/lib/tazpkg/undigest/*/packages.desc`
   2.336 +						PACKAGE=`echo "$RES" | cut -d "|" -f 1`
   2.337 +						VERSION=`echo "$RES" | cut -d "|" -f 2`
   2.338 +						SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
   2.339 +						SIZE=`grep -sh -A 3 "^$(echo $PACKAGE)$" \
   2.340 +						/var/lib/tazpkg/packages.txt \
   2.341 +						/var/lib/tazpkg/undigest/*/packages.txt | \
   2.342 +						tail -1 | sed 's/.*(\(.*\) .*/\1/'`
   2.343 +						LIST_PKGS="$LIST_PKGS
   2.344 +			<item icon=\"tazpkg\">$i|$VERSION|$SIZE|$SHORT_DESC</item>
   2.345 +		"
   2.346 +					fi
   2.347 +				done
   2.348 +				LIST_PKGS="$LIST_PKGS
   2.349 +			<action>echo "\$PKG" > /tmp/tazpkgbox/pkg</action>
   2.350 +			<action>$0 package-infos</action>
   2.351 +			<action>refresh:PKG</action>
   2.352 +			<action>refresh:PKG_STATS</action>
   2.353 +			<action>refresh:CACHE_STATS</action>
   2.354 +		     </tree>
   2.355 +		     <hbox>
   2.356 +			<button ok>
   2.357 +			</button>
   2.358 +			<button cancel>
   2.359 +				<action type=\"closewindow\">LIST_PKGS</action>
   2.360 +			</button>
   2.361 +		     </hbox>
   2.362 +		  </vbox>
   2.363 +		</window>
   2.364 +		"
   2.365 +				eval `gtkdialog --center --program=LIST_PKGS`
   2.366 +				[ "$EXIT" = "OK" ] || exit 0
   2.367 +			fi
   2.368 +		fi
   2.369 +		
   2.370 +		export LIST_FILES="
   2.371 +		<window title=\"$PKG files\" icon-name=\"system-file-manager\">
   2.372 +		  <vbox>
   2.373 +			<tree exported_column=\"4\">
   2.374 +				<variable>FILE</variable>
   2.375 +				<width>600</width><height>160</height>
   2.376 +				<label>Access | User | Group | Size | Name | Target</label>
   2.377 +				<input> $0 package-infos list_files $PKG </input>
   2.378 +				<action>tazpkg list-config $PKG | grep -q ^\$FILE$ && leafpad \$FILE</action>
   2.379 +			</tree>
   2.380 +			<hbox>
   2.381 +				<button>
   2.382 +					<input file icon=\"gtk-close\"></input>
   2.383 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.384 +				</button>
   2.385 +			</hbox>
   2.386 +		  </vbox>
   2.387 +		</window>
   2.388 +		"
   2.389 +		
   2.390 +		export LIST_FILES_MIRROR="
   2.391 +		<window title=\"$PKG files\" icon-name=\"system-file-manager\">
   2.392 +		  <vbox>
   2.393 +			<tree>
   2.394 +				<width>300</width><height>160</height>
   2.395 +				<label>File Name</label>
   2.396 +				<input> $0 package-infos list_files_mirror $PKG </input>
   2.397 +			</tree>
   2.398 +			<hbox>
   2.399 +				<button>
   2.400 +					<input file icon=\"gtk-close\"></input>
   2.401 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.402 +				</button>
   2.403 +			</hbox>
   2.404 +		  </vbox>
   2.405 +		</window>
   2.406 +		"
   2.407 +		
   2.408 +		# Installed or not installed, that is the question!
   2.409 +		if [ -d $ROOT/installed/$PKG ]; then
   2.410 +			PACKED_SIZE=""
   2.411 +			DEPENDS=""
   2.412 +			MAINTAINER=""
   2.413 +			BUGS=""
   2.414 +			TAGS=""
   2.415 +			. $ROOT/installed/$PKG/receipt
   2.416 +			MAINTAINER=$(echo "$MAINTAINER" | sed 's/[<>|]/ /g')
   2.417 +			upgrade_version="$(cat /var/lib/tazpkg/packages.desc \
   2.418 +				/var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | \
   2.419 +				awk "/^$PACKAGE / { print \$3 }" | head -1 )"
   2.420 +			UPGRADE=""
   2.421 +			if [ -n "$upgrade_version" ]; then
   2.422 +				if [ "$upgrade_version" != "$VERSION" ]; then
   2.423 +					UPGRADE="$upgrade_version"
   2.424 +				else
   2.425 +					cur_md5="$(awk "/ $PACKAGE-$VERSION/ { print \$1 }" \
   2.426 +						$ROOT/installed.md5)"
   2.427 +					new_md5="$(cat /var/lib/tazpkg/packages.md5 \
   2.428 +						/var/lib/tazpkg/undigest/*/packages.md5 \
   2.429 +						2> /dev/null | awk "/ $PACKAGE-$VERSION/ { print \$1 }")"
   2.430 +					if [ -n "$cur_md5" -a -n "$new_md5" -a \
   2.431 +						"$cur_md5" != "$new_md5" ]; then
   2.432 +						UPGRADE="build"
   2.433 +					fi
   2.434 +				fi
   2.435 +			fi
   2.436 +			PACKAGE_INFOS="
   2.437 +		<window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
   2.438 +		<vbox>
   2.439 +		
   2.440 +			<tree>
   2.441 +				<width>460</width><height>200</height>
   2.442 +				<label>$PKG|$SHORT_DESC</label>
   2.443 +				<variable>FIELD</variable>		
   2.444 +				<item icon=\"tazpkg\">Version: | $VERSION</item>
   2.445 +				<item icon=\"tazpkg\">Category: | $CATEGORY</item>"
   2.446 +		[ -n "$UPGRADE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.447 +				<item icon=\"tazpkg\">Upgrade: | $(echo $UPGRADE)</item>"
   2.448 +		[ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.449 +				<item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
   2.450 +		[ -n "$SUGGESTED" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.451 +				<item icon=\"tazpkg\">Suggested: | $(echo $SUGGESTED)</item>"
   2.452 +		[ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.453 +				<item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
   2.454 +		[ -n "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.455 +				<item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
   2.456 +		[ -n "$BUGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.457 +				<item icon=\"important\">Bugs: | $BUGS</item>"
   2.458 +		[ -n "$HANDBOOK_URL" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.459 +				<item icon=\"ascii\">Handbook: | $HANDBOOK_URL</item>"
   2.460 +		[ -n "$TAGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.461 +				<item icon=\"tazpkg\">Tags: | $TAGS</item>"
   2.462 +		[ -n "$CONFIG_FILES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.463 +				<item icon=\"tazpkg\">Config files: | $CONFIG_FILES</item>"
   2.464 +		[ -f $ROOT/installed/$PKG/modifiers ] && 
   2.465 +		PACKAGE_INFOS="$PACKAGE_INFOS
   2.466 +				<item icon=\"tazpkg\">Modified by: | $(xargs echo < $ROOT/installed/$PKG/modifiers)</item>"
   2.467 +		PACKAGE_INFOS="$PACKAGE_INFOS
   2.468 +				<item icon=\"applications-internet\">Website: | $WEB_SITE</item>
   2.469 +				<item icon=\"help\">Tip: | double-click any item for more information</item>
   2.470 +				<action> $0 package-infos info \"\$FIELD\" $PKG </action>		
   2.471 +			</tree>
   2.472 +		
   2.473 +			<hbox>"
   2.474 +		[ -s $ROOT/installed/$PACKAGE/description.txt ] &&
   2.475 +			PACKAGE_INFOS="$PACKAGE_INFOS
   2.476 +				<button>
   2.477 +					<label>Description</label>
   2.478 +					<input file icon=\"help\"></input>
   2.479 +					<action>xterm -T \"$PKG description (q to quit)\" $XTERM_OPTS \
   2.480 +					-e \"less $ROOT/installed/$PKG/description.txt\"</action>
   2.481 +				</button>"
   2.482 +		if [ ! -d /var/lib/tazpkg/fslink ]; then
   2.483 +			[ ${PKG%%-*} = get -a ! -d $ROOT/installed/${PKG#get-} ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.484 +				<button>
   2.485 +					<label>Install</label>
   2.486 +					<input file icon=\"go-next\"></input>
   2.487 +					<action>xterm -T \"Install ${PKG#get-}\" $XTERM_OPTS -e \"\
   2.488 +					$PKG; sleep 5\"</action>
   2.489 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.490 +				</button>"
   2.491 +			[ -n "$UPGRADE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.492 +				<button>
   2.493 +					<label>Upgrade</label>
   2.494 +					<input file icon=\"go-next\"></input>
   2.495 +					<action>xterm -T \"Install $PKG\" $XTERM_OPTS -e \"\
   2.496 +					tazpkg get-install $PKG --forced ; sleep 5\"</action>
   2.497 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.498 +				</button>"
   2.499 +			grep -q post_install $ROOT/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
   2.500 +				<button>
   2.501 +					<label>Reconfigure</label>
   2.502 +					<input file icon=\"reload\"></input>
   2.503 +					<action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
   2.504 +					tazpkg reconfigure $PACKAGE; sleep 2\"</action>
   2.505 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.506 +				</button>"
   2.507 +			if grep -qs ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
   2.508 +				PACKAGE_INFOS="$PACKAGE_INFOS
   2.509 +				<button>
   2.510 +					<label>Unblock</label>
   2.511 +					<input file icon=\"up\"></input>
   2.512 +					<action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
   2.513 +					tazpkg unblock $PACKAGE; sleep 2\"</action>
   2.514 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.515 +				</button>"
   2.516 +			else
   2.517 +				PACKAGE_INFOS="$PACKAGE_INFOS
   2.518 +				<button>
   2.519 +					<label>Block</label>
   2.520 +					<input file icon=\"down\"></input>
   2.521 +					<action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
   2.522 +					tazpkg block $PACKAGE; sleep 2\"</action>
   2.523 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.524 +				</button>"
   2.525 +			fi
   2.526 +		fi
   2.527 +		if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   2.528 +			PACKAGE_INFOS="$PACKAGE_INFOS
   2.529 +				<button>
   2.530 +					<label>Link</label>
   2.531 +					<input file icon=\"edit-redo\"></input>
   2.532 +					<action>xterm -T \"Link $PACKAGE\" $XTERM_OPTS -e \"\
   2.533 +					tazpkg link $PACKAGE $(readlink /var/lib/tazpkg/fslink); sleep 2\"</action>
   2.534 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.535 +				</button>"
   2.536 +		elif [ ! -s $ROOT/installed/$PKG/modifiers ]; then
   2.537 +			[ -L $ROOT/installed/$PKG ] || PACKAGE_INFOS="$PACKAGE_INFOS
   2.538 +				<button>
   2.539 +					<label>Repack</label>
   2.540 +					<input file icon=\"edit-redo\"></input>
   2.541 +					<action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
   2.542 +					cd /var/cache/tazpkg; \
   2.543 +					tazpkg repack $PACKAGE; sleep 2\"</action>
   2.544 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.545 +				</button>
   2.546 +		"
   2.547 +			PACKAGE_INFOS="$PACKAGE_INFOS
   2.548 +				<button>
   2.549 +					<label>Remove</label>
   2.550 +					<input file icon=\"edit-delete\"></input>
   2.551 +					<action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
   2.552 +					tazpkg remove $PACKAGE; sleep 2\"</action>
   2.553 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.554 +				</button>
   2.555 +		"
   2.556 +		else
   2.557 +			PACKAGE_INFOS="$PACKAGE_INFOS
   2.558 +				<button>
   2.559 +					<label>Re-install</label>
   2.560 +					<input file icon=\"edit-redo\"></input>
   2.561 +					<action>xterm -T \"Re-install $PACKAGE\" $XTERM_OPTS -e \"\
   2.562 +					tazpkg get-install $PACKAGE --forced; sleep 2\"</action>
   2.563 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.564 +				</button>
   2.565 +				<button>
   2.566 +					<label>Remove</label>
   2.567 +					<input file icon=\"edit-delete\"></input>
   2.568 +					<action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
   2.569 +					tazpkg remove $PACKAGE; sleep 2\"</action>
   2.570 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.571 +				</button>
   2.572 +		"
   2.573 +		fi
   2.574 +		PACKAGE_INFOS="$PACKAGE_INFOS
   2.575 +				<button>
   2.576 +					<label>View Files</label>
   2.577 +					<input file icon=\"tazpkg\"></input>
   2.578 +					<action type=\"launch\">LIST_FILES</action>
   2.579 +				</button>
   2.580 +				<button>
   2.581 +					<input file icon=\"gtk-close\"></input>
   2.582 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   2.583 +				</button>
   2.584 +			</hbox>
   2.585 +		
   2.586 +		</vbox>
   2.587 +		</window>
   2.588 +		"
   2.589 +			export PACKAGE_INFOS
   2.590 +		else
   2.591 +			RES=`grep -sh "^$PKG " /var/lib/tazpkg/packages.desc \
   2.592 +				/var/lib/tazpkg/undigest/*/packages.desc`
   2.593 +			PACKAGE=`echo "$RES" | cut -d "|" -f 1`
   2.594 +			VERSION=`echo "$RES" | cut -d "|" -f 2`
   2.595 +			SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
   2.596 +			CATEGORY=`echo "$RES" | cut -d "|" -f 4`
   2.597 +			WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
   2.598 +			SIZES=`grep -sh -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt \
   2.599 +				/var/lib/tazpkg/undigest/*/packages.txt | tail -1`
   2.600 +			DEPENDS=""
   2.601 +			SUGGESTED=""
   2.602 +			MAINTAINER=""
   2.603 +			BUGS=""
   2.604 +			HANDBOOK_URL=""
   2.605 +			TAGS=""
   2.606 +			CONFIG_FILES=""
   2.607 +			height=160
   2.608 +			if [ -s /home/slitaz/wok/$PKG/receipt ]; then
   2.609 +				. /home/slitaz/wok/$PKG/receipt
   2.610 +				height=200
   2.611 +			fi
   2.612 +			PACKAGE_INFOS="
   2.613 +		<window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
   2.614 +		<vbox>
   2.615 +		
   2.616 +			<tree>
   2.617 +				<width>460</width><height>$height</height>
   2.618 +				<label>$PKG|$SHORT_DESC</label>
   2.619 +				<variable>FIELD2</variable>
   2.620 +				<item icon=\"tazpkg\">Version: | $VERSION</item>
   2.621 +				<item icon=\"tazpkg\">Category: | $CATEGORY</item>"
   2.622 +			[ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.623 +				<item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
   2.624 +			[ -n "$SUGGESTED" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.625 +				<item icon=\"tazpkg\">Suggested: | $(echo $SUGGESTED)</item>"
   2.626 +			[ -n "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.627 +				<item icon=\"tazpkg\">Size: | $SIZES</item>"
   2.628 +			[ -n "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.629 +				<item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
   2.630 +			[ -n "$BUGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.631 +				<item icon=\"important\">Bugs: | $BUGS</item>"
   2.632 +			[ -n "$HANDBOOK_URL" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.633 +				<item icon=\"ascii\">Handbook: | $HANDBOOK_URL</item>"
   2.634 +			[ -n "$TAGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.635 +				<item icon=\"tazpkg\">Tags: | $TAGS</item>"
   2.636 +			[ -n "$CONFIG_FILES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.637 +				<item icon=\"tazpkg\">Config files: | $CONFIG_FILES</item>"
   2.638 +			PACKAGE_INFOS="$PACKAGE_INFOS
   2.639 +				<item icon=\"applications-internet\">Website: | $WEB_SITE</item>		
   2.640 +				<item icon=\"text-editor\">Receipt: | double-click to view receipt</item>
   2.641 +				<action>case \$FIELD2 in Web*) browser $WEB_SITE &;; esac</action>
   2.642 +				<action>case \$FIELD2 in Rec*) browser http://hg.slitaz.org/wok/raw-file/tip/$PACKAGE/receipt &;; esac</action>
   2.643 +				
   2.644 +			</tree>
   2.645 +		
   2.646 +			<hbox>"
   2.647 +			[ ${PACKAGE%%-*} = get ] && PACKAGE_INFOS="$PACKAGE_INFOS
   2.648 +				<checkbox>
   2.649 +					<label>Auto exec</label>
   2.650 +					<variable>AUTO_EXEC</variable>
   2.651 +					<default>true</default>
   2.652 +				</checkbox>"
   2.653 +			PACKAGE_INFOS="$PACKAGE_INFOS
   2.654 +				<checkbox>
   2.655 +					<label>Auto install depends</label>
   2.656 +					<variable>AUTO_DEPENDS</variable>
   2.657 +					<default>true</default>
   2.658 +				</checkbox>
   2.659 +				<button>
   2.660 +					<label>Install Package</label>
   2.661 +					<input file icon=\"go-next\"></input>
   2.662 +					<action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
   2.663 +					if [ x\$AUTO_DEPENDS != xtrue ]; then script -c \\\"tazpkg get-install $PACKAGE\\\" /var/log/tazpkg-install.log;\
   2.664 +					else script -c \\\"yes y | tazpkg get-install $PACKAGE\\\" /var/log/tazpkg-install.log; fi; \
   2.665 +					[ x\${AUTO_EXEC} = xtrue ] && $PACKAGE; \
   2.666 +					sleep 2\"</action>
   2.667 +					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   2.668 +				</button>
   2.669 +				<button>
   2.670 +					<label>Download</label>
   2.671 +					<input file icon=\"go-next\"></input>
   2.672 +					<action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
   2.673 +					cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
   2.674 +					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   2.675 +				</button>
   2.676 +				<button>
   2.677 +					<label>View Files</label>
   2.678 +					<input file icon=\"tazpkg\"></input>
   2.679 +					<action type=\"launch\">LIST_FILES_MIRROR</action>
   2.680 +				</button>
   2.681 +				<button>
   2.682 +					<input file icon=\"gtk-close\"></input>
   2.683 +					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   2.684 +				</button>
   2.685 +			</hbox>
   2.686 +		
   2.687 +		</vbox>
   2.688 +		</window>
   2.689 +		"
   2.690 +			export PACKAGE_INFOS
   2.691 +		fi
   2.692 +		gtkdialog --center --program=PACKAGE_INFOS ;;
   2.693 +
   2.694 +	*)
   2.695 +		usage ;;
   2.696 +esac
   2.697 +
   2.698 +exit 0
     3.1 --- a/lib/tazpkgbox/list	Sun Jun 20 21:44:57 2010 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,130 +0,0 @@
     3.4 -#!/bin/sh
     3.5 -#
     3.6 -# List installed packages in a suitable format for GTK tree.
     3.7 -# List mirrored packages using the packages.desc file.
     3.8 -#
     3.9 -
    3.10 -undigest_list()
    3.11 -{
    3.12 -	IFS="|"
    3.13 -	if [ -n "$1" -a "$1" != "all" ]; then
    3.14 -		cat undigest/$1/packages.desc
    3.15 -	else
    3.16 -		cat undigest/*/packages.desc
    3.17 -	fi 2> /dev/null | sort | while read PACKAGE VERSION SHORT_DESC; do
    3.18 -		ICON=tazpkg
    3.19 -		PACKAGE=${PACKAGE%% *}
    3.20 -		if [ -d installed/$PACKAGE ]; then
    3.21 -			[ "$2" == "installable" ] && continue
    3.22 -			ICON=tazpkg-installed
    3.23 -			if grep -qs "^$PACKAGE$" blocked-packages.list; then
    3.24 -				ICON=stop
    3.25 -			fi
    3.26 -		else
    3.27 -			[ "$2" == "installed" ] && continue
    3.28 -		fi
    3.29 -		[ "$2" == "blocked" -a "$ICON" != "stop" ] && continue
    3.30 -		[ "$2" == "upgradeable" ] && 
    3.31 -		! grep -q ^$PACKAGE$ upgradeable-packages.list && continue
    3.32 -		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    3.33 -	done
    3.34 -	unset IFS
    3.35 -}
    3.36 -
    3.37 -installable_list()
    3.38 -{
    3.39 -	local cache
    3.40 -	cache=packages.installable_list.$CAT
    3.41 -	if [ -s $cache -a $cache -nt packages.desc -a $cache -nt installed ]; then
    3.42 -	     cat $cache
    3.43 -	     return
    3.44 -	fi
    3.45 -	IFS="|"
    3.46 -	cat packages.desc undigest/*/packages.desc 2> /dev/null | sort | \
    3.47 -	while read PACKAGE VERSION SHORT_DESC CATEGORY; do
    3.48 -		# Check first for category for more speed.
    3.49 -		CATEGORY=${CATEGORY%| *}
    3.50 -		ICON=tazpkg
    3.51 -		[ $CAT == all -o $CATEGORY == " $CAT " ] || continue
    3.52 -		[ -d installed/${PACKAGE%% *} ] && continue
    3.53 -		grep -qs "^$PACKAGE" undigest/*/packages.desc && ICON=add
    3.54 -		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    3.55 -	done | tee $cache
    3.56 -	unset IFS
    3.57 -}
    3.58 -
    3.59 -installed_list()
    3.60 -{
    3.61 -	for pkg in ${1}installed/*
    3.62 -	do
    3.63 -		[ -n "$1" -a -s installed/$(basename $pkg)/receipt ] && continue
    3.64 -		. $pkg/receipt
    3.65 -		ICON=tazpkg-installed
    3.66 -		[ $CAT == all -o $CATEGORY == $CAT ] || continue
    3.67 -		if [ -n "$1" -o -L $pkg ]; then
    3.68 -			ICON=media-flash
    3.69 -		else
    3.70 -			grep -qs "^$PACKAGE" undigest/*/packages.desc && ICON=add
    3.71 -		fi
    3.72 -		grep -qs "^$PACKAGE$" blocked-packages.list && ICON=stop
    3.73 -		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    3.74 -	done
    3.75 -}
    3.76 -
    3.77 -all_list()
    3.78 -{
    3.79 -	local cache
    3.80 -	cache=packages.all_list.$CAT
    3.81 -	if [ -s $cache -a $cache -nt packages.desc -a $cache -nt installed ]; then
    3.82 -	     cat $cache
    3.83 -	     return
    3.84 -	fi
    3.85 -	( installable_list ; installed_list ) | sort -t \| -k 2 -u | tee $cache
    3.86 -}
    3.87 -
    3.88 -blocked_list()
    3.89 -{
    3.90 -	ICON=tazpkg-installed
    3.91 -	[ "$1" = "blocked" ] && ICON=stop
    3.92 -	for pkg in $(cat $1-packages.list 2> /dev/null); do
    3.93 -		[ -f installed/$pkg/receipt ] || continue
    3.94 -		. installed/$pkg/receipt
    3.95 -		[ $CAT == all -o $CATEGORY == $CAT ] || continue
    3.96 -		AVAILABLE=$(grep -s "^$pkg " packages.desc \
    3.97 -			undigest/*/packages.desc | awk '{ print $3 }')
    3.98 -		echo "$ICON|$PACKAGE|$VERSION (Available: $AVAILABLE)|$SHORT_DESC"
    3.99 -	done
   3.100 -}
   3.101 -
   3.102 -cd /var/lib/tazpkg
   3.103 -CAT=`cat /tmp/tazpkgbox/category`
   3.104 -case $1 in
   3.105 -	all)
   3.106 -		STATUS=`cat /tmp/tazpkgbox/status`
   3.107 -		case $STATUS in
   3.108 -			blocked|upgradeable)
   3.109 -				blocked_list $STATUS;;
   3.110 -			linkable)
   3.111 -				[ -d fslink ] && installed_list \
   3.112 -					$(readlink fslink)/var/lib/tazpkg/;;
   3.113 -			installed)
   3.114 -				installed_list ;;
   3.115 -			installable)
   3.116 -				installable_list ;;
   3.117 -			*)
   3.118 -				all_list ;;
   3.119 -		esac ;;
   3.120 -	undigest)
   3.121 -		set -- `cat /tmp/tazpkgbox/undigest-category`
   3.122 -		if [ "$1" == "all" -o "$1" == "" ]; then
   3.123 -			undigest_list $2 $3
   3.124 -		else
   3.125 -			undigest_list $2 $3 | grep "$1"
   3.126 -		fi ;;
   3.127 -	blocked|upgradeable)
   3.128 -		blocked_list $1;;
   3.129 -	*)
   3.130 -		echo "Usage: $0 [all|undigest|blocked|upgradeable]" ;;
   3.131 -esac
   3.132 -
   3.133 -exit 0
     4.1 --- a/lib/tazpkgbox/package_infos	Sun Jun 20 21:44:57 2010 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,468 +0,0 @@
     4.4 -#!/bin/sh
     4.5 -#
     4.6 -# Dialog box to provide package info and actions
     4.7 -#
     4.8 -
     4.9 -XTERM_OPTS="-geometry 80x16+120+120"
    4.10 -
    4.11 -PKG=`cat /tmp/tazpkgbox/pkg | sed s/" "/""/g`
    4.12 -ROOT=/var/lib/tazpkg
    4.13 -if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
    4.14 -	ROOT=$(readlink /var/lib/tazpkg/fslink)$ROOT
    4.15 -fi
    4.16 -TMP_DIR=/tmp/tazpkg-$$-$RANDOM
    4.17 -
    4.18 -if [ "$1" = "sizes" ]; then
    4.19 -	cat <<EOT
    4.20 -Dependencies for $2:
    4.21 -$(tazpkg depends $2)
    4.22 -
    4.23 -Reverse dependencies for $2:
    4.24 -$(tazpkg rdepends $2)
    4.25 -EOT
    4.26 -	exit 0
    4.27 -fi
    4.28 -if [ "$1" = "info" ]; then
    4.29 -	RECEIPT=$ROOT/installed/$3/receipt
    4.30 -	. $RECEIPT
    4.31 -	case "$2" in
    4.32 -	Web*) browser $WEB_SITE &;;
    4.33 -	Tip*) browser http://hg.slitaz.org/wok/raw-file/tip/$3/receipt &;;
    4.34 -	Siz*) xterm -T "$3 depends (q to quit)" -e "$0 sizes $3 | less";;
    4.35 -	Upg*) xterm -T "$3 upgrade" -e "tazpkg get-install $3 --forced ; sleep 2";;
    4.36 -	Hand*) browser $HANDBOOK_URL &;;
    4.37 -	Sug*) $0 list_packages $SUGGESTED;;
    4.38 -	Dep*) $0 list_packages $DEPENDS;;
    4.39 -	Mod*) $0 list_packages $(xargs echo < $ROOT/installed/$3/modifiers);;
    4.40 -	Con*) tazpkgbox list_config $3;;
    4.41 -	Ver*) xterm -T "$3 receipt (q to quit)" -e "cat $RECEIPT | less";;
    4.42 -	esac
    4.43 -	exit 0
    4.44 -fi
    4.45 -
    4.46 -if [ "$1" = "list_files" ]; then
    4.47 -	CONF_FILES="$(tazpkg list-config $2 | awk "$AWK_FILTER")"
    4.48 -	if [ -n "$CONF_FILES" ]; then
    4.49 -		mkdir $TMP_DIR
    4.50 -		zcat $ROOT/installed/$2/volatile.cpio.gz | \
    4.51 -			( cd $TMP_DIR ; cpio -id > /dev/null )
    4.52 -	fi
    4.53 -	cat $ROOT/installed/$2/files.list | grep ^/ | while read file; do
    4.54 -		realfile="$file"
    4.55 -		if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
    4.56 -			realfile="$(readlink /var/lib/tazpkg/fslink)$file"
    4.57 -		fi
    4.58 -		echo -n "$(stat -c "%A|%U|%G|%s|$file|" "$realfile" || \
    4.59 -			   echo "File lost !||||$file|")"
    4.60 -		if [ -L "$realfile" ]; then
    4.61 -			echo -n "$(readlink "$realfile")"
    4.62 -		elif [ -f "$file" ]; then
    4.63 -			case "$CONF_FILES" in
    4.64 -			*$file*) 
    4.65 -				if cmp $file $TMP_DIR$file > /dev/null 2>&1; then
    4.66 -					echo -n "[configuration]"
    4.67 -				else
    4.68 -					echo -n "$(stat -c "[configuration: %.16y]" $file)"
    4.69 -				fi;;
    4.70 -			#*	if [ "$(tazpkg check-file $file $2)" = "failure" ]; then
    4.71 -			#		echo -n "Invalid md5"
    4.72 -			#	fi;;
    4.73 -			esac
    4.74 -		fi
    4.75 -		echo ""
    4.76 -	done
    4.77 -	[ -n "$CONF_FILES" ] && rm -rf $TMP_DIR
    4.78 -	exit 0
    4.79 -fi
    4.80 -
    4.81 -if [ "$1" = "list_files_mirror" ]; then
    4.82 -	for i in /var/lib/tazpkg/files.list.lzma \
    4.83 -		/var/lib/tazpkg/undigest/*/files.list.lzma ; do
    4.84 -		[ -f $i ] || continue
    4.85 -		unlzma -c $i
    4.86 -	done | grep -- "^$2:" | awk '{ print substr($0,index($0,":")+2) }'
    4.87 -	exit 0
    4.88 -fi
    4.89 -
    4.90 -if [ "$1" = "list_packages" ]; then
    4.91 -	PKG="$2"
    4.92 -	if [ -n "$3" ]; then
    4.93 -		shift
    4.94 -		export LIST_PKGS='
    4.95 -<window title="Packages" icon-name="tazpkg">
    4.96 -  <vbox>
    4.97 -     <tree>
    4.98 -	<width>600</width><height>160</height>
    4.99 -	<label>Package|Version|Size|Description</label>
   4.100 -	<variable>PKG</variable>
   4.101 -'
   4.102 -		for i in "$@"; do
   4.103 -			if [ -d $ROOT/installed/$i ]; then
   4.104 -				. $ROOT/installed/$i/receipt
   4.105 -				LIST_PKGS="$LIST_PKGS
   4.106 -	<item icon=\"tazpkg\">$i|$VERSION|Installed|$SHORT_DESC</item>
   4.107 -"
   4.108 -			else
   4.109 -				RES=`grep -sh "^$i " \
   4.110 -				/var/lib/tazpkg/packages.desc \
   4.111 -				/var/lib/tazpkg/undigest/*/packages.desc`
   4.112 -				PACKAGE=`echo "$RES" | cut -d "|" -f 1`
   4.113 -				VERSION=`echo "$RES" | cut -d "|" -f 2`
   4.114 -				SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
   4.115 -				SIZE=`grep -sh -A 3 "^$(echo $PACKAGE)$" \
   4.116 -				/var/lib/tazpkg/packages.txt \
   4.117 -				/var/lib/tazpkg/undigest/*/packages.txt | \
   4.118 -				tail -1 | sed 's/.*(\(.*\) .*/\1/'`
   4.119 -				LIST_PKGS="$LIST_PKGS
   4.120 -	<item icon=\"tazpkg\">$i|$VERSION|$SIZE|$SHORT_DESC</item>
   4.121 -"
   4.122 -			fi
   4.123 -		done
   4.124 -		LIST_PKGS="$LIST_PKGS
   4.125 -	<action>echo "\$PKG" > /tmp/tazpkgbox/pkg</action>
   4.126 -	<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
   4.127 -	<action>refresh:PKG</action>
   4.128 -	<action>refresh:PKG_STATS</action>
   4.129 -	<action>refresh:CACHE_STATS</action>
   4.130 -     </tree>
   4.131 -     <hbox>
   4.132 -	<button ok>
   4.133 -	</button>
   4.134 -	<button cancel>
   4.135 -		<action type=\"closewindow\">LIST_PKGS</action>
   4.136 -	</button>
   4.137 -     </hbox>
   4.138 -  </vbox>
   4.139 -</window>
   4.140 -"
   4.141 -		eval `gtkdialog --center --program=LIST_PKGS`
   4.142 -		[ "$EXIT" = "OK" ] || exit 0
   4.143 -	fi
   4.144 -fi
   4.145 -
   4.146 -export LIST_FILES="
   4.147 -<window title=\"$PKG files\" icon-name=\"system-file-manager\">
   4.148 -  <vbox>
   4.149 -	<tree exported_column=\"4\">
   4.150 -		<variable>FILE</variable>
   4.151 -		<width>600</width><height>160</height>
   4.152 -		<label>Access | User | Group | Size | Name | Target</label>
   4.153 -		<input> $0 list_files $PKG </input>
   4.154 -		<action>tazpkg list-config $PKG | grep -q ^\$FILE$ && leafpad \$FILE</action>
   4.155 -	</tree>
   4.156 -	<hbox>
   4.157 -		<button>
   4.158 -			<input file icon=\"gtk-close\"></input>
   4.159 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.160 -		</button>
   4.161 -	</hbox>
   4.162 -  </vbox>
   4.163 -</window>
   4.164 -"
   4.165 -
   4.166 -export LIST_FILES_MIRROR="
   4.167 -<window title=\"$PKG files\" icon-name=\"system-file-manager\">
   4.168 -  <vbox>
   4.169 -	<tree>
   4.170 -		<width>300</width><height>160</height>
   4.171 -		<label>File Name</label>
   4.172 -		<input> $0 list_files_mirror $PKG </input>
   4.173 -	</tree>
   4.174 -	<hbox>
   4.175 -		<button>
   4.176 -			<input file icon=\"gtk-close\"></input>
   4.177 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.178 -		</button>
   4.179 -	</hbox>
   4.180 -  </vbox>
   4.181 -</window>
   4.182 -"
   4.183 -
   4.184 -# Installed or not installed, that is the question!
   4.185 -if [ -d $ROOT/installed/$PKG ]; then
   4.186 -	PACKED_SIZE=""
   4.187 -	DEPENDS=""
   4.188 -	MAINTAINER=""
   4.189 -	BUGS=""
   4.190 -	TAGS=""
   4.191 -	. $ROOT/installed/$PKG/receipt
   4.192 -	MAINTAINER=$(echo "$MAINTAINER" | sed 's/[<>|]/ /g')
   4.193 -	upgrade_version="$(cat /var/lib/tazpkg/packages.desc \
   4.194 -		/var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | \
   4.195 -		awk "/^$PACKAGE / { print \$3 }" | head -1 )"
   4.196 -	UPGRADE=""
   4.197 -	if [ -n "$upgrade_version" ]; then
   4.198 -		if [ "$upgrade_version" != "$VERSION" ]; then
   4.199 -			UPGRADE="$upgrade_version"
   4.200 -		else
   4.201 -			cur_md5="$(awk "/ $PACKAGE-$VERSION/ { print \$1 }" \
   4.202 -				$ROOT/installed.md5)"
   4.203 -			new_md5="$(cat /var/lib/tazpkg/packages.md5 \
   4.204 -				/var/lib/tazpkg/undigest/*/packages.md5 \
   4.205 -				2> /dev/null | awk "/ $PACKAGE-$VERSION/ { print \$1 }")"
   4.206 -			if [ -n "$cur_md5" -a -n "$new_md5" -a \
   4.207 -				"$cur_md5" != "$new_md5" ]; then
   4.208 -				UPGRADE="build"
   4.209 -			fi
   4.210 -		fi
   4.211 -	fi
   4.212 -	PACKAGE_INFOS="
   4.213 -<window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
   4.214 -<vbox>
   4.215 -
   4.216 -	<tree>
   4.217 -		<width>460</width><height>200</height>
   4.218 -		<label>$PKG|$SHORT_DESC</label>
   4.219 -		<variable>FIELD</variable>		
   4.220 -		<item icon=\"tazpkg\">Version: | $VERSION</item>
   4.221 -		<item icon=\"tazpkg\">Category: | $CATEGORY</item>"
   4.222 -[ -n "$UPGRADE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.223 -		<item icon=\"tazpkg\">Upgrade: | $(echo $UPGRADE)</item>"
   4.224 -[ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.225 -		<item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
   4.226 -[ -n "$SUGGESTED" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.227 -		<item icon=\"tazpkg\">Suggested: | $(echo $SUGGESTED)</item>"
   4.228 -[ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.229 -		<item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
   4.230 -[ -n "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.231 -		<item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
   4.232 -[ -n "$BUGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.233 -		<item icon=\"important\">Bugs: | $BUGS</item>"
   4.234 -[ -n "$HANDBOOK_URL" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.235 -		<item icon=\"ascii\">Handbook: | $HANDBOOK_URL</item>"
   4.236 -[ -n "$TAGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.237 -		<item icon=\"tazpkg\">Tags: | $TAGS</item>"
   4.238 -[ -n "$CONFIG_FILES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.239 -		<item icon=\"tazpkg\">Config files: | $CONFIG_FILES</item>"
   4.240 -[ -f $ROOT/installed/$PKG/modifiers ] && 
   4.241 -PACKAGE_INFOS="$PACKAGE_INFOS
   4.242 -		<item icon=\"tazpkg\">Modified by: | $(xargs echo < $ROOT/installed/$PKG/modifiers)</item>"
   4.243 -PACKAGE_INFOS="$PACKAGE_INFOS
   4.244 -		<item icon=\"applications-internet\">Website: | $WEB_SITE</item>
   4.245 -		<item icon=\"help\">Tip: | double-click any item for more information</item>
   4.246 -		<action> $0 info \"\$FIELD\" $PKG </action>		
   4.247 -	</tree>
   4.248 -
   4.249 -	<hbox>"
   4.250 -[ -s $ROOT/installed/$PACKAGE/description.txt ] &&
   4.251 -	PACKAGE_INFOS="$PACKAGE_INFOS
   4.252 -		<button>
   4.253 -			<label>Description</label>
   4.254 -			<input file icon=\"help\"></input>
   4.255 -			<action>xterm -T \"$PKG description (q to quit)\" $XTERM_OPTS \
   4.256 -			-e \"less $ROOT/installed/$PKG/description.txt\"</action>
   4.257 -		</button>"
   4.258 -if [ ! -d /var/lib/tazpkg/fslink ]; then
   4.259 -	[ ${PKG%%-*} = get -a ! -d $ROOT/installed/${PKG#get-} ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.260 -		<button>
   4.261 -			<label>Install</label>
   4.262 -			<input file icon=\"go-next\"></input>
   4.263 -			<action>xterm -T \"Install ${PKG#get-}\" $XTERM_OPTS -e \"\
   4.264 -			$PKG; sleep 5\"</action>
   4.265 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.266 -		</button>"
   4.267 -	[ -n "$UPGRADE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.268 -		<button>
   4.269 -			<label>Upgrade</label>
   4.270 -			<input file icon=\"go-next\"></input>
   4.271 -			<action>xterm -T \"Install $PKG\" $XTERM_OPTS -e \"\
   4.272 -			tazpkg get-install $PKG --forced ; sleep 5\"</action>
   4.273 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.274 -		</button>"
   4.275 -	grep -q post_install $ROOT/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
   4.276 -		<button>
   4.277 -			<label>Reconfigure</label>
   4.278 -			<input file icon=\"reload\"></input>
   4.279 -			<action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
   4.280 -			tazpkg reconfigure $PACKAGE; sleep 2\"</action>
   4.281 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.282 -		</button>"
   4.283 -	if grep -qs ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
   4.284 -		PACKAGE_INFOS="$PACKAGE_INFOS
   4.285 -		<button>
   4.286 -			<label>Unblock</label>
   4.287 -			<input file icon=\"up\"></input>
   4.288 -			<action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
   4.289 -			tazpkg unblock $PACKAGE; sleep 2\"</action>
   4.290 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.291 -		</button>"
   4.292 -	else
   4.293 -		PACKAGE_INFOS="$PACKAGE_INFOS
   4.294 -		<button>
   4.295 -			<label>Block</label>
   4.296 -			<input file icon=\"down\"></input>
   4.297 -			<action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
   4.298 -			tazpkg block $PACKAGE; sleep 2\"</action>
   4.299 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.300 -		</button>"
   4.301 -	fi
   4.302 -fi
   4.303 -if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   4.304 -	PACKAGE_INFOS="$PACKAGE_INFOS
   4.305 -		<button>
   4.306 -			<label>Link</label>
   4.307 -			<input file icon=\"edit-redo\"></input>
   4.308 -			<action>xterm -T \"Link $PACKAGE\" $XTERM_OPTS -e \"\
   4.309 -			tazpkg link $PACKAGE $(readlink /var/lib/tazpkg/fslink); sleep 2\"</action>
   4.310 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.311 -		</button>"
   4.312 -elif [ ! -s $ROOT/installed/$PKG/modifiers ]; then
   4.313 -	[ -L $ROOT/installed/$PKG ] || PACKAGE_INFOS="$PACKAGE_INFOS
   4.314 -		<button>
   4.315 -			<label>Repack</label>
   4.316 -			<input file icon=\"edit-redo\"></input>
   4.317 -			<action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
   4.318 -			cd /var/cache/tazpkg; \
   4.319 -			tazpkg repack $PACKAGE; sleep 2\"</action>
   4.320 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.321 -		</button>
   4.322 -"
   4.323 -	PACKAGE_INFOS="$PACKAGE_INFOS
   4.324 -		<button>
   4.325 -			<label>Remove</label>
   4.326 -			<input file icon=\"edit-delete\"></input>
   4.327 -			<action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
   4.328 -			tazpkg remove $PACKAGE; sleep 2\"</action>
   4.329 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.330 -		</button>
   4.331 -"
   4.332 -else
   4.333 -	PACKAGE_INFOS="$PACKAGE_INFOS
   4.334 -		<button>
   4.335 -			<label>Re-install</label>
   4.336 -			<input file icon=\"edit-redo\"></input>
   4.337 -			<action>xterm -T \"Re-install $PACKAGE\" $XTERM_OPTS -e \"\
   4.338 -			tazpkg get-install $PACKAGE --forced; sleep 2\"</action>
   4.339 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.340 -		</button>
   4.341 -		<button>
   4.342 -			<label>Remove</label>
   4.343 -			<input file icon=\"edit-delete\"></input>
   4.344 -			<action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
   4.345 -			tazpkg remove $PACKAGE; sleep 2\"</action>
   4.346 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.347 -		</button>
   4.348 -"
   4.349 -fi
   4.350 -PACKAGE_INFOS="$PACKAGE_INFOS
   4.351 -		<button>
   4.352 -			<label>View Files</label>
   4.353 -			<input file icon=\"tazpkg\"></input>
   4.354 -			<action type=\"launch\">LIST_FILES</action>
   4.355 -		</button>
   4.356 -		<button>
   4.357 -			<input file icon=\"gtk-close\"></input>
   4.358 -			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.359 -		</button>
   4.360 -	</hbox>
   4.361 -
   4.362 -</vbox>
   4.363 -</window>
   4.364 -"
   4.365 -	export PACKAGE_INFOS
   4.366 -else
   4.367 -	RES=`grep -sh "^$PKG " /var/lib/tazpkg/packages.desc \
   4.368 -		/var/lib/tazpkg/undigest/*/packages.desc`
   4.369 -	PACKAGE=`echo "$RES" | cut -d "|" -f 1`
   4.370 -	VERSION=`echo "$RES" | cut -d "|" -f 2`
   4.371 -	SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
   4.372 -	CATEGORY=`echo "$RES" | cut -d "|" -f 4`
   4.373 -	WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
   4.374 -	SIZES=`grep -sh -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt \
   4.375 -		/var/lib/tazpkg/undigest/*/packages.txt | tail -1`
   4.376 -	DEPENDS=""
   4.377 -	SUGGESTED=""
   4.378 -	MAINTAINER=""
   4.379 -	BUGS=""
   4.380 -	HANDBOOK_URL=""
   4.381 -	TAGS=""
   4.382 -	CONFIG_FILES=""
   4.383 -	height=160
   4.384 -	if [ -s /home/slitaz/wok/$PKG/receipt ]; then
   4.385 -		. /home/slitaz/wok/$PKG/receipt
   4.386 -		height=200
   4.387 -	fi
   4.388 -	PACKAGE_INFOS="
   4.389 -<window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
   4.390 -<vbox>
   4.391 -
   4.392 -	<tree>
   4.393 -		<width>460</width><height>$height</height>
   4.394 -		<label>$PKG|$SHORT_DESC</label>
   4.395 -		<variable>FIELD2</variable>
   4.396 -		<item icon=\"tazpkg\">Version: | $VERSION</item>
   4.397 -		<item icon=\"tazpkg\">Category: | $CATEGORY</item>"
   4.398 -	[ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.399 -		<item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
   4.400 -	[ -n "$SUGGESTED" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.401 -		<item icon=\"tazpkg\">Suggested: | $(echo $SUGGESTED)</item>"
   4.402 -	[ -n "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.403 -		<item icon=\"tazpkg\">Size: | $SIZES</item>"
   4.404 -	[ -n "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.405 -		<item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
   4.406 -	[ -n "$BUGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.407 -		<item icon=\"important\">Bugs: | $BUGS</item>"
   4.408 -	[ -n "$HANDBOOK_URL" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.409 -		<item icon=\"ascii\">Handbook: | $HANDBOOK_URL</item>"
   4.410 -	[ -n "$TAGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.411 -		<item icon=\"tazpkg\">Tags: | $TAGS</item>"
   4.412 -	[ -n "$CONFIG_FILES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.413 -		<item icon=\"tazpkg\">Config files: | $CONFIG_FILES</item>"
   4.414 -	PACKAGE_INFOS="$PACKAGE_INFOS
   4.415 -		<item icon=\"applications-internet\">Website: | $WEB_SITE</item>		
   4.416 -		<item icon=\"text-editor\">Receipt: | double-click to view receipt</item>
   4.417 -		<action>case \$FIELD2 in Web*) browser $WEB_SITE &;; esac</action>
   4.418 -		<action>case \$FIELD2 in Rec*) browser http://hg.slitaz.org/wok/raw-file/tip/$PACKAGE/receipt &;; esac</action>
   4.419 -		
   4.420 -	</tree>
   4.421 -
   4.422 -	<hbox>"
   4.423 -	[ ${PACKAGE%%-*} = get ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.424 -		<checkbox>
   4.425 -			<label>Auto exec</label>
   4.426 -			<variable>AUTO_EXEC</variable>
   4.427 -			<default>true</default>
   4.428 -		</checkbox>"
   4.429 -	PACKAGE_INFOS="$PACKAGE_INFOS
   4.430 -		<checkbox>
   4.431 -			<label>Auto install depends</label>
   4.432 -			<variable>AUTO_DEPENDS</variable>
   4.433 -			<default>true</default>
   4.434 -		</checkbox>
   4.435 -		<button>
   4.436 -			<label>Install Package</label>
   4.437 -			<input file icon=\"go-next\"></input>
   4.438 -			<action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
   4.439 -			if [ x\$AUTO_DEPENDS != xtrue ]; then script -c \\\"tazpkg get-install $PACKAGE\\\" /var/log/tazpkg-install.log;\
   4.440 -			else script -c \\\"yes y | tazpkg get-install $PACKAGE\\\" /var/log/tazpkg-install.log; fi; \
   4.441 -			[ x\${AUTO_EXEC} = xtrue ] && $PACKAGE; \
   4.442 -			sleep 2\"</action>
   4.443 -			<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   4.444 -		</button>
   4.445 -		<button>
   4.446 -			<label>Download</label>
   4.447 -			<input file icon=\"go-next\"></input>
   4.448 -			<action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
   4.449 -			cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
   4.450 -			<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   4.451 -		</button>
   4.452 -		<button>
   4.453 -			<label>View Files</label>
   4.454 -			<input file icon=\"tazpkg\"></input>
   4.455 -			<action type=\"launch\">LIST_FILES_MIRROR</action>
   4.456 -		</button>
   4.457 -		<button>
   4.458 -			<input file icon=\"gtk-close\"></input>
   4.459 -			<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   4.460 -		</button>
   4.461 -	</hbox>
   4.462 -
   4.463 -</vbox>
   4.464 -</window>
   4.465 -"
   4.466 -	export PACKAGE_INFOS
   4.467 -fi
   4.468 -
   4.469 -gtkdialog --center --program=PACKAGE_INFOS
   4.470 -
   4.471 -exit 0
     5.1 --- a/lib/tazpkgbox/search	Sun Jun 20 21:44:57 2010 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,84 +0,0 @@
     5.4 -#!/bin/sh
     5.5 -#
     5.6 -# This script provides a suitable output for the search results.
     5.7 -#
     5.8 -
     5.9 -# Clean preview results.
    5.10 -rm -f /tmp/tazpkgbox/search
    5.11 -touch /tmp/tazpkgbox/search
    5.12 -
    5.13 -list_files()
    5.14 -{
    5.15 -	sed 's/.\[[01]m//g' | awk 'BEGIN { show=0 } {
    5.16 -		if (/^===/) show=1-show;
    5.17 -		else if (/^Package/) pkg=$2;
    5.18 -		else if ($0 != "" && show != 0) printf("%s %s\n",pkg,$0);
    5.19 -	}' | while read pkg file; do
    5.20 -		[ "$pkg" = "0" ] && continue
    5.21 -		version=$(grep -hs "^$pkg " /var/lib/tazpkg/packages.desc \
    5.22 -		  /var/lib/tazpkg/undigest/*/packages.desc | awk '{ print $3 }')
    5.23 -		if [ -d /var/lib/tazpkg/installed/$pkg ]; then
    5.24 -			if [ -x $file ]; then
    5.25 -				echo "exec|$pkg|$version|$file"
    5.26 -			elif [ -f $file ]; then
    5.27 -				echo "txt|$pkg|$version|$file"
    5.28 -			elif [ -d $file ] ; then
    5.29 -				echo "folder|$pkg|$version|$file"
    5.30 -			else
    5.31 -				# Missing installed file.
    5.32 -				echo "dialog-warning|$pkg|$version|$file"
    5.33 -			fi
    5.34 -		else
    5.35 -			echo "tazpkg|$pkg|$version|$file"
    5.36 -		fi
    5.37 -	done
    5.38 -}
    5.39 -
    5.40 -list_package()
    5.41 -{
    5.42 -		if [ -d /var/lib/tazpkg/installed/$1 ]; then
    5.43 -			. /var/lib/tazpkg/installed/$1/receipt
    5.44 -			echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC"
    5.45 -		else
    5.46 -			echo "tazpkg|$PACKAGE|$VERSION|$SHORT_DESC"
    5.47 -		fi
    5.48 -}
    5.49 -
    5.50 -search_package()
    5.51 -{
    5.52 -	IFS="|"
    5.53 -	cat /var/lib/tazpkg/packages.desc \
    5.54 -	    /var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | sort | \
    5.55 -	while read PACKAGE VERSION SHORT_DESC; do
    5.56 -	if echo "$PACKAGE $SHORT_DESC" | grep -iq "$SEARCH"; then
    5.57 -		list_package ${PACKAGE%% *}
    5.58 -	fi
    5.59 -	done 
    5.60 -	unset IFS
    5.61 -}
    5.62 -
    5.63 -case "$1" in
    5.64 -	files)
    5.65 -		tazpkg search-file "$SEARCH" --mirror | list_files > \
    5.66 -			/tmp/tazpkgbox/search ;;
    5.67 -	packages)
    5.68 -		( search_package ;
    5.69 -		  for i in $(grep ^$SEARCH= /var/lib/tazpkg/packages.equiv | \
    5.70 -		          cut -d= -f2); do
    5.71 -		        SEARCH=${i#*:}
    5.72 -		        search_package
    5.73 -		  done ) > /tmp/tazpkgbox/search ;;
    5.74 -	tags)
    5.75 -		grep -ls TAGS /home/slitaz/wok/*/receipt | while read file; do
    5.76 -			TAGS=""
    5.77 -			. $file
    5.78 -			case "$TAGS" in
    5.79 -			*$SEARCH*) list_package $PACKAGE ;;
    5.80 -			esac
    5.81 -		done > /tmp/tazpkgbox/search ;;
    5.82 -	*)
    5.83 -		echo "Usage: $0 [packages|files|tags]" ;;
    5.84 -esac
    5.85 -
    5.86 -
    5.87 -exit 0
     6.1 --- a/tazpkgbox	Sun Jun 20 21:44:57 2010 +0100
     6.2 +++ b/tazpkgbox	Sun Jun 20 23:46:40 2010 +0200
     6.3 @@ -2,14 +2,14 @@
     6.4  #
     6.5  # GTKdialog interface to SliTaz Packages Manager aka Tazpkg. Notes:
     6.6  # Notebook tab are vbox, tabs are used to indent and functions are
     6.7 -# split and found in $LIB.
     6.8 +# split and found in libtazpkgbox.
     6.9  #
    6.10  # (C) GNU gpl v3 - SliTaz GNU/Linux 2010.
    6.11  #
    6.12  VERSION=4.0
    6.13  
    6.14  # Functions path.
    6.15 -export LIB=/usr/lib/slitaz/tazpkgbox
    6.16 +export LIB=/usr/lib/slitaz/libtazpkgbox
    6.17  
    6.18  # Tazpkgbox is only for root.
    6.19  if test $(id -u) != 0 ; then
    6.20 @@ -285,9 +285,9 @@
    6.21  			<width>620</width><height>240</height>
    6.22  			<variable>PKG</variable>
    6.23  			<label>Name|Version|Description</label>
    6.24 -			<input icon_column="0">$LIB/list all</input>
    6.25 +			<input icon_column="0">$LIB list-all</input>
    6.26  			<action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
    6.27 -			<action>$LIB/package_infos</action>
    6.28 +			<action>$LIB package-infos</action>
    6.29  			<action>refresh:PKG</action>
    6.30  			<action>refresh:PKG_STATS</action>
    6.31  			<action>refresh:CACHE_STATS</action>
    6.32 @@ -343,8 +343,8 @@
    6.33  			<label>Packages Name|Version|Description / File</label>
    6.34  			<input icon_column="0">cat /tmp/tazpkgbox/search</input>
    6.35  			<action>echo "$RESULT" > /tmp/tazpkgbox/pkg</action>
    6.36 -			<action>$LIB/package_infos</action>
    6.37 -			<action>$LIB/search packages</action>
    6.38 +			<action>$LIB package-infos</action>
    6.39 +			<action>$LIB search-packages</action>
    6.40  			<action>refresh:RESULT</action>
    6.41  			<action>refresh:PKG</action>
    6.42  			<action>refresh:PKG_STATS</action>
    6.43 @@ -360,13 +360,13 @@
    6.44  			<button>
    6.45  				<label>Packages/Description</label>
    6.46  				<input file icon="system-search"></input>
    6.47 -				<action>$LIB/search packages</action>
    6.48 +				<action>$LIB search-packages</action>
    6.49  				<action>refresh:RESULT</action>
    6.50  			</button>
    6.51  			<button>
    6.52  				<label>Files</label>
    6.53  				<input file icon="system-search"></input>
    6.54 -				<action>$LIB/search files</action>
    6.55 +				<action>$LIB search-files</action>
    6.56  				<action>refresh:RESULT</action>
    6.57  			</button>
    6.58  '
    6.59 @@ -374,7 +374,7 @@
    6.60  			<button>
    6.61  				<label>Tags</label>
    6.62  				<input file icon="system-search"></input>
    6.63 -				<action>$LIB/search tags</action>
    6.64 +				<action>$LIB search-tags</action>
    6.65  				<action>refresh:RESULT</action>
    6.66  			</button>
    6.67  '
    6.68 @@ -388,9 +388,9 @@
    6.69  			<width>620</width><height>240</height>
    6.70  			<variable>DEV</variable>
    6.71  			<label>Name|Version|Description</label>
    6.72 -			<input icon_column="0">$LIB/list undigest</input>
    6.73 +			<input icon_column="0">$LIB list-undigest</input>
    6.74  			<action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
    6.75 -			<action>$LIB/package_infos</action>
    6.76 +			<action>$LIB package-infos</action>
    6.77  			<action>refresh:PKG</action>
    6.78  			<action>refresh:PKG_STATS</action>
    6.79  			<action>refresh:CACHE_STATS</action>
    6.80 @@ -631,6 +631,6 @@
    6.81  '
    6.82  TAZPKG_DIALOG="$TAZPKG_DIALOG$tmp"
    6.83  
    6.84 -gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
    6.85 +gtkdialog --center --program=TAZPKG_DIALOG #>/dev/null
    6.86  
    6.87  exit 0