tazpkg view tazpkgbox @ rev 178

tazpkgbox: add blocked tab
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Oct 24 08:27:54 2008 +0000 (2008-10-24)
parents 2bf43ed75a02
children 974fdbd190db
line source
1 #!/bin/sh
2 #
3 # GTKdialog interface to SliTaz Packages Manager aka Tazpkg. Functions
4 # path: /usr/lib/slitaz/tazpkgbox. Notes: Notebook tab are vbox, tab are
5 # used to indent.
6 #
7 # (C) GNU gpl v3 - SliTaz GNU/Linux 2008.
8 #
9 VERSION=2.3
11 # Tazpkgbox is only for root.
12 if test $(id -u) != 0 ; then
13 exec subox tazpkgbox
14 exit 0
15 fi
17 # We need at least a mirror URL.
18 if [ ! -f /var/lib/tazpkg/mirror ]; then
19 tazpkg >/dev/null
20 fi
22 # Tmp dir and files used to get pkgs infos on the fly. Clean also
23 # list and search files to load less data and have a faster start.
24 mkdir -p /tmp/tazpkgbox
25 echo "all" > /tmp/tazpkgbox/installed-category
26 echo "all" > /tmp/tazpkgbox/installable-category
27 echo "all" > /tmp/tazpkgbox/mirrored-category
28 echo "" > /tmp/tazpkgbox/search-installed
29 echo "" > /tmp/tazpkgbox/search-mirrored
31 # English/French help dialod.
32 export HELP='
33 <window title="Tazpkgbox Help" icon-name="help">
34 <vbox>
35 <text use-markup="true" width-chars="54">
36 <label>"
37 <b>Tazpkgbox - Packages Manager Help</b>"
38 </label>
39 </text>
41 <frame English>
42 <text wrap="false">
43 <label>"
44 Tazpkgbox is a simple and easy to use interface to the SliTaz
45 package manager - aka Tazpkg. You can install, remove, repack or
46 get packages by double-clicking on the package item. A Search engine
47 lets you find and install new applications in a few mouse clicks.
49 Downloaded and repacked packages are stored in: /var/cache/tazpkg"
50 </label>
51 </text>
52 </frame>
54 <frame Français>
55 <text wrap="false">
56 <label>"
57 Tazpkgbox est une interface graphique au gestionnaire de paquet
58 de Slitaz aka Tazpkg. Simple et facile à utiliser, vous pouvez
59 installer, télécharger ou supprimer des paquet en double-cliquant
60 sur sa ligne. Les paquets téléchargés ou recréés sont stocké
61 dans: /var/cache/tazpkg"
62 </label>
63 </text>
64 </frame>
66 <hbox>
67 <button ok>
68 <action type="closewindow">HELP</action>
69 </button>
70 </hbox>
71 </vbox>
72 </window>
73 '
75 export LIST_CONFIG_FILES='
76 <window title="configuration files" icon-name="system-file-manager">
77 <vbox>
78 <tree exported_column="5">
79 <width>560</width><height>160</height>
80 <variable>CONF_FILE</variable>
81 <label>Access | User | Group | Size | Update Date | Name</label>
82 <input>tazpkg list-config --box</input>
83 <action>leafpad $CONF_FILE</action>
84 </tree>
85 <hbox>
86 <text wrap="false">
87 <label>
88 "Only files with Update Date have been modified after package installation"
89 </label>
90 </text>
91 <button>
92 <input file icon="gtk-close"></input>
93 <action type="closewindow">INSTALLED_PACKAGE_ACTIONS</action>
94 </button>
95 </hbox>
96 </vbox>
97 </window>
98 '
100 # Main dialog
101 export TAZPKG_DIALOG='
102 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
103 <vbox>
105 <hbox>
106 <text use-markup="true">
107 <label>"<b>Packages Manager</b>"</label>
108 </text>
109 <pixmap>
110 <input file>/usr/share/pixmaps/tazpkg.png</input>
111 </pixmap>
112 </hbox>
114 <notebook labels="Installed|Installable|Mirrored|Blocked|Search|Configuration">
116 <vbox>
117 <tree>
118 <width>620</width><height>240</height>
119 <variable>PKG</variable>
120 <label>Package name|Version|Description</label>
121 <input>/usr/lib/slitaz/tazpkgbox/list installed</input>
122 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
123 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
124 <action>refresh:PKG</action>
125 <action>refresh:PKG_STATS</action>
126 <action>refresh:CACHE_STATS</action>
127 </tree>
128 <hbox>
129 <text>
130 <label>"Category:"</label>
131 </text>
132 <combobox>
133 <variable>INSTALLED_CAT</variable>
134 <item>all</item>
135 <item>base-system</item>
136 <item>x-window</item>
137 <item>utilities</item>
138 <item>network</item>
139 <item>graphics</item>
140 <item>multimedia</item>
141 <item>office</item>
142 <item>development</item>
143 <item>system-tools</item>
144 <item>security</item>
145 <item>games</item>
146 <item>misc</item>
147 <item>meta</item>
148 <item>non-free</item>
149 </combobox>
150 <button>
151 <label>List</label>
152 <input file icon="reload"></input>
153 <action>echo "$INSTALLED_CAT" > /tmp/tazpkgbox/installed-category</action>
154 <action>refresh:PKG</action>
155 </button>
156 <button>
157 <label>Upgrade all</label>
158 <input file icon="system-software-update"></input>
159 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
160 <action>refresh:PKG</action>
161 <action>refresh:PKG_STATS</action>
162 <action>refresh:CACHE_STATS</action>
163 </button>
164 </hbox>
165 </vbox>
167 <vbox>
168 <tree>
169 <width>620</width><height>240</height>
170 <variable>GETIT</variable>
171 <label>Package name|Version|Description</label>
172 <input>/usr/lib/slitaz/tazpkgbox/list installable</input>
173 <action>echo "$GETIT" > /tmp/tazpkgbox/pkg</action>
174 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
175 <action>refresh:PKG</action>
176 <action>refresh:GETIT</action>
177 <action>refresh:PKG_STATS</action>
178 <action>refresh:CACHE_STATS</action>
179 </tree>
180 <hbox>
181 <text>
182 <label>"Category:"</label>
183 </text>
184 <combobox>
185 <variable>INSTALLABLE_CAT</variable>
186 <item>all</item>
187 <item>base-system</item>
188 <item>x-window</item>
189 <item>utilities</item>
190 <item>network</item>
191 <item>graphics</item>
192 <item>multimedia</item>
193 <item>office</item>
194 <item>development</item>
195 <item>system-tools</item>
196 <item>security</item>
197 <item>games</item>
198 <item>misc</item>
199 <item>meta</item>
200 <item>non-free</item>
201 </combobox>
202 <button>
203 <label>List</label>
204 <input file icon="reload"></input>
205 <action>echo "$INSTALLABLE_CAT" > /tmp/tazpkgbox/installable-category</action>
206 <action>refresh:GETIT</action>
207 </button>
208 <button>
209 <label>Recharge list</label>
210 <input file icon="system-software-update"></input>
211 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
212 <action>refresh:GETIT</action>
213 <action>refresh:PKG_STATS</action>
214 </button>
215 </hbox>
216 </vbox>
218 <vbox>
219 <tree>
220 <width>620</width><height>240</height>
221 <variable>GET</variable>
222 <label>Package name|Version|Description</label>
223 <input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
224 <action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
225 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
226 <action>refresh:PKG</action>
227 <action>refresh:PKG_STATS</action>
228 <action>refresh:CACHE_STATS</action>
229 </tree>
230 <hbox>
231 <text>
232 <label>"Category:"</label>
233 </text>
234 <combobox>
235 <variable>MIRRORED_CAT</variable>
236 <item>all</item>
237 <item>base-system</item>
238 <item>x-window</item>
239 <item>utilities</item>
240 <item>network</item>
241 <item>graphics</item>
242 <item>multimedia</item>
243 <item>office</item>
244 <item>development</item>
245 <item>system-tools</item>
246 <item>security</item>
247 <item>games</item>
248 <item>misc</item>
249 <item>meta</item>
250 <item>non-free</item>
251 </combobox>
252 <button>
253 <label>List</label>
254 <input file icon="reload"></input>
255 <action>echo "$MIRRORED_CAT" > /tmp/tazpkgbox/mirrored-category</action>
256 <action>refresh:GET</action>
257 </button>
258 <button>
259 <label>Recharge list</label>
260 <input file icon="system-software-update"></input>
261 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
262 <action>refresh:GET</action>
263 <action>refresh:PKG_STATS</action>
264 </button>
265 </hbox>
266 </vbox>
268 <vbox>
269 <tree>
270 <width>620</width><height>240</height>
271 <variable>BLOCKED</variable>
272 <label>Package name|Version|Available|Description</label>
273 <input>/usr/lib/slitaz/tazpkgbox/list blocked</input>
274 <action>echo "$BLOCKED" > /tmp/tazpkgbox/pkg</action>
275 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
276 </tree>
277 </vbox>
279 <vbox>
280 <tree icon="tazpkg">
281 <width>620</width><height>120</height>
282 <variable>RESULT_INSTALLED</variable>
283 <label>Installed packages|Version|Description / File</label>
284 <input>cat /tmp/tazpkgbox/search-installed</input>
285 <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
286 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
287 <action>/usr/lib/slitaz/tazpkgbox/search</action>
288 <action>refresh:RESULT_INSTALLED</action>
289 <action>refresh:PKG</action>
290 <action>refresh:PKG_STATS</action>
291 <action>refresh:CACHE_STATS</action>
292 </tree>
293 <tree icon="tazpkg">
294 <width>620</width><height>120</height>
295 <variable>RESULT_MIRROR</variable>
296 <label>Mirrored packages|Version|Description / File</label>
297 <input>cat /tmp/tazpkgbox/search-mirrored</input>
298 <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
299 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
300 <action>/usr/lib/slitaz/tazpkgbox/search</action>
301 <action>refresh:RESULT_INSTALLED</action>
302 <action>refresh:PKG</action>
303 <action>refresh:PKG_STATS</action>
304 <action>refresh:CACHE_STATS</action>
305 </tree>
306 <hbox>
307 <entry>
308 <variable>SEARCH</variable>
309 </entry>
310 <button>
311 <label>Search Packages</label>
312 <input file icon="system-search"></input>
313 <action>/usr/lib/slitaz/tazpkgbox/search</action>
314 <action>refresh:RESULT_INSTALLED</action>
315 <action>refresh:RESULT_MIRROR</action>
316 </button>
317 <button>
318 <label>Search Files</label>
319 <input file icon="system-search"></input>
320 <action>/usr/lib/slitaz/tazpkgbox/search --files</action>
321 <action>refresh:RESULT_INSTALLED</action>
322 <action>refresh:RESULT_MIRROR</action>
323 </button>
324 </hbox>
325 </vbox>
327 <vbox>
328 <frame Cache directory>
329 <text use-markup="true" width-chars="60" wrap="false">
330 <label>
331 "The cache directory is used to store downloaded or repacked packages."
332 </label>
333 </text>
334 <hbox>
335 <entry editable="false">
336 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
337 <variable>CACHE_STATS</variable>
338 </entry>
339 <button>
340 <label>Clean cache</label>
341 <input file icon="go-next"></input>
342 <action>rm -rf /var/cache/tazpkg/*</action>
343 <action>refresh:CACHE_STATS</action>
344 </button>
345 </hbox>
346 </frame>
347 <frame Mirror URL>
348 <hbox>
349 <entry>
350 <input>head -n 1 /var/lib/tazpkg/mirror</input>
351 <variable>MIRROR</variable>
352 </entry>
353 <button>
354 <label>Setup</label>
355 <input file icon="go-next"></input>
356 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
357 <action>clear:MIRROR</action>
358 <action>refresh:MIRROR</action>
359 </button>
360 <button>
361 <label>Add</label>
362 <input file icon="gtk-add"></input>
363 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
364 <action>clear:MIRROR</action>
365 <action>refresh:MIRROR</action>
366 </button>
367 </hbox>
368 </frame>
369 <frame Files path>
370 <hbox>
371 <text use-markup="true" width-chars="60">
372 <label>
373 "Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>"
374 </label>
375 </text>
376 </hbox>
377 </frame>
378 <hbox>
379 <frame Configuration files>
380 <hbox>
381 <button>
382 <label>Repack config</label>
383 <input file icon="edit-redo"></input>
384 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Repack configs" -geometry 80x25+120+120 -e "tazpkg repack-config ; sleep 5" 2> /dev/null</action>
385 </button>
386 <button>
387 <label>Config Files</label>
388 <input file icon="tazpkg"></input>
389 <action type="launch">LIST_CONFIG_FILES</action>
390 </button>
391 </hbox>
392 </frame>
393 <frame Packages check>
394 <hbox>
395 <button>
396 <label>Quick check</label>
397 <input file icon="go-next"></input>
398 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check | less " 2> /dev/null</action>
399 </button>
400 <button>
401 <label>Full check</label>
402 <input file icon="go-next"></input>
403 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check --full | less " 2> /dev/null</action>
404 </button>
405 </hbox>
406 </frame>
407 </hbox>
408 </vbox>
410 </notebook>
412 <hbox>
413 <text wrap="false">
414 <input>installed=`ls /var/lib/tazpkg/installed | wc -l`; mirrored=`cat /var/lib/tazpkg/packages.list | wc -l`; blocked=`cat /var/lib/tazpkg/blocked-packages.list | wc -l`; echo "Packages: $installed installed, $blocked blocked, $(($mirrored - $installed)) installable, $mirrored mirrored, `cat /var/lib/tazpkg/upgradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
415 <variable>PKG_STATS</variable>
416 </text>
417 </hbox>
419 <hbox>
420 <button>
421 <label>Wok</label>
422 <input file icon="gtk-open"></input>
423 <action>firefox http://hg.slitaz.org/wok/file/</action>
424 </button>
425 <button help>
426 <label>Help</label>
427 <action type="launch">HELP</action>
428 </button>
429 <button>
430 <label>Exit</label>
431 <input file icon="exit"></input>
432 <action type="exit">Exit</action>
433 </button>
434 </hbox>
436 </vbox>
438 </window>
439 '
441 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
443 exit 0