#! /bin/sh

. /lib/libtaz.sh
. /etc/slitaz/slitaz.conf

	#$(for p in $(tazpkg -l | cut -d ' ' -f1 | sed 's/[^a-z|-]//g');

DIALOG=dialog
exec 3>&1
#a=	grep -Ev 'h|='		--item-help \

#(/var/lib/tazpkg/packages.desc)
aa=$($DIALOG \
	--separate-output \
	--item-help \
	--backtitle "tazpkg -r" \
	--title "" "$@" \
	--checklist "" 30 61 111 \
	$(for p in $(grep -hsA 3 libQt /var/lib/tazpkg/packages.txt | sed 's| |_|g;s|--||' | tr -s '\n' ' '); \
	do echo -e "$p" ; done) 2>&1 1>&3)
#	$(grep -hsA 2 ^$x$ /var/lib/tazpkg/packages.txt); 2>&1 1>&3)
# done) 2>&1 1>&3)
#$(fgrep gtk /var/lib/tazpkg/packages.desc | cut -d'|' -f1 | sed 's/ //g' | \
#while read x; do \
#	VERSION=123123 \
#	echo "$x" "zzz" "off" ; \
#	_ $(grep -hsA 2 ^$x$ /var/lib/tazpkg/packages.txt); done) 2>&1 1>&3)
	
#	echo -e "aaaaaa" ; done) 2>&1 1>&3)
#	echo -e $(fgrep aa /var/lib/tazpkg/packages.desc | cut -d'|' -f2 | sed 's/ //g'); done) 2>&1 1>&3)
# \
#	echo -e "i" "off"; done) 2>&1 1>&3)

#	echo $x | cut -d'|' -f1 | cut -d'-' -f2 | sed 's/ //g' ; \
#	echo $x | cut -d'|' -f3 | cut -d' ' -f2 | sed 's/ /._./g'; \
 

# echo -e $x;  'ds' 'off'; done)		# $(for p in $(ls $INSTALLED); \
#		do echo "$p"; \
#		. $INSTALLED/$p/receipt \ 
#		echo -e "$VERSION"; \
#		echo -e "off"; \
#	done) \

#	2>&1 1>&3)

#echo -e "$SHORT_DESC" | sed 's/ /__/g' ; \

retval=$?

echo $aa
#
[ retval = 0 ] || \
for r in $(echo $aa | sed 's/"//g');
	do echo y | tazpkg -r $r
done	

##| grep VERSION )  | sed 's/[^0-9]//g') \
