tazpkg view lib/tazpkgbox/package_infos @ rev 99

tazpkgbox: add list of files for mirror packages
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 22 19:08:09 2008 +0000 (2008-05-22)
parents be31f9fb294a
children 3ad89c4852fb
line source
1 #!/bin/sh
2 #
3 # Dialog box to provide package infos and actions
4 #
6 XTERM_OPTS="-geometry 80x16+120+120"
8 PKG=`cat /tmp/tazpkgbox/pkg | sed s/" "/""/g`
10 if [ "$1" = "list_files" ]; then
11 tazpkg list-files $2 | awk '
12 BEGIN { ls=0 } {
13 if (/^===/) ls=1-ls;
14 else if (ls) system("stat -c \"%A|%U|%G|%s|%n\" " $0);
15 }'
16 exit 0
17 fi
19 if [ "$1" = "list_files_mirror" ]; then
20 unlzma -c /var/lib/tazpkg/files.list.lzma | grep -- "^$2:" | \
21 awk '{ print substr($0,index($0,":")+2) }'
22 exit 0
23 fi
25 export LIST_FILES="
26 <window title=\"$PKG files\" icon-name=\"system-file-manager\">
27 <vbox>
28 <tree>
29 <width>600</width><height>160</height>
30 <label>Access | User | Group | Size | Name</label>
31 <input> $0 list_files $PKG </input>
32 </tree>
33 <hbox>
34 <button>
35 <input file icon=\"gtk-close\"></input>
36 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
37 </button>
38 </hbox>
39 </vbox>
40 </window>
41 "
43 export LIST_FILES_MIRROR="
44 <window title=\"$PKG files\" icon-name=\"system-file-manager\">
45 <vbox>
46 <tree>
47 <width>300</width><height>160</height>
48 <label>File Name</label>
49 <input> $0 list_files_mirror $PKG </input>
50 </tree>
51 <hbox>
52 <button>
53 <input file icon=\"gtk-close\"></input>
54 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
55 </button>
56 </hbox>
57 </vbox>
58 </window>
59 "
61 # Installed or not installed, that the question.
62 if [ -d /var/lib/tazpkg/installed/$PKG ]; then
63 PACKED_SIZE=""
64 DEPENDS=""
65 . /var/lib/tazpkg/installed/$PKG/receipt
66 PACKAGE_INFOS="
67 <window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
68 <vbox>
70 <tree>
71 <width>460</width><height>160</height>
72 <label>Package|$PKG</label>
73 <item icon=\"tazpkg\">Version: | $VERSION</item>
74 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
75 [ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
76 <item icon=\"tazpkg\">Depends: | $DEPENDS</item>"
77 [ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
78 <item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
79 PACKAGE_INFOS="$PACKAGE_INFOS
80 <item icon=\"system-users\">Maintainer: | $MAINTAINER</item>
81 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
82 </tree>
84 <hbox>"
85 grep -q post_install /var/lib/tazpkg/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
86 <button>
87 <label>Reconfigure</label>
88 <input file icon=\"reload\"></input>
89 <action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
90 tazpkg reconfigure $PACKAGE; sleep 2\"</action>
91 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
92 </button>"
93 if grep -q ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
94 PACKAGE_INFOS="$PACKAGE_INFOS
95 <button>
96 <label>Unblock</label>
97 <input file icon=\"up\"></input>
98 <action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
99 tazpkg unblock $PACKAGE; sleep 2\"</action>
100 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
101 </button>"
102 else
103 PACKAGE_INFOS="$PACKAGE_INFOS
104 <button>
105 <label>Block</label>
106 <input file icon=\"down\"></input>
107 <action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
108 tazpkg block $PACKAGE; sleep 2\"</action>
109 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
110 </button>"
111 fi
112 PACKAGE_INFOS="$PACKAGE_INFOS
113 <button>
114 <label>Remove</label>
115 <input file icon=\"edit-delete\"></input>
116 <action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
117 tazpkg remove $PACKAGE; sleep 2\"</action>
118 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
119 </button>
120 <button>
121 <label>Repack</label>
122 <input file icon=\"edit-redo\"></input>
123 <action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
124 cd /var/cache/tazpkg; \
125 tazpkg repack $PACKAGE; sleep 2\"</action>
126 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
127 </button>
128 <button>
129 <label>Files</label>
130 <input file icon=\"tazpkg\"></input>
131 <action type=\"launch\">LIST_FILES</action>
132 </button>
133 <button>
134 <input file icon=\"gtk-close\"></input>
135 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
136 </button>
137 </hbox>
139 </vbox>
140 </window>
141 "
142 export PACKAGE_INFOS
143 else
144 RES=`grep "^$PKG" /var/lib/tazpkg/packages.desc | head -n 1`
145 PACKAGE=`echo "$RES" | cut -d "|" -f 1`
146 VERSION=`echo "$RES" | cut -d "|" -f 2`
147 CATEGORY=`echo "$RES" | cut -d "|" -f 4`
148 WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
149 SIZES=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1`
150 PACKAGE_INFOS="
151 <window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
152 <vbox>
154 <tree>
155 <width>460</width><height>140</height>
156 <label>Package|$PKG</label>
157 <item icon=\"tazpkg\">Name: | $PACKAGE</item>
158 <item icon=\"tazpkg\">Version: | $VERSION</item>
159 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
160 [ -n "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
161 <item icon=\"tazpkg\">Size: | $SIZES</item>"
162 PACKAGE_INFOS="$PACKAGE_INFOS
163 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
164 </tree>
166 <hbox>
167 <button>
168 <label>Get-install</label>
169 <input file icon=\"go-next\"></input>
170 <action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
171 tazpkg get-install $PACKAGE; sleep 2\"</action>
172 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
173 </button>
174 <button>
175 <label>Get</label>
176 <input file icon=\"go-next\"></input>
177 <action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
178 cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
179 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
180 </button>
181 <button>
182 <label>Files</label>
183 <input file icon=\"tazpkg\"></input>
184 <action type=\"launch\">LIST_FILES_MIRROR</action>
185 </button>
186 <button>
187 <input file icon=\"gtk-close\"></input>
188 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
189 </button>
190 </hbox>
192 </vbox>
193 </window>
194 "
195 export PACKAGE_INFOS
196 fi
198 gtkdialog --center --program=PACKAGE_INFOS
200 exit 0