. /lib/libtaz.sh
. /etc/slitaz/slitaz.conf
list_sorted(){
    for p in $(ls $INSTALLED); do newline
	. $INSTALLED/$p/receipt ; echo -n "$p"; \
	echo -n "|:$UNPACKED_SIZE---$PACKED_SIZE"; \
	echo -n "|off" ; echo -n "|$VERSION" ; \
    done | sort -r -n -t: -k2.1  | grep "$1---"
}
mb=`list_sorted M`
kb=`list_sorted K`
exec 3>&1
aa=$(dialog \
    --title "tazpkg remove"  \
    --item-help \
    --checklist "" 30 61 111 $(\
    echo -e "$mb" | sed 's#|# #g;s/://' ; \
    echo -e "$kb" | sed 's#|# #g;s/://') \
2>&1 1>&3)
retval=$?
echo $aa
[ retval = 0 ] || \
for r in $(echo $aa | sed 's/"//g')
do echo y | tazpkg -r $r;done
exit 0

[ retval = 0 ] || \
for r in $(echo $aa | sed 's/"//g');do
    exec 3>&1
    aa=$(dialog \
	--backtitle "tazpkg -lf" \
	--title "a" "$@" \
	--menu "" 30 61 111 \
	$(du `tazpkg -lf $r | grep '^/'` | sort -nr) \
	2>&1 1>&3)
    retval=$?
    echo $aa
done

exit 0
$(for p in $(ls $INSTALLED | sort -n ); \
    do echo "$p"; \
    . $INSTALLED/$p/receipt ; \
    echo -e "$UNPACKED_SIZE---$PACKED_SIZE"; \
    echo -e "off" ; \
    echo -e "$VERSION" ; \
done)
