tazpkg view tazpkgbox @ rev 211

tazpkgbox: show depends/rdepends tree
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Nov 24 11:41:43 2008 +0000 (2008-11-24)
parents 7c00ac97d6bf
children 9720c1c3d4f5
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.6
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 "all" > /tmp/tazpkgbox/undigest-category
29 echo "" > /tmp/tazpkgbox/search-installed
30 echo "" > /tmp/tazpkgbox/search-mirrored
32 # English/French help dialod.
33 export HELP='
34 <window title="Tazpkgbox Help" icon-name="help">
35 <vbox>
36 <text use-markup="true" width-chars="54">
37 <label>"
38 <b>Tazpkgbox - Packages Manager Help</b>"
39 </label>
40 </text>
42 <frame English>
43 <text wrap="false">
44 <label>"
45 Tazpkgbox is a simple and easy to use interface to the SliTaz
46 package manager - aka Tazpkg. You can install, remove, repack or
47 get packages by double-clicking on the package item. A Search engine
48 lets you find and install new applications in a few mouse clicks.
50 Downloaded and repacked packages are stored in: /var/cache/tazpkg"
51 </label>
52 </text>
53 </frame>
55 <frame Français>
56 <text wrap="false">
57 <label>"
58 Tazpkgbox est une interface graphique au gestionnaire de paquet
59 de Slitaz aka Tazpkg. Simple et facile à utiliser, vous pouvez
60 installer, télécharger ou supprimer des paquet en double-cliquant
61 sur sa ligne. Les paquets téléchargés ou recréés sont stocké
62 dans: /var/cache/tazpkg"
63 </label>
64 </text>
65 </frame>
67 <hbox>
68 <button ok>
69 <action type="closewindow">HELP</action>
70 </button>
71 </hbox>
72 </vbox>
73 </window>
74 '
76 FILES="$2"
77 [ "$1" = "list_config" ] || FILES=""
78 export LIST_CONFIG_FILES="
79 <window title=\"configuration files\" icon-name=\"system-file-manager\">
80 <vbox>
81 <tree exported_column=\"5\">
82 <width>560</width><height>160</height>
83 <variable>CONF_FILE</variable>
84 <label>Access | User | Group | Size | Update Date | Name</label>
85 <input>tazpkg list-config --box $FILES</input>
86 <action>leafpad \$CONF_FILE</action>
87 </tree>
88 <hbox>
89 <text wrap=\"false\">
90 <label>
91 \"Only files with Update Date have been modified after package installation\"
92 </label>
93 </text>
94 <button>
95 <input file icon=\"gtk-close\"></input>
96 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
97 </button>
98 </hbox>
99 </vbox>
100 </window>
101 "
102 if [ "$1" = "list_config" ]; then
103 gtkdialog --center --program=LIST_CONFIG_FILES >/dev/null
104 exit 0
105 fi
107 export SETUP_UNDIGEST='
108 <window title="undigest mirrors" icon-name="tazpkg">
109 <vbox>
110 <tree>
111 <width>560</width><height>160</height>
112 <variable>UNDIGEST_LIST</variable>
113 <label>Name | URL</label>
114 <input>tazpkg list-undigest --box</input>
115 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_LIST; sleep 2"</action>
116 </tree>
117 <hbox>
118 <text>
119 <label>URL:</label>
120 </text>
121 <entry>
122 <variable>UNDIGEST_URL</variable>
123 </entry>
124 </hbox>
125 <hbox>
126 <text>
127 <label>Name:</label>
128 </text>
129 <entry>
130 <variable>UNDIGEST_NAME</variable>
131 </entry>
132 <button>
133 <label>Add</label>
134 <input file icon="gtk-add"></input>
135 <action>tazpkg add-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
136 <action>refresh:UNDIGEST_LIST</action>
137 </button>
138 <button>
139 <label>Remove</label>
140 <input file icon="gtk-remove"></input>
141 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_NAME; sleep 2"</action>
142 <action>refresh:UNDIGEST_LIST</action>
143 </button>
144 <button>
145 <label>Update</label>
146 <input file icon="reload"></input>
147 <action>tazpkg setup-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
148 <action>refresh:UNDIGEST_LIST</action>
149 </button>
150 <button>
151 <input file icon="gtk-close"></input>
152 <action type="closewindow">SETUP_UNDIGEST</action>
153 </button>
154 </hbox>
155 </vbox>
156 </window>
157 '
159 # Main dialog
160 export TAZPKG_DIALOG='
161 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
162 <vbox>
164 <hbox>
165 <text use-markup="true">
166 <label>"<b>Packages Manager</b>"</label>
167 </text>
168 <pixmap>
169 <input file>/usr/share/pixmaps/tazpkg.png</input>
170 </pixmap>
171 </hbox>
173 <notebook labels="Installed|Installable|Mirrored|Undigest|Blocked|Search|Configuration">
175 <vbox>
176 <tree>
177 <width>620</width><height>240</height>
178 <variable>PKG</variable>
179 <label>Package name|Version|Description</label>
180 <input>/usr/lib/slitaz/tazpkgbox/list installed</input>
181 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
182 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
183 <action>refresh:PKG</action>
184 <action>refresh:GETIT</action>
185 <action>refresh:PKG_STATS</action>
186 <action>refresh:CACHE_STATS</action>
187 </tree>
188 <hbox>
189 <text>
190 <label>"Category:"</label>
191 </text>
192 <combobox>
193 <variable>INSTALLED_CAT</variable>
194 <item>all</item>
195 <item>base-system</item>
196 <item>x-window</item>
197 <item>utilities</item>
198 <item>network</item>
199 <item>graphics</item>
200 <item>multimedia</item>
201 <item>office</item>
202 <item>development</item>
203 <item>system-tools</item>
204 <item>security</item>
205 <item>games</item>
206 <item>misc</item>
207 <item>meta</item>
208 <item>non-free</item>
209 </combobox>
210 <button>
211 <label>List</label>
212 <input file icon="reload"></input>
213 <action>echo "$INSTALLED_CAT" > /tmp/tazpkgbox/installed-category</action>
214 <action>refresh:PKG</action>
215 </button>
216 <button>
217 <label>Upgrade all</label>
218 <input file icon="system-software-update"></input>
219 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
220 <action>refresh:PKG</action>
221 <action>refresh:DEV</action>
222 <action>refresh:GET</action>
223 <action>refresh:GETIT</action>
224 <action>refresh:PKG_STATS</action>
225 <action>refresh:CACHE_STATS</action>
226 </button>
227 </hbox>
228 </vbox>
230 <vbox>
231 <tree>
232 <width>620</width><height>240</height>
233 <variable>GETIT</variable>
234 <label>Package name|Version|Description</label>
235 <input>/usr/lib/slitaz/tazpkgbox/list installable</input>
236 <action>echo "$GETIT" > /tmp/tazpkgbox/pkg</action>
237 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
238 <action>refresh:PKG</action>
239 <action>refresh:GETIT</action>
240 <action>refresh:PKG_STATS</action>
241 <action>refresh:CACHE_STATS</action>
242 </tree>
243 <hbox>
244 <text>
245 <label>"Category:"</label>
246 </text>
247 <combobox>
248 <variable>INSTALLABLE_CAT</variable>
249 <item>all</item>
250 <item>base-system</item>
251 <item>x-window</item>
252 <item>utilities</item>
253 <item>network</item>
254 <item>graphics</item>
255 <item>multimedia</item>
256 <item>office</item>
257 <item>development</item>
258 <item>system-tools</item>
259 <item>security</item>
260 <item>games</item>
261 <item>misc</item>
262 <item>meta</item>
263 <item>non-free</item>
264 </combobox>
265 <button>
266 <label>List</label>
267 <input file icon="reload"></input>
268 <action>echo "$INSTALLABLE_CAT" > /tmp/tazpkgbox/installable-category</action>
269 <action>refresh:GETIT</action>
270 </button>
271 <button>
272 <label>Recharge list</label>
273 <input file icon="system-software-update"></input>
274 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
275 <action>refresh:DEV</action>
276 <action>refresh:GET</action>
277 <action>refresh:GETIT</action>
278 <action>refresh:PKG_STATS</action>
279 </button>
280 </hbox>
281 </vbox>
283 <vbox>
284 <tree>
285 <width>620</width><height>240</height>
286 <variable>GET</variable>
287 <label>Package name|Version|Description</label>
288 <input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
289 <action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
290 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
291 <action>refresh:PKG</action>
292 <action>refresh:GETIT</action>
293 <action>refresh:PKG_STATS</action>
294 <action>refresh:CACHE_STATS</action>
295 </tree>
296 <hbox>
297 <text>
298 <label>"Category:"</label>
299 </text>
300 <combobox>
301 <variable>MIRRORED_CAT</variable>
302 <item>all</item>
303 <item>base-system</item>
304 <item>x-window</item>
305 <item>utilities</item>
306 <item>network</item>
307 <item>graphics</item>
308 <item>multimedia</item>
309 <item>office</item>
310 <item>development</item>
311 <item>system-tools</item>
312 <item>security</item>
313 <item>games</item>
314 <item>misc</item>
315 <item>meta</item>
316 <item>non-free</item>
317 </combobox>
318 <button>
319 <label>List</label>
320 <input file icon="reload"></input>
321 <action>echo "$MIRRORED_CAT" > /tmp/tazpkgbox/mirrored-category</action>
322 <action>refresh:GET</action>
323 </button>
324 <button>
325 <label>Recharge list</label>
326 <input file icon="system-software-update"></input>
327 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
328 <action>refresh:DEV</action>
329 <action>refresh:GET</action>
330 <action>refresh:GETIT</action>
331 <action>refresh:PKG_STATS</action>
332 </button>
333 </hbox>
334 </vbox>
336 <vbox>
337 <tree>
338 <width>620</width><height>240</height>
339 <variable>DEV</variable>
340 <label>Package name|Version|Description</label>
341 <input>/usr/lib/slitaz/tazpkgbox/list undigest</input>
342 <action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
343 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
344 <action>refresh:PKG</action>
345 <action>refresh:GETIT</action>
346 <action>refresh:PKG_STATS</action>
347 <action>refresh:CACHE_STATS</action>
348 </tree>
349 <hbox>
350 <button>
351 <label>Setup undigest mirrors</label>
352 <input file icon="go-next"></input>
353 <action type="launch">SETUP_UNDIGEST</action>
354 </button>
355 <button>
356 <label>Recharge list</label>
357 <input file icon="system-software-update"></input>
358 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
359 <action>refresh:DEV</action>
360 <action>refresh:GET</action>
361 <action>refresh:GETIT</action>
362 <action>refresh:PKG_STATS</action>
363 </button>
364 </hbox>
365 <hbox>
366 <text>
367 <label>"Undigest:"</label>
368 </text>
369 <combobox>
370 <variable>UNDIGEST_ENTRY</variable>
371 <input>echo all; ls /var/lib/tazpkg/undigest 2> /dev/null</input>
372 </combobox>
373 <text>
374 <label>"Category:"</label>
375 </text>
376 <combobox>
377 <variable>UNDIGEST_CAT</variable>
378 <item>all</item>
379 <item>base-system</item>
380 <item>x-window</item>
381 <item>utilities</item>
382 <item>network</item>
383 <item>graphics</item>
384 <item>multimedia</item>
385 <item>office</item>
386 <item>development</item>
387 <item>system-tools</item>
388 <item>security</item>
389 <item>games</item>
390 <item>misc</item>
391 <item>meta</item>
392 <item>non-free</item>
393 </combobox>
394 <button>
395 <label>List</label>
396 <input file icon="reload"></input>
397 <action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY" > /tmp/tazpkgbox/undigest-category</action>
398 <action>refresh:DEV</action>
399 </button>
400 </hbox>
401 </vbox>
403 <vbox>
404 <tree>
405 <width>620</width><height>240</height>
406 <variable>BLOCKED</variable>
407 <label>Package name|Version|Available|Description</label>
408 <input>/usr/lib/slitaz/tazpkgbox/list blocked</input>
409 <action>echo "$BLOCKED" > /tmp/tazpkgbox/pkg</action>
410 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
411 <action>refresh:BLOCKED</action>
412 <action>refresh:PKG_STATS</action>
413 </tree>
414 <hbox>
415 <button>
416 <label>Refresh</label>
417 <input file icon="reload"></input>
418 <action>refresh:BLOCKED</action>
419 <action>refresh:PKG_STATS</action>
420 </button>
421 </hbox>
422 </vbox>
424 <vbox>
425 <tree icon="tazpkg">
426 <width>620</width><height>120</height>
427 <variable>RESULT_INSTALLED</variable>
428 <label>Installed packages|Version|Description / File</label>
429 <input>cat /tmp/tazpkgbox/search-installed</input>
430 <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
431 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
432 <action>/usr/lib/slitaz/tazpkgbox/search</action>
433 <action>refresh:RESULT_INSTALLED</action>
434 <action>refresh:PKG</action>
435 <action>refresh:PKG_STATS</action>
436 <action>refresh:CACHE_STATS</action>
437 </tree>
438 <tree icon="tazpkg">
439 <width>620</width><height>120</height>
440 <variable>RESULT_MIRROR</variable>
441 <label>Mirrored packages|Version|Description / File</label>
442 <input>cat /tmp/tazpkgbox/search-mirrored</input>
443 <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
444 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
445 <action>/usr/lib/slitaz/tazpkgbox/search</action>
446 <action>refresh:RESULT_INSTALLED</action>
447 <action>refresh:PKG</action>
448 <action>refresh:PKG_STATS</action>
449 <action>refresh:CACHE_STATS</action>
450 </tree>
451 <hbox>
452 <entry>
453 <variable>SEARCH</variable>
454 </entry>
455 <button>
456 <label>Search Packages</label>
457 <input file icon="system-search"></input>
458 <action>/usr/lib/slitaz/tazpkgbox/search</action>
459 <action>refresh:RESULT_INSTALLED</action>
460 <action>refresh:RESULT_MIRROR</action>
461 </button>
462 <button>
463 <label>Search Files</label>
464 <input file icon="system-search"></input>
465 <action>/usr/lib/slitaz/tazpkgbox/search --files</action>
466 <action>refresh:RESULT_INSTALLED</action>
467 <action>refresh:RESULT_MIRROR</action>
468 </button>
469 </hbox>
470 </vbox>
472 <vbox>
473 <frame Cache directory>
474 <text use-markup="true" width-chars="60" wrap="false">
475 <label>
476 "The cache directory is used to store downloaded or repacked packages."
477 </label>
478 </text>
479 <hbox>
480 <entry editable="false">
481 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
482 <variable>CACHE_STATS</variable>
483 </entry>
484 <button>
485 <label>Clean cache</label>
486 <input file icon="go-next"></input>
487 <action>rm -rf /var/cache/tazpkg/*</action>
488 <action>refresh:CACHE_STATS</action>
489 </button>
490 </hbox>
491 </frame>
492 <frame Mirror URL>
493 <hbox>
494 <entry>
495 <input>head -n 1 /var/lib/tazpkg/mirror</input>
496 <variable>MIRROR</variable>
497 </entry>
498 <button>
499 <label>Setup</label>
500 <input file icon="go-next"></input>
501 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
502 <action>clear:MIRROR</action>
503 <action>refresh:MIRROR</action>
504 </button>
505 <button>
506 <label>Add</label>
507 <input file icon="gtk-add"></input>
508 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
509 <action>clear:MIRROR</action>
510 <action>refresh:MIRROR</action>
511 </button>
512 </hbox>
513 </frame>
514 <frame Files path>
515 <hbox>
516 <text use-markup="true" width-chars="60">
517 <label>
518 "Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>"
519 </label>
520 </text>
521 </hbox>
522 </frame>
523 <hbox>
524 <frame Journal>
525 <hbox>
526 <button>
527 <label>Show journal</label>
528 <input file icon="find"></input>
529 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "$(ls -l /var/log/tazpkg.log | while read mod links user grep remain ; do echo $remain ; done) (q to quit)" -geometry 80x25+120+120 -e "cat /var/log/tazpkg.log | less"</action>
530 </button>
531 </hbox>
532 </frame>
533 <frame Configuration files>
534 <hbox>
535 <button>
536 <label>Repack config</label>
537 <input file icon="edit-redo"></input>
538 <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>
539 </button>
540 <button>
541 <label>Config Files</label>
542 <input file icon="tazpkg"></input>
543 <action type="launch">LIST_CONFIG_FILES</action>
544 </button>
545 </hbox>
546 </frame>
547 <frame Packages check>
548 <hbox>
549 <button>
550 <label>Quick check</label>
551 <input file icon="go-next"></input>
552 <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>
553 </button>
554 <button>
555 <label>Full check</label>
556 <input file icon="go-next"></input>
557 <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>
558 </button>
559 </hbox>
560 </frame>
561 </hbox>
562 </vbox>
564 </notebook>
566 <hbox>
567 <text wrap="false">
568 <input>installed=`ls /var/lib/tazpkg/installed | wc -l`; mirrored=`cat /var/lib/tazpkg/packages.list | wc -l`; undigest=`cat /var/lib/tazpkg/undigest/*/packages.list 2> /dev/null | wc -l`; blocked=`cat /var/lib/tazpkg/blocked-packages.list 2> /dev/null | wc -l`; installable=$(($mirrored + $undigest - $installed)); [ $installable -lt 0 ] && installable=0; echo "Packages: $installed installed, $blocked blocked, $installable installable, $undigest undigest, $mirrored mirrored, `cat /var/lib/tazpkg/upgradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
569 <variable>PKG_STATS</variable>
570 </text>
571 </hbox>
573 <hbox>
574 <button>
575 <label>Wok</label>
576 <input file icon="gtk-open"></input>
577 <action>firefox http://hg.slitaz.org/wok/file/</action>
578 </button>
579 <button help>
580 <label>Help</label>
581 <action type="launch">HELP</action>
582 </button>
583 <button>
584 <label>Exit</label>
585 <input file icon="exit"></input>
586 <action type="exit">Exit</action>
587 </button>
588 </hbox>
590 </vbox>
592 </window>
593 '
595 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
597 exit 0