tazpkg rev 493

Move tazpkgbox to oldstuff
author Christophe Lincoln <pankso@slitaz.org>
date Mon May 16 19:38:39 2011 +0200 (2011-05-16)
parents c790b4c66126
children 02637cf8408a
files Makefile applications/tazpkgbox.desktop lib/libtazpkgbox oldstuff/libtazpkgbox oldstuff/tazpkgbox oldstuff/tazpkgbox.desktop tazpkgbox
line diff
     1.1 --- a/Makefile	Mon May 16 19:27:47 2011 +0200
     1.2 +++ b/Makefile	Mon May 16 19:38:39 2011 +0200
     1.3 @@ -2,7 +2,6 @@
     1.4  #
     1.5  PREFIX?=/usr
     1.6  DOCDIR?=$(PREFIX)/share/doc
     1.7 -LIBDIR?=$(PREFIX)/lib/slitaz
     1.8  SYSCONFDIR?=/etc/slitaz
     1.9  DESTDIR?=
    1.10  LINGUAS?=fr pt
    1.11 @@ -59,10 +58,7 @@
    1.12  	install -m 0777 tazpkg $(DESTDIR)$(PREFIX)/bin
    1.13  	# Tazpkgbox GUI
    1.14  	install -m 0777 tazpkg-notify $(DESTDIR)$(PREFIX)/bin
    1.15 -	install -m 0777 tazpkgbox $(DESTDIR)$(PREFIX)/bin
    1.16  	install -m 0777 tazpkgbox-install $(DESTDIR)$(PREFIX)/bin
    1.17 -	install -m 0755 -d $(DESTDIR)$(LIBDIR)
    1.18 -	install -m 0777 lib/libtazpkgbox $(DESTDIR)$(LIBDIR)
    1.19  	# Configuration files
    1.20  	install -m 0755 -d $(DESTDIR)$(SYSCONFDIR)
    1.21  	install -m 0644 tazpkg.conf $(DESTDIR)$(SYSCONFDIR)
    1.22 @@ -83,8 +79,8 @@
    1.23  uninstall:
    1.24  	rm -f $(DESTDIR)$(PREFIX)/bin/tazpkg
    1.25  	rm -f $(DESTDIR)$(PREFIX)/bin/tazpkgbox
    1.26 -	rm -rf $(DESTDIR)$(LIBDIR)/tazpkgbox
    1.27 -	rm -f $(DESTDIR)$(LIBDIR)/libtazpkgbox
    1.28 +	rm -rf $(DESTDIR)$(PREFIX)/tazpkg-notify
    1.29 +	rm -f $(DESTDIR)$(PREFIX)/tazpkgbox-install
    1.30  	rm -rf $(DESTDIR)$(DOCDIR)/tazpkg
    1.31  	rm -f $(DESTDIR)$(SYSCONFDIR)/tazpkg.conf 
    1.32  	rm -rf $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/tazpkg*.mo
     2.1 --- a/applications/tazpkgbox.desktop	Mon May 16 19:27:47 2011 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,9 +0,0 @@
     2.4 -[Desktop Entry]
     2.5 -Encoding=UTF-8
     2.6 -Name=Package manager
     2.7 -Name[fr]=Gestionnaire de paquets
     2.8 -Comment=Manage software packages
     2.9 -Exec=subox tazpkgbox
    2.10 -Icon=tazpkg
    2.11 -Type=Application
    2.12 -Categories=System;
     3.1 --- a/lib/libtazpkgbox	Mon May 16 19:27:47 2011 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,708 +0,0 @@
     3.4 -#!/bin/sh
     3.5 -# The libtazpkgbox - Libraries used by tazpkg GUI box.
     3.6 -#
     3.7 -# These are functions to list installed packages in a suitable format for a
     3.8 -# GTK tree and list mirrored packages using the packages.desc file. The libs
     3.9 -# also provide functions to search packages and files, and the GUI box for
    3.10 -# package information.
    3.11 -#
    3.12 -# (C) 2010 SliTaz - GNU General Public License v3.
    3.13 -#
    3.14 -
    3.15 -# Include gettext helper script.
    3.16 -. /usr/bin/gettext.sh
    3.17 -
    3.18 -# Export package name for gettext.
    3.19 -TEXTDOMAIN='libtazpkgbox'
    3.20 -export TEXTDOMAIN
    3.21 -
    3.22 -# Dont hardcore path, use $LIB
    3.23 -export LIB=/usr/lib/slitaz/libtazpkgbox
    3.24 -
    3.25 -usage()
    3.26 -{
    3.27 -	[ "$1" ] && echo "??? $0 $@"
    3.28 -	echo -e "\nTazpkgbox library\n
    3.29 -Usage    : $0 [function] [pkg|args]	[pkg]
    3.30 -Functions:
    3.31 -  list-all          List all packages.
    3.32 -  list-undigest     List undigest packages.
    3.33 -  list-blocked      List blocked packages.
    3.34 -  list-upgradeable  List all upgradable packages.
    3.35 -  search-packages   Search for packages.
    3.36 -  search-files      Search for files.
    3.37 -  search-tags       Search for TAGS.
    3.38 -  package-infos     Display box with pkg information."
    3.39 -}
    3.40 -
    3.41 -# List functions.
    3.42 -undigest_list()
    3.43 -{
    3.44 -	IFS="|"
    3.45 -	if [ "$1" -a "$1" != "all" ]; then
    3.46 -		cut -f 1,2,3,4 -d "|" undigest/$1/packages.desc
    3.47 -	else
    3.48 -		cut -f 1,2,3,4 -d "|" undigest/*/packages.desc | sort
    3.49 -	fi 2> /dev/null | while read PACKAGE VERSION SHORT_DESC CATEGORY; do
    3.50 -		[ $CAT = all -o $CATEGORY = " $CAT " ] || continue
    3.51 -		ICON=tazpkg
    3.52 -		PACKAGE=${PACKAGE%% *}
    3.53 -		if [ -d installed/$PACKAGE ]; then
    3.54 -			[ "$2" = "installable" ] && continue
    3.55 -			ICON=tazpkg-installed
    3.56 -			if grep -qs "^$PACKAGE$" blocked-packages.list; then
    3.57 -				ICON=stop
    3.58 -			fi
    3.59 -		else
    3.60 -			[ "$2" = "installed" ] && continue
    3.61 -		fi
    3.62 -		[ "$2" = "blocked" -a "$ICON" != "stop" ] && continue
    3.63 -		[ "$2" = "upgradeable" ] && 
    3.64 -		! grep -q ^$PACKAGE$ upgradeable-packages.list && continue
    3.65 -		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    3.66 -	done
    3.67 -	unset IFS
    3.68 -}
    3.69 -
    3.70 -installable_list()
    3.71 -{
    3.72 -	local cache
    3.73 -	cache=packages.installable_list.$CAT
    3.74 -	if [ -s $cache -a $cache -nt packages.desc -a $cache -nt installed ]; then
    3.75 -	     cat $cache
    3.76 -	     return
    3.77 -	fi
    3.78 -	IFS="|"
    3.79 -	cut -f 1,2,3,4 -d "|" packages.desc undigest/*/packages.desc 2> /dev/null | sort | \
    3.80 -	while read PACKAGE VERSION SHORT_DESC CATEGORY; do
    3.81 -		# Check first for category for more speed.
    3.82 -		[ $CAT = all -o $CATEGORY = " $CAT " ] || continue
    3.83 -		[ -d installed/${PACKAGE% } ] && continue
    3.84 -		ICON=tazpkg
    3.85 -		grep -qs "^$PACKAGE" undigest/*/packages.desc && ICON=add
    3.86 -		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    3.87 -	done | tee $cache
    3.88 -	unset IFS
    3.89 -}
    3.90 -
    3.91 -installed_list()
    3.92 -{
    3.93 -	for pkg in ${1}installed/*
    3.94 -	do
    3.95 -		[ "$1" -a -s installed/$(basename $pkg)/receipt ] && continue
    3.96 -		. $pkg/receipt
    3.97 -		ICON=tazpkg-installed
    3.98 -		[ $CAT = all -o $CATEGORY = $CAT ] || continue
    3.99 -		if [ "$1" -o -L $pkg ]; then
   3.100 -			ICON=media-flash
   3.101 -		else
   3.102 -			grep -qs "^$PACKAGE" undigest/*/packages.desc && ICON=add
   3.103 -		fi
   3.104 -		grep -qs "^$PACKAGE$" blocked-packages.list && ICON=stop
   3.105 -		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
   3.106 -	done
   3.107 -}
   3.108 -
   3.109 -all_list()
   3.110 -{
   3.111 -	local cache
   3.112 -	cache=packages.all_list.$CAT
   3.113 -	if [ -s $cache -a $cache -nt packages.desc -a $cache -nt installed ]; then
   3.114 -	     cat $cache
   3.115 -	     return
   3.116 -	fi
   3.117 -	{ installable_list ; installed_list; } | sort -t \| -k 2 -u | tee $cache
   3.118 -}
   3.119 -
   3.120 -blocked_list()
   3.121 -{
   3.122 -	ICON=tazpkg-installed
   3.123 -	[ "$1" = "blocked" ] && ICON=stop
   3.124 -	for pkg in $(cat $1-packages.list 2> /dev/null); do
   3.125 -		[ -f installed/$pkg/receipt ] || continue
   3.126 -		. installed/$pkg/receipt
   3.127 -		[ $CAT = all -o $CATEGORY = $CAT ] || continue
   3.128 -		AVAILABLE=$(grep -s "^$pkg " packages.desc \
   3.129 -			undigest/*/packages.desc | awk '{ print $3 }')
   3.130 -		echo "$ICON|$PACKAGE|$VERSION (Available: $AVAILABLE)|$SHORT_DESC"
   3.131 -	done
   3.132 -}
   3.133 -
   3.134 -# Search functions
   3.135 -
   3.136 -clean_search()
   3.137 -{
   3.138 -	# Clean preview results.
   3.139 -	rm -f /tmp/tazpkgbox/search
   3.140 -	touch /tmp/tazpkgbox/search
   3.141 -}
   3.142 -
   3.143 -list_files()
   3.144 -{
   3.145 -	sed -e "/^$/d" -e "1,/^=*$/d" -e "/^=*$/,/EOT/d" | while read input; do
   3.146 -		if [ "$input" = "${input/ :/}" ]; then
   3.147 -			# Input is a file.
   3.148 -			if [ "$ICON" = tazpkg ]; then
   3.149 -				echo "add|$PACKAGE| |$input"
   3.150 -			else
   3.151 -				if [ -d $input ] ; then
   3.152 -					echo "folder|$PACKAGE| |$input"
   3.153 -				elif [ -x $input ]; then
   3.154 -					echo "exec|$PACKAGE| |$input"
   3.155 -				elif [ -f $input ]; then
   3.156 -					echo "txt|$PACKAGE| |$input"
   3.157 -				else
   3.158 -					# Missing installed file.
   3.159 -					echo "dialog-warning|$PACKAGE| |$input"
   3.160 -				fi
   3.161 -			fi	
   3.162 -		else
   3.163 -			# Input contains package name, don't refer to Package word as
   3.164 -			# tazpkg can use other languages.
   3.165 -			PACKAGE=$(echo $input | sed 's/^.* \(.*\) :.*$/\1/')
   3.166 -			ICON=tazpkg
   3.167 -			[ -d /var/lib/tazpkg/installed/$PACKAGE ] && ICON=tazpkg-installed
   3.168 -			echo "$ICON|$PACKAGE |$(grep -hs "^$PACKAGE " /var/lib/tazpkg/packages.desc \
   3.169 -				/var/lib/tazpkg/undigest/*/packages.desc | cut -f2,3 -d '|' | head -1)"
   3.170 -		fi
   3.171 -	done
   3.172 -}
   3.173 -
   3.174 -list_package()
   3.175 -{
   3.176 -		if [ -d /var/lib/tazpkg/installed/$1 ]; then
   3.177 -			. /var/lib/tazpkg/installed/$1/receipt
   3.178 -			echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC"
   3.179 -		else
   3.180 -			echo "tazpkg|$PACKAGE|$VERSION|$SHORT_DESC"
   3.181 -		fi
   3.182 -}
   3.183 -
   3.184 -search_package()
   3.185 -{
   3.186 -	IFS="|"
   3.187 -	cut -f1,2,3 -d '|' /var/lib/tazpkg/packages.desc \
   3.188 -	    /var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | sort | \
   3.189 -	while read PACKAGE VERSION SHORT_DESC; do
   3.190 -		[ "$PACKAGE" = "${PACKAGE/$SEARCH/}" -a "$SHORT_DESC" = "${SHORT_DESC/$SEARCH/}" ] \
   3.191 -			&& continue
   3.192 -		list_package ${PACKAGE% }
   3.193 -	done
   3.194 -	unset IFS
   3.195 -}
   3.196 -
   3.197 -case "$1" in
   3.198 -	list-all)
   3.199 -		cd /var/lib/tazpkg
   3.200 -		CAT=`cat /tmp/tazpkgbox/category`
   3.201 -		STATUS=`cat /tmp/tazpkgbox/status`
   3.202 -		case $STATUS in
   3.203 -			blocked|upgradeable)
   3.204 -				blocked_list $STATUS;;
   3.205 -			linkable)
   3.206 -				[ -d fslink ] && installed_list \
   3.207 -					$(readlink fslink)/var/lib/tazpkg/;;
   3.208 -			installed)
   3.209 -				installed_list ;;
   3.210 -			installable)
   3.211 -				installable_list ;;
   3.212 -			*)
   3.213 -				all_list ;;
   3.214 -		esac ;;
   3.215 -	list-undigest)
   3.216 -		cd /var/lib/tazpkg
   3.217 -		set -- `cat /tmp/tazpkgbox/undigest-category`
   3.218 -		CAT="${1:-all}"
   3.219 -		undigest_list $2 $3 ;;
   3.220 -	list-blocked|list-upgradeable)
   3.221 -		cd /var/lib/tazpkg
   3.222 -		CAT=`cat /tmp/tazpkgbox/category`
   3.223 -		blocked_list $1 ;;
   3.224 -	search-files)
   3.225 -		# Search for files
   3.226 -		clean_search
   3.227 -		tazpkg search-file "$SEARCH" --mirror | list_files > \
   3.228 -			/tmp/tazpkgbox/search ;;
   3.229 -	search-packages)
   3.230 -		clean_search
   3.231 -		{ search_package ;
   3.232 -		  for i in $(grep ^$SEARCH= /var/lib/tazpkg/packages.equiv | \
   3.233 -		          cut -d= -f2); do
   3.234 -		        SEARCH=${i#*:}
   3.235 -		        search_package
   3.236 -		  done; } > /tmp/tazpkgbox/search ;;
   3.237 -	search-tags)
   3.238 -		clean_search
   3.239 -		fgrep -ls TAGS /home/slitaz/wok/*/receipt | while read file; do
   3.240 -			TAGS=""
   3.241 -			. $file
   3.242 -			case "$TAGS" in
   3.243 -			*$SEARCH*) list_package $PACKAGE ;;
   3.244 -			esac
   3.245 -		done > /tmp/tazpkgbox/search ;;
   3.246 -	package-infos)
   3.247 -		# Dialog box to provide package info and actions
   3.248 -		XTERM_OPTS="-geometry 80x16+120+120"	
   3.249 -		PKG=`cat /tmp/tazpkgbox/pkg | sed s/" "/""/g`
   3.250 -		ROOT=/var/lib/tazpkg
   3.251 -		if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   3.252 -			ROOT=$(readlink /var/lib/tazpkg/fslink)$ROOT
   3.253 -		fi
   3.254 -		TMP_DIR=/tmp/tazpkg-$$-$RANDOM
   3.255 -		if [ "$2" = "sizes" ]; then
   3.256 -			cat <<EOT
   3.257 -Dependencies for $3:
   3.258 -$(tazpkg depends $3)
   3.259 -
   3.260 -Reverse dependencies for $3:
   3.261 -$(tazpkg rdepends $3)
   3.262 -EOT
   3.263 -			exit 0
   3.264 -		fi
   3.265 -		if [ "$2" = "info" ]; then
   3.266 -			RECEIPT=$ROOT/installed/$4/receipt
   3.267 -			. $RECEIPT
   3.268 -			case "$3" in
   3.269 -			Web*) browser $WEB_SITE &;;
   3.270 -			Tip*) browser http://hg.slitaz.org/wok/raw-file/tip/$4/receipt &;;
   3.271 -			Siz*) xterm -T "$4 `gettext \"depends (q to quit)\"`" -e "$0 package-infos sizes $4 | less";;
   3.272 -			Upg*) xterm -T "$4 `gettext \"upgrade\"`" -e "tazpkg get-install $4 --forced ; sleep 2";;
   3.273 -			Hand*) browser $HANDBOOK_URL &;;
   3.274 -			Sug*) $0 package-infos list_packages $SUGGESTED;;
   3.275 -			Dep*) $0 package-infos list_packages $DEPENDS;;
   3.276 -			Mod*) $0 package-infos list_packages $(xargs echo < $ROOT/installed/$3/modifiers);;
   3.277 -			Con*) tazpkgbox list_config $4;;
   3.278 -			Ver*) xterm -T "$4 `gettext \"receipt (q to quit)\"`" -e "cat $RECEIPT | less";;
   3.279 -			esac
   3.280 -			exit 0
   3.281 -		fi
   3.282 -		
   3.283 -		if [ "$2" = "list_files" ]; then
   3.284 -			CONF_FILES="$(tazpkg list-config $3 | awk "$AWK_FILTER")"
   3.285 -			if [ "$CONF_FILES" ]; then
   3.286 -				mkdir $TMP_DIR
   3.287 -				zcat $ROOT/installed/$3/volatile.cpio.gz | \
   3.288 -					( cd $TMP_DIR ; cpio -id > /dev/null )
   3.289 -			fi
   3.290 -			cat $ROOT/installed/$3/files.list | grep ^/ | while read file; do
   3.291 -				realfile="$file"
   3.292 -				if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   3.293 -					realfile="$(readlink /var/lib/tazpkg/fslink)$file"
   3.294 -				fi
   3.295 -				echo -n "$(stat -c "%A|%U|%G|%s|$file|" "$realfile" || \
   3.296 -					   echo "File lost !||||$file|")"
   3.297 -				if [ -L "$realfile" ]; then
   3.298 -					echo -n "$(readlink "$realfile")"
   3.299 -				elif [ -f "$file" ]; then
   3.300 -					case "$CONF_FILES" in
   3.301 -					*$file*) 
   3.302 -						if cmp $file $TMP_DIR$file > /dev/null 2>&1; then
   3.303 -							echo -n "[configuration]"
   3.304 -						else
   3.305 -							echo -n "$(stat -c "[configuration: %.16y]" $file)"
   3.306 -						fi;;
   3.307 -					#*	if [ "$(tazpkg check-file $file $2)" = "failure" ]; then
   3.308 -					#		echo -n "Invalid md5"
   3.309 -					#	fi;;
   3.310 -					esac
   3.311 -				fi
   3.312 -				echo ""
   3.313 -			done
   3.314 -			[ "$CONF_FILES" ] && rm -rf $TMP_DIR
   3.315 -			exit 0
   3.316 -		fi
   3.317 -		
   3.318 -		if [ "$2" = "list_files_mirror" ]; then
   3.319 -			for i in /var/lib/tazpkg/files.list.lzma \
   3.320 -				/var/lib/tazpkg/undigest/*/files.list.lzma ; do
   3.321 -				[ -f $i ] || continue
   3.322 -				unlzma -c $i
   3.323 -			done | grep -- "^$3:" | awk '{ print substr($0,index($0,":")+2) }'
   3.324 -			exit 0
   3.325 -		fi
   3.326 -		
   3.327 -		if [ "$2" = "list_packages" ]; then
   3.328 -			PKG="$3"
   3.329 -			if [ "$4" ]; then
   3.330 -				shift
   3.331 -				export LIST_PKGS='
   3.332 -		<window title="Packages" icon-name="tazpkg">
   3.333 -		  <vbox>
   3.334 -		     <tree>
   3.335 -			<width>600</width><height>160</height>
   3.336 -			<label>Package|Version|Size|Description</label>
   3.337 -			<variable>PKG</variable>
   3.338 -		'
   3.339 -				for i in "$@"; do
   3.340 -					if [ -d $ROOT/installed/$i ]; then
   3.341 -						. $ROOT/installed/$i/receipt
   3.342 -						LIST_PKGS="$LIST_PKGS
   3.343 -			<item icon=\"tazpkg\">$i|$VERSION|Installed|$SHORT_DESC</item>
   3.344 -		"
   3.345 -					else
   3.346 -						RES=`grep -sh "^$i " \
   3.347 -						/var/lib/tazpkg/packages.desc \
   3.348 -						/var/lib/tazpkg/undigest/*/packages.desc`
   3.349 -						PACKAGE=`echo "$RES" | cut -d "|" -f 1`
   3.350 -						VERSION=`echo "$RES" | cut -d "|" -f 2`
   3.351 -						SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
   3.352 -						SIZE=`grep -sh -A 3 "^$(echo $PACKAGE)$" \
   3.353 -						/var/lib/tazpkg/packages.txt \
   3.354 -						/var/lib/tazpkg/undigest/*/packages.txt | \
   3.355 -						tail -1 | sed 's/.*(\(.*\) .*/\1/'`
   3.356 -						LIST_PKGS="$LIST_PKGS
   3.357 -			<item icon=\"tazpkg\">$i|$VERSION|$SIZE|$SHORT_DESC</item>
   3.358 -		"
   3.359 -					fi
   3.360 -				done
   3.361 -				LIST_PKGS="$LIST_PKGS
   3.362 -			<action>echo "\$PKG" > /tmp/tazpkgbox/pkg</action>
   3.363 -			<action>$0 package-infos</action>
   3.364 -			<action>refresh:PKG</action>
   3.365 -			<action>refresh:PKG_STATS</action>
   3.366 -			<action>refresh:CACHE_STATS</action>
   3.367 -		     </tree>
   3.368 -		     <hbox>
   3.369 -			<button ok>
   3.370 -			</button>
   3.371 -			<button cancel>
   3.372 -				<action type=\"closewindow\">LIST_PKGS</action>
   3.373 -			</button>
   3.374 -		     </hbox>
   3.375 -		  </vbox>
   3.376 -		</window>
   3.377 -		"
   3.378 -				eval `gtkdialog --center --program=LIST_PKGS`
   3.379 -				[ "$EXIT" = "OK" ] || exit 0
   3.380 -			fi
   3.381 -		fi
   3.382 -		
   3.383 -		export LIST_FILES="
   3.384 -		<window title=\"`eval_gettext \"\\$PKG files\"`\" icon-name=\"system-file-manager\">
   3.385 -		  <vbox>
   3.386 -			<tree exported_column=\"4\">
   3.387 -				<variable>FILE</variable>
   3.388 -				<width>600</width><height>160</height>
   3.389 -				<label>Access | User | Group | Size | Name | Target</label>
   3.390 -				<input> $0 package-infos list_files $PKG </input>
   3.391 -				<action>tazpkg list-config $PKG | grep -q ^\$FILE$ && leafpad \$FILE</action>
   3.392 -			</tree>
   3.393 -			<hbox>
   3.394 -				<button>
   3.395 -					<input file icon=\"gtk-close\"></input>
   3.396 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.397 -				</button>
   3.398 -			</hbox>
   3.399 -		  </vbox>
   3.400 -		</window>
   3.401 -		"
   3.402 -		
   3.403 -		export LIST_FILES_MIRROR="
   3.404 -		<window title=\"$PKG files\" icon-name=\"system-file-manager\">
   3.405 -		  <vbox>
   3.406 -			<tree>
   3.407 -				<width>300</width><height>160</height>
   3.408 -				<label>File Name</label>
   3.409 -				<input> $0 package-infos list_files_mirror $PKG </input>
   3.410 -			</tree>
   3.411 -			<hbox>
   3.412 -				<button>
   3.413 -					<input file icon=\"gtk-close\"></input>
   3.414 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.415 -				</button>
   3.416 -			</hbox>
   3.417 -		  </vbox>
   3.418 -		</window>
   3.419 -		"
   3.420 -		
   3.421 -		# Installed or not installed, that is the question!
   3.422 -		if [ -d $ROOT/installed/$PKG ]; then
   3.423 -			PACKED_SIZE=""
   3.424 -			DEPENDS=""
   3.425 -			MAINTAINER=""
   3.426 -			BUGS=""
   3.427 -			TAGS=""
   3.428 -			. $ROOT/installed/$PKG/receipt
   3.429 -			MAINTAINER=$(echo "$MAINTAINER" | sed 's/[<>|]/ /g')
   3.430 -			upgrade_version="$(cat /var/lib/tazpkg/packages.desc \
   3.431 -				/var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | \
   3.432 -				awk "/^$PACKAGE / { print \$3 }" | head -1 )"
   3.433 -			UPGRADE=""
   3.434 -			if [ "$upgrade_version" ]; then
   3.435 -				if [ "$upgrade_version" != "$VERSION" ]; then
   3.436 -					UPGRADE="$upgrade_version"
   3.437 -				else
   3.438 -					cur_md5="$(awk "/ $PACKAGE-$VERSION/ { print \$1 }" \
   3.439 -						$ROOT/installed.md5)"
   3.440 -					new_md5="$(cat /var/lib/tazpkg/packages.md5 \
   3.441 -						/var/lib/tazpkg/undigest/*/packages.md5 \
   3.442 -						2> /dev/null | awk "/ $PACKAGE-$VERSION/ { print \$1 }")"
   3.443 -					if [ "$cur_md5" -a "$new_md5" -a \
   3.444 -						"$cur_md5" != "$new_md5" ]; then
   3.445 -						UPGRADE="build"
   3.446 -					fi
   3.447 -				fi
   3.448 -			fi
   3.449 -			PACKAGE_INFOS="
   3.450 -		<window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
   3.451 -		<vbox>
   3.452 -		
   3.453 -			<tree>
   3.454 -				<width>460</width><height>200</height>
   3.455 -				<label>$PKG|$SHORT_DESC</label>
   3.456 -				<variable>FIELD</variable>		
   3.457 -				<item icon=\"tazpkg\">Version: | $VERSION</item>
   3.458 -				<item icon=\"tazpkg\">Category: | $CATEGORY</item>"
   3.459 -		[ "$UPGRADE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.460 -				<item icon=\"tazpkg\">Upgrade: | $(echo $UPGRADE)</item>"
   3.461 -		[ "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.462 -				<item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
   3.463 -		[ "$SUGGESTED" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.464 -				<item icon=\"tazpkg\">Suggested: | $(echo $SUGGESTED)</item>"
   3.465 -		[ "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.466 -				<item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
   3.467 -		[ "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.468 -				<item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
   3.469 -		[ "$BUGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.470 -				<item icon=\"important\">Bugs: | $BUGS</item>"
   3.471 -		[ "$HANDBOOK_URL" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.472 -				<item icon=\"ascii\">Handbook: | $HANDBOOK_URL</item>"
   3.473 -		[ "$TAGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.474 -				<item icon=\"tazpkg\">Tags: | $TAGS</item>"
   3.475 -		[ "$CONFIG_FILES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.476 -				<item icon=\"tazpkg\">Config files: | $CONFIG_FILES</item>"
   3.477 -		[ -f $ROOT/installed/$PKG/modifiers ] && 
   3.478 -		PACKAGE_INFOS="$PACKAGE_INFOS
   3.479 -				<item icon=\"tazpkg\">Modified by: | $(xargs echo < $ROOT/installed/$PKG/modifiers)</item>"
   3.480 -		PACKAGE_INFOS="$PACKAGE_INFOS
   3.481 -				<item icon=\"applications-internet\">Website: | $WEB_SITE</item>
   3.482 -				<item icon=\"help\">Tip: | double-click any item for more information</item>
   3.483 -				<action> $0 package-infos info \"\$FIELD\" $PKG </action>		
   3.484 -			</tree>
   3.485 -		
   3.486 -			<hbox>"
   3.487 -		[ -s $ROOT/installed/$PACKAGE/description.txt ] &&
   3.488 -			PACKAGE_INFOS="$PACKAGE_INFOS
   3.489 -				<button>
   3.490 -					<label>Description</label>
   3.491 -					<input file icon=\"help\"></input>
   3.492 -					<action>xterm -T \"$PKG description (q to quit)\" $XTERM_OPTS \
   3.493 -					-e \"less $ROOT/installed/$PKG/description.txt\"</action>
   3.494 -				</button>"
   3.495 -		if [ ! -d /var/lib/tazpkg/fslink ]; then
   3.496 -			[ ${PKG%%-*} = get -a ! -d $ROOT/installed/${PKG#get-} ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.497 -				<button>
   3.498 -					<label>Install</label>
   3.499 -					<input file icon=\"go-next\"></input>
   3.500 -					<action>xterm -T \"Install ${PKG#get-}\" $XTERM_OPTS -e \"\
   3.501 -					$PKG; sleep 5\"</action>
   3.502 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.503 -				</button>"
   3.504 -			[ "$UPGRADE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.505 -				<button>
   3.506 -					<label>Upgrade</label>
   3.507 -					<input file icon=\"go-next\"></input>
   3.508 -					<action>xterm -T \"Install $PKG\" $XTERM_OPTS -e \"\
   3.509 -					tazpkg get-install $PKG --forced ; sleep 5\"</action>
   3.510 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.511 -				</button>"
   3.512 -			fgrep -q post_install $ROOT/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
   3.513 -				<button>
   3.514 -					<label>Reconfigure</label>
   3.515 -					<input file icon=\"reload\"></input>
   3.516 -					<action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
   3.517 -					tazpkg reconfigure $PACKAGE; sleep 2\"</action>
   3.518 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.519 -				</button>"
   3.520 -			if grep -qs ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
   3.521 -				PACKAGE_INFOS="$PACKAGE_INFOS
   3.522 -				<button>
   3.523 -					<label>Unblock</label>
   3.524 -					<input file icon=\"up\"></input>
   3.525 -					<action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
   3.526 -					tazpkg unblock $PACKAGE; sleep 2\"</action>
   3.527 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.528 -				</button>"
   3.529 -			else
   3.530 -				PACKAGE_INFOS="$PACKAGE_INFOS
   3.531 -				<button>
   3.532 -					<label>Block</label>
   3.533 -					<input file icon=\"down\"></input>
   3.534 -					<action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
   3.535 -					tazpkg block $PACKAGE; sleep 2\"</action>
   3.536 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.537 -				</button>"
   3.538 -			fi
   3.539 -		fi
   3.540 -		if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   3.541 -			PACKAGE_INFOS="$PACKAGE_INFOS
   3.542 -				<button>
   3.543 -					<label>Link</label>
   3.544 -					<input file icon=\"edit-redo\"></input>
   3.545 -					<action>xterm -T \"Link $PACKAGE\" $XTERM_OPTS -e \"\
   3.546 -					tazpkg link $PACKAGE $(readlink /var/lib/tazpkg/fslink); sleep 2\"</action>
   3.547 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.548 -				</button>"
   3.549 -		elif [ ! -s $ROOT/installed/$PKG/modifiers ]; then
   3.550 -			[ -L $ROOT/installed/$PKG ] || PACKAGE_INFOS="$PACKAGE_INFOS
   3.551 -				<button>
   3.552 -					<label>Repack</label>
   3.553 -					<input file icon=\"edit-redo\"></input>
   3.554 -					<action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
   3.555 -					cd /var/cache/tazpkg; \
   3.556 -					tazpkg repack $PACKAGE; sleep 2\"</action>
   3.557 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.558 -				</button>
   3.559 -		"
   3.560 -			PACKAGE_INFOS="$PACKAGE_INFOS
   3.561 -				<button>
   3.562 -					<label>Remove</label>
   3.563 -					<input file icon=\"edit-delete\"></input>
   3.564 -					<action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
   3.565 -					tazpkg remove $PACKAGE; sleep 2\"</action>
   3.566 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.567 -				</button>
   3.568 -		"
   3.569 -		else
   3.570 -			PACKAGE_INFOS="$PACKAGE_INFOS
   3.571 -				<button>
   3.572 -					<label>Re-install</label>
   3.573 -					<input file icon=\"edit-redo\"></input>
   3.574 -					<action>xterm -T \"Re-install $PACKAGE\" $XTERM_OPTS -e \"\
   3.575 -					tazpkg get-install $PACKAGE --forced; sleep 2\"</action>
   3.576 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.577 -				</button>
   3.578 -				<button>
   3.579 -					<label>Remove</label>
   3.580 -					<input file icon=\"edit-delete\"></input>
   3.581 -					<action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
   3.582 -					tazpkg remove $PACKAGE; sleep 2\"</action>
   3.583 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.584 -				</button>
   3.585 -		"
   3.586 -		fi
   3.587 -		PACKAGE_INFOS="$PACKAGE_INFOS
   3.588 -				<button>
   3.589 -					<label>View Files</label>
   3.590 -					<input file icon=\"tazpkg\"></input>
   3.591 -					<action type=\"launch\">LIST_FILES</action>
   3.592 -				</button>
   3.593 -				<button>
   3.594 -					<input file icon=\"gtk-close\"></input>
   3.595 -					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   3.596 -				</button>
   3.597 -			</hbox>
   3.598 -		
   3.599 -		</vbox>
   3.600 -		</window>
   3.601 -		"
   3.602 -			export PACKAGE_INFOS
   3.603 -		else
   3.604 -			RES=`grep -sh "^$PKG " /var/lib/tazpkg/packages.desc \
   3.605 -				/var/lib/tazpkg/undigest/*/packages.desc`
   3.606 -			PACKAGE=`echo "$RES" | cut -d "|" -f 1`
   3.607 -			VERSION=`echo "$RES" | cut -d "|" -f 2`
   3.608 -			SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
   3.609 -			CATEGORY=`echo "$RES" | cut -d "|" -f 4`
   3.610 -			WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
   3.611 -			SIZES=`grep -sh -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt \
   3.612 -				/var/lib/tazpkg/undigest/*/packages.txt | tail -1`
   3.613 -			DEPENDS=""
   3.614 -			SUGGESTED=""
   3.615 -			MAINTAINER=""
   3.616 -			BUGS=""
   3.617 -			HANDBOOK_URL=""
   3.618 -			TAGS=""
   3.619 -			CONFIG_FILES=""
   3.620 -			height=160
   3.621 -			if [ -s /home/slitaz/wok/$PKG/receipt ]; then
   3.622 -				. /home/slitaz/wok/$PKG/receipt
   3.623 -				height=200
   3.624 -			fi
   3.625 -			PACKAGE_INFOS="
   3.626 -		<window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
   3.627 -		<vbox>
   3.628 -		
   3.629 -			<tree>
   3.630 -				<width>460</width><height>$height</height>
   3.631 -				<label>$PKG|$SHORT_DESC</label>
   3.632 -				<variable>FIELD2</variable>
   3.633 -				<item icon=\"tazpkg\">Version: | $VERSION</item>
   3.634 -				<item icon=\"tazpkg\">Category: | $CATEGORY</item>"
   3.635 -			[ "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.636 -				<item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
   3.637 -			[ "$SUGGESTED" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.638 -				<item icon=\"tazpkg\">Suggested: | $(echo $SUGGESTED)</item>"
   3.639 -			[ "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.640 -				<item icon=\"tazpkg\">Size: | $SIZES</item>"
   3.641 -			[ "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.642 -				<item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
   3.643 -			[ "$BUGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.644 -				<item icon=\"important\">Bugs: | $BUGS</item>"
   3.645 -			[ "$HANDBOOK_URL" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.646 -				<item icon=\"ascii\">Handbook: | $HANDBOOK_URL</item>"
   3.647 -			[ "$TAGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.648 -				<item icon=\"tazpkg\">Tags: | $TAGS</item>"
   3.649 -			[ "$CONFIG_FILES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.650 -				<item icon=\"tazpkg\">Config files: | $CONFIG_FILES</item>"
   3.651 -			PACKAGE_INFOS="$PACKAGE_INFOS
   3.652 -				<item icon=\"applications-internet\">Website: | $WEB_SITE</item>		
   3.653 -				<item icon=\"text-editor\">Receipt: | double-click to view receipt</item>
   3.654 -				<action>case \$FIELD2 in Web*) browser $WEB_SITE &;; esac</action>
   3.655 -				<action>case \$FIELD2 in Rec*) browser http://hg.slitaz.org/wok/raw-file/tip/$PACKAGE/receipt &;; esac</action>
   3.656 -				
   3.657 -			</tree>
   3.658 -		
   3.659 -			<hbox>"
   3.660 -			[ ${PACKAGE%%-*} = get ] && PACKAGE_INFOS="$PACKAGE_INFOS
   3.661 -				<checkbox>
   3.662 -					<label>Auto exec</label>
   3.663 -					<variable>AUTO_EXEC</variable>
   3.664 -					<default>true</default>
   3.665 -				</checkbox>"
   3.666 -			PACKAGE_INFOS="$PACKAGE_INFOS
   3.667 -				<checkbox>
   3.668 -					<label>Auto install depends</label>
   3.669 -					<variable>AUTO_DEPENDS</variable>
   3.670 -					<default>true</default>
   3.671 -				</checkbox>
   3.672 -				<button>
   3.673 -					<label>Install Package</label>
   3.674 -					<input file icon=\"go-next\"></input>
   3.675 -					<action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
   3.676 -					if [ x\$AUTO_DEPENDS != xtrue ]; then script -c \\\"tazpkg get-install $PACKAGE\\\" /var/log/tazpkg-install.log;\
   3.677 -					else script -c \\\"yes y | tazpkg get-install $PACKAGE\\\" /var/log/tazpkg-install.log; fi; \
   3.678 -					[ x\${AUTO_EXEC} = xtrue ] && $PACKAGE; \
   3.679 -					sleep 2\"</action>
   3.680 -					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   3.681 -				</button>
   3.682 -				<button>
   3.683 -					<label>Download</label>
   3.684 -					<input file icon=\"go-next\"></input>
   3.685 -					<action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
   3.686 -					cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
   3.687 -					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   3.688 -				</button>
   3.689 -				<button>
   3.690 -					<label>View Files</label>
   3.691 -					<input file icon=\"tazpkg\"></input>
   3.692 -					<action type=\"launch\">LIST_FILES_MIRROR</action>
   3.693 -				</button>
   3.694 -				<button>
   3.695 -					<input file icon=\"gtk-close\"></input>
   3.696 -					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   3.697 -				</button>
   3.698 -			</hbox>
   3.699 -		
   3.700 -		</vbox>
   3.701 -		</window>
   3.702 -		"
   3.703 -			export PACKAGE_INFOS
   3.704 -		fi
   3.705 -		gtkdialog --center --program=PACKAGE_INFOS ;;
   3.706 -
   3.707 -	*)
   3.708 -		usage $@ ;;
   3.709 -esac
   3.710 -
   3.711 -exit 0
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/oldstuff/libtazpkgbox	Mon May 16 19:38:39 2011 +0200
     4.3 @@ -0,0 +1,708 @@
     4.4 +#!/bin/sh
     4.5 +# The libtazpkgbox - Libraries used by tazpkg GUI box.
     4.6 +#
     4.7 +# These are functions to list installed packages in a suitable format for a
     4.8 +# GTK tree and list mirrored packages using the packages.desc file. The libs
     4.9 +# also provide functions to search packages and files, and the GUI box for
    4.10 +# package information.
    4.11 +#
    4.12 +# (C) 2010 SliTaz - GNU General Public License v3.
    4.13 +#
    4.14 +
    4.15 +# Include gettext helper script.
    4.16 +. /usr/bin/gettext.sh
    4.17 +
    4.18 +# Export package name for gettext.
    4.19 +TEXTDOMAIN='libtazpkgbox'
    4.20 +export TEXTDOMAIN
    4.21 +
    4.22 +# Dont hardcore path, use $LIB
    4.23 +export LIB=/usr/lib/slitaz/libtazpkgbox
    4.24 +
    4.25 +usage()
    4.26 +{
    4.27 +	[ "$1" ] && echo "??? $0 $@"
    4.28 +	echo -e "\nTazpkgbox library\n
    4.29 +Usage    : $0 [function] [pkg|args]	[pkg]
    4.30 +Functions:
    4.31 +  list-all          List all packages.
    4.32 +  list-undigest     List undigest packages.
    4.33 +  list-blocked      List blocked packages.
    4.34 +  list-upgradeable  List all upgradable packages.
    4.35 +  search-packages   Search for packages.
    4.36 +  search-files      Search for files.
    4.37 +  search-tags       Search for TAGS.
    4.38 +  package-infos     Display box with pkg information."
    4.39 +}
    4.40 +
    4.41 +# List functions.
    4.42 +undigest_list()
    4.43 +{
    4.44 +	IFS="|"
    4.45 +	if [ "$1" -a "$1" != "all" ]; then
    4.46 +		cut -f 1,2,3,4 -d "|" undigest/$1/packages.desc
    4.47 +	else
    4.48 +		cut -f 1,2,3,4 -d "|" undigest/*/packages.desc | sort
    4.49 +	fi 2> /dev/null | while read PACKAGE VERSION SHORT_DESC CATEGORY; do
    4.50 +		[ $CAT = all -o $CATEGORY = " $CAT " ] || continue
    4.51 +		ICON=tazpkg
    4.52 +		PACKAGE=${PACKAGE%% *}
    4.53 +		if [ -d installed/$PACKAGE ]; then
    4.54 +			[ "$2" = "installable" ] && continue
    4.55 +			ICON=tazpkg-installed
    4.56 +			if grep -qs "^$PACKAGE$" blocked-packages.list; then
    4.57 +				ICON=stop
    4.58 +			fi
    4.59 +		else
    4.60 +			[ "$2" = "installed" ] && continue
    4.61 +		fi
    4.62 +		[ "$2" = "blocked" -a "$ICON" != "stop" ] && continue
    4.63 +		[ "$2" = "upgradeable" ] && 
    4.64 +		! grep -q ^$PACKAGE$ upgradeable-packages.list && continue
    4.65 +		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    4.66 +	done
    4.67 +	unset IFS
    4.68 +}
    4.69 +
    4.70 +installable_list()
    4.71 +{
    4.72 +	local cache
    4.73 +	cache=packages.installable_list.$CAT
    4.74 +	if [ -s $cache -a $cache -nt packages.desc -a $cache -nt installed ]; then
    4.75 +	     cat $cache
    4.76 +	     return
    4.77 +	fi
    4.78 +	IFS="|"
    4.79 +	cut -f 1,2,3,4 -d "|" packages.desc undigest/*/packages.desc 2> /dev/null | sort | \
    4.80 +	while read PACKAGE VERSION SHORT_DESC CATEGORY; do
    4.81 +		# Check first for category for more speed.
    4.82 +		[ $CAT = all -o $CATEGORY = " $CAT " ] || continue
    4.83 +		[ -d installed/${PACKAGE% } ] && continue
    4.84 +		ICON=tazpkg
    4.85 +		grep -qs "^$PACKAGE" undigest/*/packages.desc && ICON=add
    4.86 +		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
    4.87 +	done | tee $cache
    4.88 +	unset IFS
    4.89 +}
    4.90 +
    4.91 +installed_list()
    4.92 +{
    4.93 +	for pkg in ${1}installed/*
    4.94 +	do
    4.95 +		[ "$1" -a -s installed/$(basename $pkg)/receipt ] && continue
    4.96 +		. $pkg/receipt
    4.97 +		ICON=tazpkg-installed
    4.98 +		[ $CAT = all -o $CATEGORY = $CAT ] || continue
    4.99 +		if [ "$1" -o -L $pkg ]; then
   4.100 +			ICON=media-flash
   4.101 +		else
   4.102 +			grep -qs "^$PACKAGE" undigest/*/packages.desc && ICON=add
   4.103 +		fi
   4.104 +		grep -qs "^$PACKAGE$" blocked-packages.list && ICON=stop
   4.105 +		echo "$ICON|$PACKAGE|$VERSION|$SHORT_DESC"
   4.106 +	done
   4.107 +}
   4.108 +
   4.109 +all_list()
   4.110 +{
   4.111 +	local cache
   4.112 +	cache=packages.all_list.$CAT
   4.113 +	if [ -s $cache -a $cache -nt packages.desc -a $cache -nt installed ]; then
   4.114 +	     cat $cache
   4.115 +	     return
   4.116 +	fi
   4.117 +	{ installable_list ; installed_list; } | sort -t \| -k 2 -u | tee $cache
   4.118 +}
   4.119 +
   4.120 +blocked_list()
   4.121 +{
   4.122 +	ICON=tazpkg-installed
   4.123 +	[ "$1" = "blocked" ] && ICON=stop
   4.124 +	for pkg in $(cat $1-packages.list 2> /dev/null); do
   4.125 +		[ -f installed/$pkg/receipt ] || continue
   4.126 +		. installed/$pkg/receipt
   4.127 +		[ $CAT = all -o $CATEGORY = $CAT ] || continue
   4.128 +		AVAILABLE=$(grep -s "^$pkg " packages.desc \
   4.129 +			undigest/*/packages.desc | awk '{ print $3 }')
   4.130 +		echo "$ICON|$PACKAGE|$VERSION (Available: $AVAILABLE)|$SHORT_DESC"
   4.131 +	done
   4.132 +}
   4.133 +
   4.134 +# Search functions
   4.135 +
   4.136 +clean_search()
   4.137 +{
   4.138 +	# Clean preview results.
   4.139 +	rm -f /tmp/tazpkgbox/search
   4.140 +	touch /tmp/tazpkgbox/search
   4.141 +}
   4.142 +
   4.143 +list_files()
   4.144 +{
   4.145 +	sed -e "/^$/d" -e "1,/^=*$/d" -e "/^=*$/,/EOT/d" | while read input; do
   4.146 +		if [ "$input" = "${input/ :/}" ]; then
   4.147 +			# Input is a file.
   4.148 +			if [ "$ICON" = tazpkg ]; then
   4.149 +				echo "add|$PACKAGE| |$input"
   4.150 +			else
   4.151 +				if [ -d $input ] ; then
   4.152 +					echo "folder|$PACKAGE| |$input"
   4.153 +				elif [ -x $input ]; then
   4.154 +					echo "exec|$PACKAGE| |$input"
   4.155 +				elif [ -f $input ]; then
   4.156 +					echo "txt|$PACKAGE| |$input"
   4.157 +				else
   4.158 +					# Missing installed file.
   4.159 +					echo "dialog-warning|$PACKAGE| |$input"
   4.160 +				fi
   4.161 +			fi	
   4.162 +		else
   4.163 +			# Input contains package name, don't refer to Package word as
   4.164 +			# tazpkg can use other languages.
   4.165 +			PACKAGE=$(echo $input | sed 's/^.* \(.*\) :.*$/\1/')
   4.166 +			ICON=tazpkg
   4.167 +			[ -d /var/lib/tazpkg/installed/$PACKAGE ] && ICON=tazpkg-installed
   4.168 +			echo "$ICON|$PACKAGE |$(grep -hs "^$PACKAGE " /var/lib/tazpkg/packages.desc \
   4.169 +				/var/lib/tazpkg/undigest/*/packages.desc | cut -f2,3 -d '|' | head -1)"
   4.170 +		fi
   4.171 +	done
   4.172 +}
   4.173 +
   4.174 +list_package()
   4.175 +{
   4.176 +		if [ -d /var/lib/tazpkg/installed/$1 ]; then
   4.177 +			. /var/lib/tazpkg/installed/$1/receipt
   4.178 +			echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC"
   4.179 +		else
   4.180 +			echo "tazpkg|$PACKAGE|$VERSION|$SHORT_DESC"
   4.181 +		fi
   4.182 +}
   4.183 +
   4.184 +search_package()
   4.185 +{
   4.186 +	IFS="|"
   4.187 +	cut -f1,2,3 -d '|' /var/lib/tazpkg/packages.desc \
   4.188 +	    /var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | sort | \
   4.189 +	while read PACKAGE VERSION SHORT_DESC; do
   4.190 +		[ "$PACKAGE" = "${PACKAGE/$SEARCH/}" -a "$SHORT_DESC" = "${SHORT_DESC/$SEARCH/}" ] \
   4.191 +			&& continue
   4.192 +		list_package ${PACKAGE% }
   4.193 +	done
   4.194 +	unset IFS
   4.195 +}
   4.196 +
   4.197 +case "$1" in
   4.198 +	list-all)
   4.199 +		cd /var/lib/tazpkg
   4.200 +		CAT=`cat /tmp/tazpkgbox/category`
   4.201 +		STATUS=`cat /tmp/tazpkgbox/status`
   4.202 +		case $STATUS in
   4.203 +			blocked|upgradeable)
   4.204 +				blocked_list $STATUS;;
   4.205 +			linkable)
   4.206 +				[ -d fslink ] && installed_list \
   4.207 +					$(readlink fslink)/var/lib/tazpkg/;;
   4.208 +			installed)
   4.209 +				installed_list ;;
   4.210 +			installable)
   4.211 +				installable_list ;;
   4.212 +			*)
   4.213 +				all_list ;;
   4.214 +		esac ;;
   4.215 +	list-undigest)
   4.216 +		cd /var/lib/tazpkg
   4.217 +		set -- `cat /tmp/tazpkgbox/undigest-category`
   4.218 +		CAT="${1:-all}"
   4.219 +		undigest_list $2 $3 ;;
   4.220 +	list-blocked|list-upgradeable)
   4.221 +		cd /var/lib/tazpkg
   4.222 +		CAT=`cat /tmp/tazpkgbox/category`
   4.223 +		blocked_list $1 ;;
   4.224 +	search-files)
   4.225 +		# Search for files
   4.226 +		clean_search
   4.227 +		tazpkg search-file "$SEARCH" --mirror | list_files > \
   4.228 +			/tmp/tazpkgbox/search ;;
   4.229 +	search-packages)
   4.230 +		clean_search
   4.231 +		{ search_package ;
   4.232 +		  for i in $(grep ^$SEARCH= /var/lib/tazpkg/packages.equiv | \
   4.233 +		          cut -d= -f2); do
   4.234 +		        SEARCH=${i#*:}
   4.235 +		        search_package
   4.236 +		  done; } > /tmp/tazpkgbox/search ;;
   4.237 +	search-tags)
   4.238 +		clean_search
   4.239 +		fgrep -ls TAGS /home/slitaz/wok/*/receipt | while read file; do
   4.240 +			TAGS=""
   4.241 +			. $file
   4.242 +			case "$TAGS" in
   4.243 +			*$SEARCH*) list_package $PACKAGE ;;
   4.244 +			esac
   4.245 +		done > /tmp/tazpkgbox/search ;;
   4.246 +	package-infos)
   4.247 +		# Dialog box to provide package info and actions
   4.248 +		XTERM_OPTS="-geometry 80x16+120+120"	
   4.249 +		PKG=`cat /tmp/tazpkgbox/pkg | sed s/" "/""/g`
   4.250 +		ROOT=/var/lib/tazpkg
   4.251 +		if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   4.252 +			ROOT=$(readlink /var/lib/tazpkg/fslink)$ROOT
   4.253 +		fi
   4.254 +		TMP_DIR=/tmp/tazpkg-$$-$RANDOM
   4.255 +		if [ "$2" = "sizes" ]; then
   4.256 +			cat <<EOT
   4.257 +Dependencies for $3:
   4.258 +$(tazpkg depends $3)
   4.259 +
   4.260 +Reverse dependencies for $3:
   4.261 +$(tazpkg rdepends $3)
   4.262 +EOT
   4.263 +			exit 0
   4.264 +		fi
   4.265 +		if [ "$2" = "info" ]; then
   4.266 +			RECEIPT=$ROOT/installed/$4/receipt
   4.267 +			. $RECEIPT
   4.268 +			case "$3" in
   4.269 +			Web*) browser $WEB_SITE &;;
   4.270 +			Tip*) browser http://hg.slitaz.org/wok/raw-file/tip/$4/receipt &;;
   4.271 +			Siz*) xterm -T "$4 `gettext \"depends (q to quit)\"`" -e "$0 package-infos sizes $4 | less";;
   4.272 +			Upg*) xterm -T "$4 `gettext \"upgrade\"`" -e "tazpkg get-install $4 --forced ; sleep 2";;
   4.273 +			Hand*) browser $HANDBOOK_URL &;;
   4.274 +			Sug*) $0 package-infos list_packages $SUGGESTED;;
   4.275 +			Dep*) $0 package-infos list_packages $DEPENDS;;
   4.276 +			Mod*) $0 package-infos list_packages $(xargs echo < $ROOT/installed/$3/modifiers);;
   4.277 +			Con*) tazpkgbox list_config $4;;
   4.278 +			Ver*) xterm -T "$4 `gettext \"receipt (q to quit)\"`" -e "cat $RECEIPT | less";;
   4.279 +			esac
   4.280 +			exit 0
   4.281 +		fi
   4.282 +		
   4.283 +		if [ "$2" = "list_files" ]; then
   4.284 +			CONF_FILES="$(tazpkg list-config $3 | awk "$AWK_FILTER")"
   4.285 +			if [ "$CONF_FILES" ]; then
   4.286 +				mkdir $TMP_DIR
   4.287 +				zcat $ROOT/installed/$3/volatile.cpio.gz | \
   4.288 +					( cd $TMP_DIR ; cpio -id > /dev/null )
   4.289 +			fi
   4.290 +			cat $ROOT/installed/$3/files.list | grep ^/ | while read file; do
   4.291 +				realfile="$file"
   4.292 +				if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   4.293 +					realfile="$(readlink /var/lib/tazpkg/fslink)$file"
   4.294 +				fi
   4.295 +				echo -n "$(stat -c "%A|%U|%G|%s|$file|" "$realfile" || \
   4.296 +					   echo "File lost !||||$file|")"
   4.297 +				if [ -L "$realfile" ]; then
   4.298 +					echo -n "$(readlink "$realfile")"
   4.299 +				elif [ -f "$file" ]; then
   4.300 +					case "$CONF_FILES" in
   4.301 +					*$file*) 
   4.302 +						if cmp $file $TMP_DIR$file > /dev/null 2>&1; then
   4.303 +							echo -n "[configuration]"
   4.304 +						else
   4.305 +							echo -n "$(stat -c "[configuration: %.16y]" $file)"
   4.306 +						fi;;
   4.307 +					#*	if [ "$(tazpkg check-file $file $2)" = "failure" ]; then
   4.308 +					#		echo -n "Invalid md5"
   4.309 +					#	fi;;
   4.310 +					esac
   4.311 +				fi
   4.312 +				echo ""
   4.313 +			done
   4.314 +			[ "$CONF_FILES" ] && rm -rf $TMP_DIR
   4.315 +			exit 0
   4.316 +		fi
   4.317 +		
   4.318 +		if [ "$2" = "list_files_mirror" ]; then
   4.319 +			for i in /var/lib/tazpkg/files.list.lzma \
   4.320 +				/var/lib/tazpkg/undigest/*/files.list.lzma ; do
   4.321 +				[ -f $i ] || continue
   4.322 +				unlzma -c $i
   4.323 +			done | grep -- "^$3:" | awk '{ print substr($0,index($0,":")+2) }'
   4.324 +			exit 0
   4.325 +		fi
   4.326 +		
   4.327 +		if [ "$2" = "list_packages" ]; then
   4.328 +			PKG="$3"
   4.329 +			if [ "$4" ]; then
   4.330 +				shift
   4.331 +				export LIST_PKGS='
   4.332 +		<window title="Packages" icon-name="tazpkg">
   4.333 +		  <vbox>
   4.334 +		     <tree>
   4.335 +			<width>600</width><height>160</height>
   4.336 +			<label>Package|Version|Size|Description</label>
   4.337 +			<variable>PKG</variable>
   4.338 +		'
   4.339 +				for i in "$@"; do
   4.340 +					if [ -d $ROOT/installed/$i ]; then
   4.341 +						. $ROOT/installed/$i/receipt
   4.342 +						LIST_PKGS="$LIST_PKGS
   4.343 +			<item icon=\"tazpkg\">$i|$VERSION|Installed|$SHORT_DESC</item>
   4.344 +		"
   4.345 +					else
   4.346 +						RES=`grep -sh "^$i " \
   4.347 +						/var/lib/tazpkg/packages.desc \
   4.348 +						/var/lib/tazpkg/undigest/*/packages.desc`
   4.349 +						PACKAGE=`echo "$RES" | cut -d "|" -f 1`
   4.350 +						VERSION=`echo "$RES" | cut -d "|" -f 2`
   4.351 +						SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
   4.352 +						SIZE=`grep -sh -A 3 "^$(echo $PACKAGE)$" \
   4.353 +						/var/lib/tazpkg/packages.txt \
   4.354 +						/var/lib/tazpkg/undigest/*/packages.txt | \
   4.355 +						tail -1 | sed 's/.*(\(.*\) .*/\1/'`
   4.356 +						LIST_PKGS="$LIST_PKGS
   4.357 +			<item icon=\"tazpkg\">$i|$VERSION|$SIZE|$SHORT_DESC</item>
   4.358 +		"
   4.359 +					fi
   4.360 +				done
   4.361 +				LIST_PKGS="$LIST_PKGS
   4.362 +			<action>echo "\$PKG" > /tmp/tazpkgbox/pkg</action>
   4.363 +			<action>$0 package-infos</action>
   4.364 +			<action>refresh:PKG</action>
   4.365 +			<action>refresh:PKG_STATS</action>
   4.366 +			<action>refresh:CACHE_STATS</action>
   4.367 +		     </tree>
   4.368 +		     <hbox>
   4.369 +			<button ok>
   4.370 +			</button>
   4.371 +			<button cancel>
   4.372 +				<action type=\"closewindow\">LIST_PKGS</action>
   4.373 +			</button>
   4.374 +		     </hbox>
   4.375 +		  </vbox>
   4.376 +		</window>
   4.377 +		"
   4.378 +				eval `gtkdialog --center --program=LIST_PKGS`
   4.379 +				[ "$EXIT" = "OK" ] || exit 0
   4.380 +			fi
   4.381 +		fi
   4.382 +		
   4.383 +		export LIST_FILES="
   4.384 +		<window title=\"`eval_gettext \"\\$PKG files\"`\" icon-name=\"system-file-manager\">
   4.385 +		  <vbox>
   4.386 +			<tree exported_column=\"4\">
   4.387 +				<variable>FILE</variable>
   4.388 +				<width>600</width><height>160</height>
   4.389 +				<label>Access | User | Group | Size | Name | Target</label>
   4.390 +				<input> $0 package-infos list_files $PKG </input>
   4.391 +				<action>tazpkg list-config $PKG | grep -q ^\$FILE$ && leafpad \$FILE</action>
   4.392 +			</tree>
   4.393 +			<hbox>
   4.394 +				<button>
   4.395 +					<input file icon=\"gtk-close\"></input>
   4.396 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.397 +				</button>
   4.398 +			</hbox>
   4.399 +		  </vbox>
   4.400 +		</window>
   4.401 +		"
   4.402 +		
   4.403 +		export LIST_FILES_MIRROR="
   4.404 +		<window title=\"$PKG files\" icon-name=\"system-file-manager\">
   4.405 +		  <vbox>
   4.406 +			<tree>
   4.407 +				<width>300</width><height>160</height>
   4.408 +				<label>File Name</label>
   4.409 +				<input> $0 package-infos list_files_mirror $PKG </input>
   4.410 +			</tree>
   4.411 +			<hbox>
   4.412 +				<button>
   4.413 +					<input file icon=\"gtk-close\"></input>
   4.414 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.415 +				</button>
   4.416 +			</hbox>
   4.417 +		  </vbox>
   4.418 +		</window>
   4.419 +		"
   4.420 +		
   4.421 +		# Installed or not installed, that is the question!
   4.422 +		if [ -d $ROOT/installed/$PKG ]; then
   4.423 +			PACKED_SIZE=""
   4.424 +			DEPENDS=""
   4.425 +			MAINTAINER=""
   4.426 +			BUGS=""
   4.427 +			TAGS=""
   4.428 +			. $ROOT/installed/$PKG/receipt
   4.429 +			MAINTAINER=$(echo "$MAINTAINER" | sed 's/[<>|]/ /g')
   4.430 +			upgrade_version="$(cat /var/lib/tazpkg/packages.desc \
   4.431 +				/var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | \
   4.432 +				awk "/^$PACKAGE / { print \$3 }" | head -1 )"
   4.433 +			UPGRADE=""
   4.434 +			if [ "$upgrade_version" ]; then
   4.435 +				if [ "$upgrade_version" != "$VERSION" ]; then
   4.436 +					UPGRADE="$upgrade_version"
   4.437 +				else
   4.438 +					cur_md5="$(awk "/ $PACKAGE-$VERSION/ { print \$1 }" \
   4.439 +						$ROOT/installed.md5)"
   4.440 +					new_md5="$(cat /var/lib/tazpkg/packages.md5 \
   4.441 +						/var/lib/tazpkg/undigest/*/packages.md5 \
   4.442 +						2> /dev/null | awk "/ $PACKAGE-$VERSION/ { print \$1 }")"
   4.443 +					if [ "$cur_md5" -a "$new_md5" -a \
   4.444 +						"$cur_md5" != "$new_md5" ]; then
   4.445 +						UPGRADE="build"
   4.446 +					fi
   4.447 +				fi
   4.448 +			fi
   4.449 +			PACKAGE_INFOS="
   4.450 +		<window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
   4.451 +		<vbox>
   4.452 +		
   4.453 +			<tree>
   4.454 +				<width>460</width><height>200</height>
   4.455 +				<label>$PKG|$SHORT_DESC</label>
   4.456 +				<variable>FIELD</variable>		
   4.457 +				<item icon=\"tazpkg\">Version: | $VERSION</item>
   4.458 +				<item icon=\"tazpkg\">Category: | $CATEGORY</item>"
   4.459 +		[ "$UPGRADE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.460 +				<item icon=\"tazpkg\">Upgrade: | $(echo $UPGRADE)</item>"
   4.461 +		[ "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.462 +				<item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
   4.463 +		[ "$SUGGESTED" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.464 +				<item icon=\"tazpkg\">Suggested: | $(echo $SUGGESTED)</item>"
   4.465 +		[ "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.466 +				<item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
   4.467 +		[ "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.468 +				<item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
   4.469 +		[ "$BUGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.470 +				<item icon=\"important\">Bugs: | $BUGS</item>"
   4.471 +		[ "$HANDBOOK_URL" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.472 +				<item icon=\"ascii\">Handbook: | $HANDBOOK_URL</item>"
   4.473 +		[ "$TAGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.474 +				<item icon=\"tazpkg\">Tags: | $TAGS</item>"
   4.475 +		[ "$CONFIG_FILES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.476 +				<item icon=\"tazpkg\">Config files: | $CONFIG_FILES</item>"
   4.477 +		[ -f $ROOT/installed/$PKG/modifiers ] && 
   4.478 +		PACKAGE_INFOS="$PACKAGE_INFOS
   4.479 +				<item icon=\"tazpkg\">Modified by: | $(xargs echo < $ROOT/installed/$PKG/modifiers)</item>"
   4.480 +		PACKAGE_INFOS="$PACKAGE_INFOS
   4.481 +				<item icon=\"applications-internet\">Website: | $WEB_SITE</item>
   4.482 +				<item icon=\"help\">Tip: | double-click any item for more information</item>
   4.483 +				<action> $0 package-infos info \"\$FIELD\" $PKG </action>		
   4.484 +			</tree>
   4.485 +		
   4.486 +			<hbox>"
   4.487 +		[ -s $ROOT/installed/$PACKAGE/description.txt ] &&
   4.488 +			PACKAGE_INFOS="$PACKAGE_INFOS
   4.489 +				<button>
   4.490 +					<label>Description</label>
   4.491 +					<input file icon=\"help\"></input>
   4.492 +					<action>xterm -T \"$PKG description (q to quit)\" $XTERM_OPTS \
   4.493 +					-e \"less $ROOT/installed/$PKG/description.txt\"</action>
   4.494 +				</button>"
   4.495 +		if [ ! -d /var/lib/tazpkg/fslink ]; then
   4.496 +			[ ${PKG%%-*} = get -a ! -d $ROOT/installed/${PKG#get-} ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.497 +				<button>
   4.498 +					<label>Install</label>
   4.499 +					<input file icon=\"go-next\"></input>
   4.500 +					<action>xterm -T \"Install ${PKG#get-}\" $XTERM_OPTS -e \"\
   4.501 +					$PKG; sleep 5\"</action>
   4.502 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.503 +				</button>"
   4.504 +			[ "$UPGRADE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.505 +				<button>
   4.506 +					<label>Upgrade</label>
   4.507 +					<input file icon=\"go-next\"></input>
   4.508 +					<action>xterm -T \"Install $PKG\" $XTERM_OPTS -e \"\
   4.509 +					tazpkg get-install $PKG --forced ; sleep 5\"</action>
   4.510 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.511 +				</button>"
   4.512 +			fgrep -q post_install $ROOT/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
   4.513 +				<button>
   4.514 +					<label>Reconfigure</label>
   4.515 +					<input file icon=\"reload\"></input>
   4.516 +					<action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
   4.517 +					tazpkg reconfigure $PACKAGE; sleep 2\"</action>
   4.518 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.519 +				</button>"
   4.520 +			if grep -qs ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
   4.521 +				PACKAGE_INFOS="$PACKAGE_INFOS
   4.522 +				<button>
   4.523 +					<label>Unblock</label>
   4.524 +					<input file icon=\"up\"></input>
   4.525 +					<action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
   4.526 +					tazpkg unblock $PACKAGE; sleep 2\"</action>
   4.527 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.528 +				</button>"
   4.529 +			else
   4.530 +				PACKAGE_INFOS="$PACKAGE_INFOS
   4.531 +				<button>
   4.532 +					<label>Block</label>
   4.533 +					<input file icon=\"down\"></input>
   4.534 +					<action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
   4.535 +					tazpkg block $PACKAGE; sleep 2\"</action>
   4.536 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.537 +				</button>"
   4.538 +			fi
   4.539 +		fi
   4.540 +		if [ "$(cat /tmp/tazpkgbox/status)" = "linkable" ]; then
   4.541 +			PACKAGE_INFOS="$PACKAGE_INFOS
   4.542 +				<button>
   4.543 +					<label>Link</label>
   4.544 +					<input file icon=\"edit-redo\"></input>
   4.545 +					<action>xterm -T \"Link $PACKAGE\" $XTERM_OPTS -e \"\
   4.546 +					tazpkg link $PACKAGE $(readlink /var/lib/tazpkg/fslink); sleep 2\"</action>
   4.547 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.548 +				</button>"
   4.549 +		elif [ ! -s $ROOT/installed/$PKG/modifiers ]; then
   4.550 +			[ -L $ROOT/installed/$PKG ] || PACKAGE_INFOS="$PACKAGE_INFOS
   4.551 +				<button>
   4.552 +					<label>Repack</label>
   4.553 +					<input file icon=\"edit-redo\"></input>
   4.554 +					<action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
   4.555 +					cd /var/cache/tazpkg; \
   4.556 +					tazpkg repack $PACKAGE; sleep 2\"</action>
   4.557 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.558 +				</button>
   4.559 +		"
   4.560 +			PACKAGE_INFOS="$PACKAGE_INFOS
   4.561 +				<button>
   4.562 +					<label>Remove</label>
   4.563 +					<input file icon=\"edit-delete\"></input>
   4.564 +					<action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
   4.565 +					tazpkg remove $PACKAGE; sleep 2\"</action>
   4.566 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.567 +				</button>
   4.568 +		"
   4.569 +		else
   4.570 +			PACKAGE_INFOS="$PACKAGE_INFOS
   4.571 +				<button>
   4.572 +					<label>Re-install</label>
   4.573 +					<input file icon=\"edit-redo\"></input>
   4.574 +					<action>xterm -T \"Re-install $PACKAGE\" $XTERM_OPTS -e \"\
   4.575 +					tazpkg get-install $PACKAGE --forced; sleep 2\"</action>
   4.576 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.577 +				</button>
   4.578 +				<button>
   4.579 +					<label>Remove</label>
   4.580 +					<input file icon=\"edit-delete\"></input>
   4.581 +					<action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
   4.582 +					tazpkg remove $PACKAGE; sleep 2\"</action>
   4.583 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.584 +				</button>
   4.585 +		"
   4.586 +		fi
   4.587 +		PACKAGE_INFOS="$PACKAGE_INFOS
   4.588 +				<button>
   4.589 +					<label>View Files</label>
   4.590 +					<input file icon=\"tazpkg\"></input>
   4.591 +					<action type=\"launch\">LIST_FILES</action>
   4.592 +				</button>
   4.593 +				<button>
   4.594 +					<input file icon=\"gtk-close\"></input>
   4.595 +					<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   4.596 +				</button>
   4.597 +			</hbox>
   4.598 +		
   4.599 +		</vbox>
   4.600 +		</window>
   4.601 +		"
   4.602 +			export PACKAGE_INFOS
   4.603 +		else
   4.604 +			RES=`grep -sh "^$PKG " /var/lib/tazpkg/packages.desc \
   4.605 +				/var/lib/tazpkg/undigest/*/packages.desc`
   4.606 +			PACKAGE=`echo "$RES" | cut -d "|" -f 1`
   4.607 +			VERSION=`echo "$RES" | cut -d "|" -f 2`
   4.608 +			SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
   4.609 +			CATEGORY=`echo "$RES" | cut -d "|" -f 4`
   4.610 +			WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
   4.611 +			SIZES=`grep -sh -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt \
   4.612 +				/var/lib/tazpkg/undigest/*/packages.txt | tail -1`
   4.613 +			DEPENDS=""
   4.614 +			SUGGESTED=""
   4.615 +			MAINTAINER=""
   4.616 +			BUGS=""
   4.617 +			HANDBOOK_URL=""
   4.618 +			TAGS=""
   4.619 +			CONFIG_FILES=""
   4.620 +			height=160
   4.621 +			if [ -s /home/slitaz/wok/$PKG/receipt ]; then
   4.622 +				. /home/slitaz/wok/$PKG/receipt
   4.623 +				height=200
   4.624 +			fi
   4.625 +			PACKAGE_INFOS="
   4.626 +		<window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
   4.627 +		<vbox>
   4.628 +		
   4.629 +			<tree>
   4.630 +				<width>460</width><height>$height</height>
   4.631 +				<label>$PKG|$SHORT_DESC</label>
   4.632 +				<variable>FIELD2</variable>
   4.633 +				<item icon=\"tazpkg\">Version: | $VERSION</item>
   4.634 +				<item icon=\"tazpkg\">Category: | $CATEGORY</item>"
   4.635 +			[ "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.636 +				<item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
   4.637 +			[ "$SUGGESTED" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.638 +				<item icon=\"tazpkg\">Suggested: | $(echo $SUGGESTED)</item>"
   4.639 +			[ "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.640 +				<item icon=\"tazpkg\">Size: | $SIZES</item>"
   4.641 +			[ "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.642 +				<item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
   4.643 +			[ "$BUGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.644 +				<item icon=\"important\">Bugs: | $BUGS</item>"
   4.645 +			[ "$HANDBOOK_URL" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.646 +				<item icon=\"ascii\">Handbook: | $HANDBOOK_URL</item>"
   4.647 +			[ "$TAGS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.648 +				<item icon=\"tazpkg\">Tags: | $TAGS</item>"
   4.649 +			[ "$CONFIG_FILES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.650 +				<item icon=\"tazpkg\">Config files: | $CONFIG_FILES</item>"
   4.651 +			PACKAGE_INFOS="$PACKAGE_INFOS
   4.652 +				<item icon=\"applications-internet\">Website: | $WEB_SITE</item>		
   4.653 +				<item icon=\"text-editor\">Receipt: | double-click to view receipt</item>
   4.654 +				<action>case \$FIELD2 in Web*) browser $WEB_SITE &;; esac</action>
   4.655 +				<action>case \$FIELD2 in Rec*) browser http://hg.slitaz.org/wok/raw-file/tip/$PACKAGE/receipt &;; esac</action>
   4.656 +				
   4.657 +			</tree>
   4.658 +		
   4.659 +			<hbox>"
   4.660 +			[ ${PACKAGE%%-*} = get ] && PACKAGE_INFOS="$PACKAGE_INFOS
   4.661 +				<checkbox>
   4.662 +					<label>Auto exec</label>
   4.663 +					<variable>AUTO_EXEC</variable>
   4.664 +					<default>true</default>
   4.665 +				</checkbox>"
   4.666 +			PACKAGE_INFOS="$PACKAGE_INFOS
   4.667 +				<checkbox>
   4.668 +					<label>Auto install depends</label>
   4.669 +					<variable>AUTO_DEPENDS</variable>
   4.670 +					<default>true</default>
   4.671 +				</checkbox>
   4.672 +				<button>
   4.673 +					<label>Install Package</label>
   4.674 +					<input file icon=\"go-next\"></input>
   4.675 +					<action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
   4.676 +					if [ x\$AUTO_DEPENDS != xtrue ]; then script -c \\\"tazpkg get-install $PACKAGE\\\" /var/log/tazpkg-install.log;\
   4.677 +					else script -c \\\"yes y | tazpkg get-install $PACKAGE\\\" /var/log/tazpkg-install.log; fi; \
   4.678 +					[ x\${AUTO_EXEC} = xtrue ] && $PACKAGE; \
   4.679 +					sleep 2\"</action>
   4.680 +					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   4.681 +				</button>
   4.682 +				<button>
   4.683 +					<label>Download</label>
   4.684 +					<input file icon=\"go-next\"></input>
   4.685 +					<action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
   4.686 +					cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
   4.687 +					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   4.688 +				</button>
   4.689 +				<button>
   4.690 +					<label>View Files</label>
   4.691 +					<input file icon=\"tazpkg\"></input>
   4.692 +					<action type=\"launch\">LIST_FILES_MIRROR</action>
   4.693 +				</button>
   4.694 +				<button>
   4.695 +					<input file icon=\"gtk-close\"></input>
   4.696 +					<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
   4.697 +				</button>
   4.698 +			</hbox>
   4.699 +		
   4.700 +		</vbox>
   4.701 +		</window>
   4.702 +		"
   4.703 +			export PACKAGE_INFOS
   4.704 +		fi
   4.705 +		gtkdialog --center --program=PACKAGE_INFOS ;;
   4.706 +
   4.707 +	*)
   4.708 +		usage $@ ;;
   4.709 +esac
   4.710 +
   4.711 +exit 0
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/oldstuff/tazpkgbox	Mon May 16 19:38:39 2011 +0200
     5.3 @@ -0,0 +1,636 @@
     5.4 +#!/bin/sh
     5.5 +#
     5.6 +# GTKdialog interface to SliTaz Packages Manager aka Tazpkg. Note:
     5.7 +# Notebook tabs are <vbox>. Tabs are used to indent and functions are
     5.8 +# split and found in libtazpkgbox.
     5.9 +#
    5.10 +# (C) GNU gpl v3 - SliTaz GNU/Linux 2010-2011.
    5.11 +#
    5.12 +
    5.13 +# Functions path.
    5.14 +export LIB=/usr/lib/slitaz/libtazpkgbox
    5.15 +
    5.16 +# Tazpkgbox is only for root.
    5.17 +if test $(id -u) != 0 ; then
    5.18 +	exec subox tazpkgbox
    5.19 +	exit 0
    5.20 +fi
    5.21 +
    5.22 +# Include gettext helper script.
    5.23 +. /usr/bin/gettext.sh
    5.24 +
    5.25 +# Export package name for gettext.
    5.26 +TEXTDOMAIN='tazpkgbox'
    5.27 +export TEXTDOMAIN
    5.28 +
    5.29 +# We need at least a mirror URL.
    5.30 +if [ ! -f /var/lib/tazpkg/mirror ]; then
    5.31 +	tazpkg >/dev/null
    5.32 +fi
    5.33 +
    5.34 +RELEASE=$(cat /etc/slitaz-release)
    5.35 +case "$1" in
    5.36 +dliso)
    5.37 +	echo "Downloading packages-$RELEASE.iso into $2..."
    5.38 +	cd $2
    5.39 +	for i in $(cat /var/lib/tazpkg/mirror) ; do
    5.40 +		wget ${i%packages*}/iso/$RELEASE/packages-$RELEASE.iso && break
    5.41 +	done
    5.42 +	exit 0;;
    5.43 +instiso)
    5.44 +	PKGSIGN="LABEL=\"packages-$RELEASE\" TYPE=\"iso9660\""
    5.45 +	PKGDEV=$(blkid $2 | grep "$PKGSIGN" | cut -d: -f1)
    5.46 +	[ -z "$PKGDEV$2" -a -L /dev/cdrom ] && PKGDEV=$(blkid /dev/cdrom | grep "$PKGSIGN" | cut -d: -f1)
    5.47 +	if [ -n "$PKGDEV" ]; then
    5.48 +		mkdir /packages 2> /dev/null
    5.49 +		mount -t iso9660 -o ro $PKGDEV /packages
    5.50 +		/packages/install.sh
    5.51 +	fi
    5.52 +	exit 0;;
    5.53 +esac
    5.54 +# Tmp dir and files used to get pkgs info on the fly. Clean also
    5.55 +# lists and searches for files to load less data and have a faster start.
    5.56 +mkdir -p /tmp/tazpkgbox
    5.57 +echo "all" > /tmp/tazpkgbox/status
    5.58 +echo "all" > /tmp/tazpkgbox/category
    5.59 +echo "all" > /tmp/tazpkgbox/undigest-category
    5.60 +echo "" > /tmp/tazpkgbox/search
    5.61 +
    5.62 +# English/French help dialog.
    5.63 +export HELP='
    5.64 +<window title="Tazpkgbox Help" icon-name="help">
    5.65 +<vbox>
    5.66 +	<text use-markup="true" width-chars="54">
    5.67 +		<label>"
    5.68 +<b>Tazpkgbox - Packages Manager Help</b>"
    5.69 +		</label>
    5.70 +	</text>
    5.71 +
    5.72 +	<frame English>
    5.73 +		<text wrap="false">
    5.74 +			<label>"
    5.75 +Tazpkgbox is a simple and easy to use interface to the SliTaz
    5.76 +package manager - aka Tazpkg. You can install, remove, repack or 
    5.77 +get packages by double-clicking on the package item. A Search 
    5.78 +engine allows you to find and install new applications in a few 
    5.79 +mouse clicks."
    5.80 +			</label>
    5.81 +		</text>
    5.82 +	</frame>
    5.83 +
    5.84 +	<frame Français>
    5.85 +		<text wrap="false">
    5.86 +			<label>"
    5.87 +Tazpkgbox est une interface graphique au gestionnaire de paquet
    5.88 +de Slitaz aka Tazpkg. Simple et facile à utiliser, vous pouvez
    5.89 +installer, télécharger ou supprimer des paquets en double-cliquant
    5.90 +sur sa ligne. La fonction de recherche permet de facilement trouver
    5.91 +et installer des logiciels ou fichiers."
    5.92 +			</label>
    5.93 +		</text>
    5.94 +	</frame>
    5.95 +
    5.96 +	<hbox>
    5.97 +		<button ok>
    5.98 +			<action type="closewindow">HELP</action>
    5.99 +		</button>
   5.100 +	</hbox>
   5.101 +</vbox>
   5.102 +</window>
   5.103 +'
   5.104 +
   5.105 +FILES="$2"
   5.106 +[ "$1" = "list_config" ] || FILES=""
   5.107 +
   5.108 +export SETUP_DVD="
   5.109 +<window title=\"Packages archive\" icon-name=\"media-cdrom\">
   5.110 +<vbox>
   5.111 +	<text use-markup=\"true\" width-chars=\"54\">
   5.112 +		<label>\"
   5.113 +<b>Tazpkgbox - Packages Archive Manager</b>\"
   5.114 +		</label>
   5.115 +	</text>
   5.116 +	<frame English>
   5.117 +		<text wrap=\"false\">
   5.118 +			<label>\"
   5.119 +An ISO image with all $(cat /etc/slitaz-release) packages is available on Slitaz mirrors.
   5.120 +You can burn it onto a DVD or install it on an USB key and each
   5.121 +package becomes installable without an Internet connection.\"
   5.122 +			</label>
   5.123 +		</text>
   5.124 +	</frame>
   5.125 +
   5.126 +	<frame Français>
   5.127 +		<text wrap=\"false\">
   5.128 +			<label>\"
   5.129 +Une image ISO installable sur clé USB ou gravable sur DVD est
   5.130 +disponible sur les mirroirs Slitaz. Elle contient tous les paquets
   5.131 +de la version $(cat /etc/slitaz-release) pour pouvoir installer des paquets sans
   5.132 +connexion Internet.\"
   5.133 +			</label>
   5.134 +		</text>
   5.135 +	</frame>
   5.136 +	<frame>
   5.137 +	<hbox>
   5.138 +		<text use-markup=\"true\">
   5.139 +			<label>\"<b>ISO image : </b>\"</label>
   5.140 +		</text>
   5.141 +		<entry>
   5.142 +			<variable>PKGISO</variable>
   5.143 +		</entry>
   5.144 +		<button>
   5.145 +			<input file stock=\"gtk-open\"></input>
   5.146 +			<action type=\"fileselect\">PKGISO</action>
   5.147 +		</button>
   5.148 +		<button>
   5.149 +			<label>Install ISO</label>
   5.150 +			<input file icon=\"go-jump\"></input>
   5.151 +			<action>xterm -T \"Install ISO\" -geometry 80x16+120+120 -e \"tazpkgbox instiso \$PKGISO; sleep 2\" 2>/dev/null</action>
   5.152 +			<action>refresh:PKG</action>
   5.153 +			<action>refresh:PKG_STATS</action>
   5.154 +			<action>refresh:CACHE_STATS</action>
   5.155 +		</button>
   5.156 +	</hbox>
   5.157 +	</frame>
   5.158 +	<hbox>
   5.159 +		<button>
   5.160 +			<label>Download ISO</label>
   5.161 +			<input file icon=\"system-software-update\"></input>
   5.162 +			<action>xterm -T \"Download ISO\" -geometry 80x16+120+120 -e \"tazpkgbox dliso /tmp; sleep 2\" 2>/dev/null</action>
   5.163 +		</button>
   5.164 +		<button>
   5.165 +			<input file icon=\"media-cdrom\"></input>
   5.166 +			<label>Burn DVD</label>
   5.167 +			<action>burnbox</action>
   5.168 +		</button>
   5.169 +		<button>
   5.170 +			<label>Install DVD/USB key</label>
   5.171 +			<input file icon=\"go-jump\"></input>
   5.172 +			<action>xterm -T \"Install DVD/USB key\" -geometry 80x16+120+120 -e \"tazpkgbox instiso; sleep 2\" 2>/dev/null</action>
   5.173 +			<action>refresh:PKG</action>
   5.174 +			<action>refresh:PKG_STATS</action>
   5.175 +			<action>refresh:CACHE_STATS</action>
   5.176 +		</button>
   5.177 +		<button>
   5.178 +			<input file icon=\"gtk-close\"></input>
   5.179 +			<action type=\"closewindow\">SETUP_DVD</action>
   5.180 +		</button>
   5.181 +	</hbox>
   5.182 +</vbox>
   5.183 +</window>
   5.184 +"
   5.185 +
   5.186 +export LIST_CONFIG_FILES="
   5.187 +<window title=\"configuration files\" icon-name=\"system-file-manager\">
   5.188 +  <vbox>
   5.189 +	<tree exported_column=\"5\">
   5.190 +		<width>560</width><height>160</height>
   5.191 +		<variable>CONF_FILE</variable>
   5.192 +		<label>Access | User | Group | Size | Update Date | Name</label>
   5.193 +		<input>tazpkg list-config --box $FILES</input>
   5.194 +		<action>leafpad \$CONF_FILE</action>
   5.195 +	</tree>
   5.196 +	<hbox>
   5.197 +		<text wrap=\"false\">
   5.198 +			<label>
   5.199 +\"Only files with Update Date have been modified after package installation\"
   5.200 +			</label>
   5.201 +		</text>
   5.202 +		<button>
   5.203 +			<input file icon=\"gtk-close\"></input>
   5.204 +			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
   5.205 +		</button>
   5.206 +	</hbox>
   5.207 +  </vbox>
   5.208 +</window>
   5.209 +"
   5.210 +if [ "$1" = "list_config" ]; then
   5.211 +	gtkdialog --center --program=LIST_CONFIG_FILES >/dev/null
   5.212 +	exit 0
   5.213 +fi
   5.214 +
   5.215 +export SETUP_UNDIGEST='
   5.216 +<window title="undigest mirrors" icon-name="tazpkg">
   5.217 +  <vbox>
   5.218 +	<tree>
   5.219 +		<width>560</width><height>160</height>
   5.220 +		<variable>UNDIGEST_LIST</variable>
   5.221 +		<label>Name | URL</label>
   5.222 +		<input>tazpkg list-undigest --box</input>
   5.223 +		<action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_LIST; sleep 2"</action>
   5.224 +	</tree>
   5.225 +	<hbox>
   5.226 +		<text>
   5.227 +			<label>URL:</label>
   5.228 +		</text>
   5.229 +		<entry>
   5.230 +			<variable>UNDIGEST_URL</variable>
   5.231 +		</entry>
   5.232 +	</hbox>
   5.233 +	<hbox>
   5.234 +		<text>
   5.235 +			<label>Name:</label>
   5.236 +		</text>
   5.237 +		<entry>
   5.238 +			<variable>UNDIGEST_NAME</variable>
   5.239 +		</entry>
   5.240 +		<button>
   5.241 +			<label>Add</label>
   5.242 +			<input file icon="gtk-add"></input>
   5.243 +			<action>tazpkg add-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
   5.244 +			<action>refresh:UNDIGEST_LIST</action>
   5.245 +		</button>
   5.246 +		<button>
   5.247 +			<label>Remove</label>
   5.248 +			<input file icon="gtk-remove"></input>
   5.249 +			<action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_NAME; sleep 2"</action>
   5.250 +			<action>refresh:UNDIGEST_LIST</action>
   5.251 +		</button>
   5.252 +		<button>
   5.253 +			<label>Update</label>
   5.254 +			<input file icon="reload"></input>
   5.255 +			<action>tazpkg setup-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
   5.256 +			<action>refresh:UNDIGEST_LIST</action>
   5.257 +		</button>
   5.258 +		<button>
   5.259 +			<input file icon="gtk-close"></input>
   5.260 +			<action type="closewindow">SETUP_UNDIGEST</action>
   5.261 +		</button>
   5.262 +	</hbox>
   5.263 +  </vbox>
   5.264 +</window>
   5.265 +'
   5.266 +
   5.267 +# Scan notification
   5.268 +desktopbox notify "Scanning packages database" 6 &
   5.269 +
   5.270 +# Main dialog
   5.271 +export TAZPKG_DIALOG='
   5.272 +<window title="SliTaz Packages Manager" icon-name="package-x-generic">
   5.273 +<vbox>
   5.274 +
   5.275 +	<hbox>
   5.276 +		<text use-markup="true">
   5.277 +			<label>"<b>Packages Manager</b>"</label>
   5.278 +		</text>
   5.279 +		<pixmap>
   5.280 +			<input file>/usr/share/pixmaps/tazpkg.png</input>
   5.281 +		</pixmap>
   5.282 +	</hbox>
   5.283 +
   5.284 +	<notebook labels="Packages|Search|Undigest|Configuration">
   5.285 +
   5.286 +	<vbox>
   5.287 +		<tree>
   5.288 +			<width>620</width><height>240</height>
   5.289 +			<variable>PKG</variable>
   5.290 +			<label>Name|Version|Description</label>
   5.291 +			<input icon_column="0">$LIB list-all</input>
   5.292 +			<action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
   5.293 +			<action>$LIB package-infos</action>
   5.294 +			<action>refresh:PKG</action>
   5.295 +			<action>refresh:PKG_STATS</action>
   5.296 +			<action>refresh:CACHE_STATS</action>
   5.297 +		</tree>
   5.298 +		<hbox>
   5.299 +			<text>
   5.300 +				<label>"Status:"</label>
   5.301 +			</text>
   5.302 +			<combobox>
   5.303 +				<variable>STATUS</variable>
   5.304 +				<item>all</item>
   5.305 +				<item>installed</item>
   5.306 +				<item>installable</item>
   5.307 +				<item>blocked</item>
   5.308 +				<item>upgradeable</item>
   5.309 +				<item>linkable</item>
   5.310 +			</combobox>
   5.311 +			<text>
   5.312 +				<label>"Category:"</label>
   5.313 +			</text>
   5.314 +			<combobox>
   5.315 +				<variable>CAT</variable>
   5.316 +				<item>all</item>
   5.317 +				<item>base-system</item>
   5.318 +				<item>x-window</item>
   5.319 +				<item>utilities</item>
   5.320 +				<item>network</item>
   5.321 +				<item>graphics</item>
   5.322 +				<item>multimedia</item>
   5.323 +				<item>office</item>
   5.324 +				<item>development</item>
   5.325 +				<item>system-tools</item>
   5.326 +				<item>security</item>
   5.327 +				<item>games</item>
   5.328 +				<item>misc</item>
   5.329 +				<item>meta</item>
   5.330 +				<item>non-free</item>
   5.331 +			</combobox>
   5.332 +			<button>
   5.333 +				<label>List Packages</label>
   5.334 +				<input file icon="reload"></input>
   5.335 +				<action>echo "$CAT" > /tmp/tazpkgbox/category</action>
   5.336 +				<action>echo "$STATUS" > /tmp/tazpkgbox/status</action>
   5.337 +				<action>refresh:PKG</action>
   5.338 +			</button>
   5.339 +		</hbox>
   5.340 +	</vbox>
   5.341 +
   5.342 +	<vbox>
   5.343 +		<tree>
   5.344 +			<width>620</width><height>120</height>
   5.345 +			<variable>RESULT</variable>
   5.346 +			<label>Packages Name|Version|Description / File</label>
   5.347 +			<input icon_column="0">cat /tmp/tazpkgbox/search</input>
   5.348 +			<action>echo "$RESULT" > /tmp/tazpkgbox/pkg</action>
   5.349 +			<action>$LIB package-infos</action>
   5.350 +			<action>$LIB search-packages</action>
   5.351 +			<action>refresh:RESULT</action>
   5.352 +			<action>refresh:PKG</action>
   5.353 +			<action>refresh:PKG_STATS</action>
   5.354 +			<action>refresh:CACHE_STATS</action>
   5.355 +		</tree>
   5.356 +		<hbox>
   5.357 +			<text>
   5.358 +				<label>" Search: "</label>
   5.359 +			</text>
   5.360 +			<entry activates-default="true">
   5.361 +				<variable>SEARCH</variable>
   5.362 +			</entry>
   5.363 +			<button can-default="true" has-default="true">
   5.364 +				<label>Packages/Description</label>
   5.365 +				<input file icon="system-search"></input>
   5.366 +				<action>$LIB search-packages</action>
   5.367 +				<action>refresh:RESULT</action>
   5.368 +			</button>
   5.369 +			<button>
   5.370 +				<label>Files</label>
   5.371 +				<input file icon="system-search"></input>
   5.372 +				<action>$LIB search-files</action>
   5.373 +				<action>refresh:RESULT</action>
   5.374 +			</button>
   5.375 +'
   5.376 +tmp='
   5.377 +			<button>
   5.378 +				<label>Tags</label>
   5.379 +				<input file icon="system-search"></input>
   5.380 +				<action>$LIB search-tags</action>
   5.381 +				<action>refresh:RESULT</action>
   5.382 +			</button>
   5.383 +'
   5.384 +[ -d /home/slitaz/wok ] && TAZPKG_DIALOG="$TAZPKG_DIALOG $tmp"
   5.385 +tmp='
   5.386 +		</hbox>
   5.387 +	</vbox>
   5.388 +
   5.389 +	<vbox>
   5.390 +		<tree>
   5.391 +			<width>620</width><height>240</height>
   5.392 +			<variable>DEV</variable>
   5.393 +			<label>Name|Version|Description</label>
   5.394 +			<input icon_column="0">$LIB list-undigest</input>
   5.395 +			<action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
   5.396 +			<action>$LIB package-infos</action>
   5.397 +			<action>refresh:PKG</action>
   5.398 +			<action>refresh:PKG_STATS</action>
   5.399 +			<action>refresh:CACHE_STATS</action>
   5.400 +		</tree>
   5.401 +		
   5.402 +		<hbox>
   5.403 +			
   5.404 +			<button>
   5.405 +				<label>Setup/Add undigest mirrors</label>
   5.406 +				<input file icon="go-next"></input>
   5.407 +				<action type="launch">SETUP_UNDIGEST</action>
   5.408 +			</button>
   5.409 +		</hbox>
   5.410 +		<frame List packages on undigest (unofficial or private) mirrors>
   5.411 +			<hbox> 
   5.412 +				<text>
   5.413 +					<label>"Undigest:"</label>
   5.414 +				</text>
   5.415 +				<combobox>
   5.416 +					<variable>UNDIGEST_ENTRY</variable>
   5.417 +'
   5.418 +TAZPKG_DIALOG="$TAZPKG_DIALOG $tmp"
   5.419 +for i in all $(ls /var/lib/tazpkg/undigest 2> /dev/null); do
   5.420 +	TAZPKG_DIALOG="$TAZPKG_DIALOG <item>$i</item> "
   5.421 +done
   5.422 +tmp='			</combobox>		
   5.423 +            			
   5.424 +				<text>
   5.425 +					<label>"Status:"</label>
   5.426 +				</text>
   5.427 +				<combobox>
   5.428 +					<variable>UNDIGEST_STATUS</variable>
   5.429 +					<item>all</item>
   5.430 +					<item>installed</item>
   5.431 +					<item>installable</item>
   5.432 +					<item>blocked</item>
   5.433 +					<item>upgradeable</item>
   5.434 +				</combobox>
   5.435 +			</hbox>
   5.436 +			<hbox>	
   5.437 +				<text>
   5.438 +					<label>"Category:"</label>
   5.439 +				</text>
   5.440 +				<combobox>
   5.441 +					<variable>UNDIGEST_CAT</variable>
   5.442 +					<item>all</item>
   5.443 +					<item>base-system</item>
   5.444 +					<item>x-window</item>
   5.445 +					<item>utilities</item>
   5.446 +					<item>network</item>
   5.447 +					<item>graphics</item>
   5.448 +					<item>multimedia</item>
   5.449 +					<item>office</item>
   5.450 +					<item>development</item>
   5.451 +					<item>system-tools</item>
   5.452 +					<item>security</item>
   5.453 +					<item>games</item>
   5.454 +					<item>misc</item>
   5.455 +					<item>meta</item>
   5.456 +					<item>non-free</item>
   5.457 +				</combobox>
   5.458 +				<text>
   5.459 +					<label>"          "</label>
   5.460 +				</text>
   5.461 +				<button>
   5.462 +					<label>"      List Packages            "</label>
   5.463 +					<input file icon="reload"></input>
   5.464 +					<action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY $UNDIGEST_STATUS" > /tmp/tazpkgbox/undigest-category</action>
   5.465 +					<action>refresh:DEV</action>
   5.466 +				</button>
   5.467 +				</hbox>	
   5.468 +		</frame>		
   5.469 +			
   5.470 +	</vbox>
   5.471 +
   5.472 +	<vbox>
   5.473 +		<frame Files and Cache directory>
   5.474 +			<text use-markup="true" width-chars="60" wrap="false">
   5.475 +				<label>"
   5.476 +Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>
   5.477 +The cache directory is used to store downloaded or repacked packages.
   5.478 +				"</label>
   5.479 +			</text>
   5.480 +			<hbox>
   5.481 +				<entry editable="false">
   5.482 +					<input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
   5.483 +					<variable>CACHE_STATS</variable>
   5.484 +				</entry>
   5.485 +				<button>
   5.486 +					<label>Clean cache</label>
   5.487 +					<input file icon="go-next"></input>
   5.488 +					<action>rm -rf /var/cache/tazpkg/*</action>
   5.489 +					<action>refresh:CACHE_STATS</action>
   5.490 +				</button>
   5.491 +			</hbox>
   5.492 +		</frame>
   5.493 +		<frame Filesystem link (to install packages as a soft link from another mounted Slitaz)>
   5.494 +			<hbox>
   5.495 +				<entry>
   5.496 +					<input>readlink /var/lib/tazpkg/fslink</input>
   5.497 +					<variable>FSLINK</variable>
   5.498 +				</entry>
   5.499 +				<button>
   5.500 +					<label>Setup</label>
   5.501 +					<input file icon="go-next"></input>
   5.502 +					<action>rm -f /var/lib/tazpkg/fslink ; [ "$FSLINK" != "/" -a -d $FSLINK/var/lib/tazpkg ] && ln -s $FSLINK /var/lib/tazpkg/fslink</action>
   5.503 +					<action>clear:FSLINK</action>
   5.504 +					<action>refresh:FSLINK</action>
   5.505 +				</button>
   5.506 +				<button>
   5.507 +					<label>Mountbox</label>
   5.508 +					<input file icon="media-flash"></input>
   5.509 +					<action>mountbox</action>
   5.510 +				</button>
   5.511 +			</hbox>
   5.512 +		</frame>
   5.513 +		<hbox>
   5.514 +		<frame Mirror URL>
   5.515 +			<hbox>
   5.516 +				<entry>
   5.517 +					<input>head -n 1 /var/lib/tazpkg/mirror</input>
   5.518 +					<variable>MIRROR</variable>
   5.519 +				</entry>
   5.520 +				<button>
   5.521 +					<label>Setup</label>
   5.522 +					<input file icon="go-next"></input>
   5.523 +					<action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
   5.524 +					<action>clear:MIRROR</action>
   5.525 +					<action>refresh:MIRROR</action>
   5.526 +				</button>
   5.527 +				<button>
   5.528 +					<label>Add</label>
   5.529 +					<input file icon="gtk-add"></input>
   5.530 +					<action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
   5.531 +					<action>clear:MIRROR</action>
   5.532 +					<action>refresh:MIRROR</action>
   5.533 +				</button>
   5.534 +			</hbox>
   5.535 +		</frame>
   5.536 +		<frame Mirror Packages>
   5.537 +				<hbox>	
   5.538 +				<button>
   5.539 +					<input file icon="media-cdrom"></input>
   5.540 +					<label>DVD Box</label>
   5.541 +					<action type="launch">SETUP_DVD</action>
   5.542 +				</button>
   5.543 +				</hbox>
   5.544 +		</frame>
   5.545 +		</hbox>
   5.546 +		<hbox>
   5.547 +			<frame Install Logs>
   5.548 +				<hbox>
   5.549 +				<button>
   5.550 +					<label>View Logs</label>
   5.551 +					<input file icon="find"></input>
   5.552 +					<action>xterm -fa MiscFixed -fs 11 -T "$(ls -l /var/log/tazpkg.log | while read mod links user grep remain ; do echo $remain ; done) (q to quit)" -geometry 80x25+120+120 -e "cat /var/log/tazpkg.log | less"</action>
   5.553 +				</button>
   5.554 +				</hbox>
   5.555 +			</frame>
   5.556 +			<frame Configuration files>
   5.557 +				<hbox>
   5.558 +				<button>
   5.559 +					<label>Repack config</label>
   5.560 +					<input file icon="edit-redo"></input>
   5.561 +					<action>xterm -fa MiscFixed -fs 11 -T "Repack configs" -geometry 80x25+120+120 -e "tazpkg repack-config ; sleep 5" 2> /dev/null</action>
   5.562 +				</button>
   5.563 +				<button>
   5.564 +					<label>View Files</label>
   5.565 +					<input file icon="tazpkg"></input>
   5.566 +					<action type="launch">LIST_CONFIG_FILES</action>
   5.567 +				</button>
   5.568 +				</hbox>
   5.569 +			</frame>
   5.570 +			<frame Packages check>
   5.571 +			<hbox>
   5.572 +				<button>
   5.573 +					<label>Quick check</label>
   5.574 +					<input file icon="system-search"></input>
   5.575 +					<action>xterm -fa MiscFixed -fs 11 -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check | less " 2> /dev/null</action>
   5.576 +				</button>
   5.577 +				<button>
   5.578 +					<label>Full check</label>
   5.579 +					<input file icon="system-search"></input>
   5.580 +					<action>xterm -fa MiscFixed -fs 11 -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check --full | less " 2> /dev/null</action>
   5.581 +				</button>
   5.582 +				</hbox>
   5.583 +			</frame>
   5.584 +		</hbox>