tazpkg view lib/tazpkgbox/list @ rev 189
Add undigest support for tazpkgbox/search
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Oct 28 12:32:30 2008 +0000 (2008-10-28) |
parents | a0d51bc28e4e |
children | 9720c1c3d4f5 |
line source
1 #!/bin/sh
2 #
3 # List installed packages in a suitable format for GTK tree.
4 # List mirrored packages using the packages.desc file.
5 #
7 undigest_list()
8 {
9 IFS="|"
10 if [ -n "$1" ]; then
11 cat /var/lib/tazpkg/undigest/$1/packages.desc
12 else
13 cat /var/lib/tazpkg/undigest/*/packages.desc
14 fi 2> /dev/null | sort | while read PACKAGE VERSION SHORT_DESC; do
15 echo "$PACKAGE|$VERSION|$SHORT_DESC"
16 done
17 unset IFS
18 }
20 installable_list()
21 {
22 IFS="|"
23 cat /var/lib/tazpkg/packages.desc \
24 /var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | sort | \
25 while read PACKAGE VERSION SHORT_DESC; do
26 [ -d /var/lib/tazpkg/installed/${PACKAGE%% *} ] && continue
27 echo "$PACKAGE|$VERSION|$SHORT_DESC"
28 done
29 unset IFS
30 }
32 installed_list()
33 {
34 for pkg in /var/lib/tazpkg/installed/*
35 do
36 . $pkg/receipt
37 if [ "$CAT" == "all" -o "$CATEGORY" == "$CAT" ]; then
38 echo "$PACKAGE|$VERSION|$SHORT_DESC"
39 fi
40 done
41 }
43 blocked_list()
44 {
45 for pkg in /var/lib/tazpkg/installed/*
46 do
47 . $pkg/receipt
48 if grep -qs "^$(basename $pkg)$" /var/lib/tazpkg/blocked-packages.list; then
49 AVAILABLE=$(grep "^$(basename $pkg) " /var/lib/tazpkg/packages.desc | awk '{ print $3 }')
51 echo "$PACKAGE|$VERSION|$AVAILABLE|$SHORT_DESC"
52 fi
53 done
54 }
56 case $1 in
57 installed)
58 CAT=`cat /tmp/tazpkgbox/installed-category`
59 installed_list $CAT;;
60 installable)
61 CAT=`cat /tmp/tazpkgbox/installable-category`
62 if [ "$CAT" == "all" ]; then
63 installable_list
64 else
65 installable_list | grep "$CAT"
66 fi ;;
67 undigest)
68 set -- `cat /tmp/tazpkgbox/undigest-category`
69 if [ "$1" == "all" -o "$1" == "" ]; then
70 undigest_list $2
71 else
72 undigest_list $2 | grep "$1"
73 fi ;;
74 mirrored)
75 CAT=`cat /tmp/tazpkgbox/mirrored-category`
76 if [ "$CAT" == "all" ]; then
77 cat /var/lib/tazpkg/packages.desc
78 else
79 grep "$CAT" /var/lib/tazpkg/packages.desc
80 fi ;;
81 blocked)
82 blocked_list;;
83 *)
84 echo "Usage: /usr/lib/slitaz/tazpkgbox/list [installed|installable|mirrored|undigest|blocked]" ;;
85 esac
87 exit 0