tazpkg annotate lib/tazpkgbox/list @ rev 81

Add Tazpkgbox libraries
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 09 17:26:15 2008 +0200 (2008-05-09)
parents
children 3ad89c4852fb
rev   line source
pankso@81 1 #!/bin/sh
pankso@81 2 #
pankso@81 3 # List installed packages in a suitable format for GTK tree.
pankso@81 4 # List mirrored packages using the packages.desc file.
pankso@81 5 #
pankso@81 6
pankso@81 7 case $1 in
pankso@81 8 installed)
pankso@81 9 CAT=`cat /tmp/tazpkgbox/installed-category`
pankso@81 10 if [ "$CAT" == "all" ]; then
pankso@81 11 for pkg in /var/lib/tazpkg/installed/*
pankso@81 12 do
pankso@81 13 . $pkg/receipt
pankso@81 14 echo "$PACKAGE|$VERSION|$SHORT_DESC"
pankso@81 15 done
pankso@81 16 else
pankso@81 17 for pkg in /var/lib/tazpkg/installed/*
pankso@81 18 do
pankso@81 19 . $pkg/receipt
pankso@81 20 if [ "$CATEGORY" == "$CAT" ]; then
pankso@81 21 echo "$PACKAGE|$VERSION|$SHORT_DESC"
pankso@81 22 fi
pankso@81 23 done
pankso@81 24 fi ;;
pankso@81 25 mirrored)
pankso@81 26 CAT=`cat /tmp/tazpkgbox/mirrored-category`
pankso@81 27 if [ "$CAT" == "all" ]; then
pankso@81 28 cat /var/lib/tazpkg/packages.desc
pankso@81 29 else
pankso@81 30 grep "$CAT" /var/lib/tazpkg/packages.desc
pankso@81 31 #for pkg in `grep "$CAT" /var/lib/tazpkg/packages.desc | cut -d "|" -f 1`
pankso@81 32 #do
pankso@81 33 #RES=`grep "^$pkg" /var/lib/tazpkg/packages.desc | head -n 1`
pankso@81 34 #CATEGORY=`echo "$RES" | cut -d "|" -f 4`
pankso@81 35 ##echo "$pkg|$CATEGORY"
pankso@81 36 #if [ "$CATEGORY" == "$CAT" ]; then
pankso@81 37 #VERSION=`echo $RES | cut -d "|" -f 2`
pankso@81 38 #SHORT_DESC=`echo $RES | cut -d "|" -f 3`
pankso@81 39 #echo "$pkg | $VERSION | $SHORT_DESC"
pankso@81 40 #fi
pankso@81 41 #done
pankso@81 42 fi ;;
pankso@81 43 *)
pankso@81 44 echo "Usage: /usr/lib/slitaz/tazpkgbox/list [installed|mirrored]" ;;
pankso@81 45 esac
pankso@81 46
pankso@81 47 exit 0