tazpkg view tazpkgbox @ rev 207
Add package md5 in log
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Nov 23 12:48:57 2008 +0000 (2008-11-23) |
parents | 145e4d5def86 |
children | 7c00ac97d6bf |
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.5.1
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 export LIST_CONFIG_FILES='
77 <window title="configuration files" icon-name="system-file-manager">
78 <vbox>
79 <tree exported_column="5">
80 <width>560</width><height>160</height>
81 <variable>CONF_FILE</variable>
82 <label>Access | User | Group | Size | Update Date | Name</label>
83 <input>tazpkg list-config --box</input>
84 <action>leafpad $CONF_FILE</action>
85 </tree>
86 <hbox>
87 <text wrap="false">
88 <label>
89 "Only files with Update Date have been modified after package installation"
90 </label>
91 </text>
92 <button>
93 <input file icon="gtk-close"></input>
94 <action type="closewindow">INSTALLED_PACKAGE_ACTIONS</action>
95 </button>
96 </hbox>
97 </vbox>
98 </window>
99 '
101 export SETUP_UNDIGEST='
102 <window title="undigest mirrors" icon-name="tazpkg">
103 <vbox>
104 <tree>
105 <width>560</width><height>160</height>
106 <variable>UNDIGEST_LIST</variable>
107 <label>Name | URL</label>
108 <input>tazpkg list-undigest --box</input>
109 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_LIST; sleep 2"</action>
110 </tree>
111 <hbox>
112 <text>
113 <label>URL:</label>
114 </text>
115 <entry>
116 <variable>UNDIGEST_URL</variable>
117 </entry>
118 </hbox>
119 <hbox>
120 <text>
121 <label>Name:</label>
122 </text>
123 <entry>
124 <variable>UNDIGEST_NAME</variable>
125 </entry>
126 <button>
127 <label>Add</label>
128 <input file icon="gtk-add"></input>
129 <action>tazpkg add-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
130 <action>refresh:UNDIGEST_LIST</action>
131 </button>
132 <button>
133 <label>Remove</label>
134 <input file icon="gtk-remove"></input>
135 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_NAME; sleep 2"</action>
136 <action>refresh:UNDIGEST_LIST</action>
137 </button>
138 <button>
139 <label>Update</label>
140 <input file icon="reload"></input>
141 <action>tazpkg setup-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
142 <action>refresh:UNDIGEST_LIST</action>
143 </button>
144 <button>
145 <input file icon="gtk-close"></input>
146 <action type="closewindow">SETUP_UNDIGEST</action>
147 </button>
148 </hbox>
149 </vbox>
150 </window>
151 '
153 # Main dialog
154 export TAZPKG_DIALOG='
155 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
156 <vbox>
158 <hbox>
159 <text use-markup="true">
160 <label>"<b>Packages Manager</b>"</label>
161 </text>
162 <pixmap>
163 <input file>/usr/share/pixmaps/tazpkg.png</input>
164 </pixmap>
165 </hbox>
167 <notebook labels="Installed|Installable|Mirrored|Undigest|Blocked|Search|Configuration">
169 <vbox>
170 <tree>
171 <width>620</width><height>240</height>
172 <variable>PKG</variable>
173 <label>Package name|Version|Description</label>
174 <input>/usr/lib/slitaz/tazpkgbox/list installed</input>
175 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
176 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
177 <action>refresh:PKG</action>
178 <action>refresh:GETIT</action>
179 <action>refresh:PKG_STATS</action>
180 <action>refresh:CACHE_STATS</action>
181 </tree>
182 <hbox>
183 <text>
184 <label>"Category:"</label>
185 </text>
186 <combobox>
187 <variable>INSTALLED_CAT</variable>
188 <item>all</item>
189 <item>base-system</item>
190 <item>x-window</item>
191 <item>utilities</item>
192 <item>network</item>
193 <item>graphics</item>
194 <item>multimedia</item>
195 <item>office</item>
196 <item>development</item>
197 <item>system-tools</item>
198 <item>security</item>
199 <item>games</item>
200 <item>misc</item>
201 <item>meta</item>
202 <item>non-free</item>
203 </combobox>
204 <button>
205 <label>List</label>
206 <input file icon="reload"></input>
207 <action>echo "$INSTALLED_CAT" > /tmp/tazpkgbox/installed-category</action>
208 <action>refresh:PKG</action>
209 </button>
210 <button>
211 <label>Upgrade all</label>
212 <input file icon="system-software-update"></input>
213 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
214 <action>refresh:PKG</action>
215 <action>refresh:DEV</action>
216 <action>refresh:GET</action>
217 <action>refresh:GETIT</action>
218 <action>refresh:PKG_STATS</action>
219 <action>refresh:CACHE_STATS</action>
220 </button>
221 </hbox>
222 </vbox>
224 <vbox>
225 <tree>
226 <width>620</width><height>240</height>
227 <variable>GETIT</variable>
228 <label>Package name|Version|Description</label>
229 <input>/usr/lib/slitaz/tazpkgbox/list installable</input>
230 <action>echo "$GETIT" > /tmp/tazpkgbox/pkg</action>
231 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
232 <action>refresh:PKG</action>
233 <action>refresh:GETIT</action>
234 <action>refresh:PKG_STATS</action>
235 <action>refresh:CACHE_STATS</action>
236 </tree>
237 <hbox>
238 <text>
239 <label>"Category:"</label>
240 </text>
241 <combobox>
242 <variable>INSTALLABLE_CAT</variable>
243 <item>all</item>
244 <item>base-system</item>
245 <item>x-window</item>
246 <item>utilities</item>
247 <item>network</item>
248 <item>graphics</item>
249 <item>multimedia</item>
250 <item>office</item>
251 <item>development</item>
252 <item>system-tools</item>
253 <item>security</item>
254 <item>games</item>
255 <item>misc</item>
256 <item>meta</item>
257 <item>non-free</item>
258 </combobox>
259 <button>
260 <label>List</label>
261 <input file icon="reload"></input>
262 <action>echo "$INSTALLABLE_CAT" > /tmp/tazpkgbox/installable-category</action>
263 <action>refresh:GETIT</action>
264 </button>
265 <button>
266 <label>Recharge list</label>
267 <input file icon="system-software-update"></input>
268 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
269 <action>refresh:DEV</action>
270 <action>refresh:GET</action>
271 <action>refresh:GETIT</action>
272 <action>refresh:PKG_STATS</action>
273 </button>
274 </hbox>
275 </vbox>
277 <vbox>
278 <tree>
279 <width>620</width><height>240</height>
280 <variable>GET</variable>
281 <label>Package name|Version|Description</label>
282 <input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
283 <action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
284 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
285 <action>refresh:PKG</action>
286 <action>refresh:GETIT</action>
287 <action>refresh:PKG_STATS</action>
288 <action>refresh:CACHE_STATS</action>
289 </tree>
290 <hbox>
291 <text>
292 <label>"Category:"</label>
293 </text>
294 <combobox>
295 <variable>MIRRORED_CAT</variable>
296 <item>all</item>
297 <item>base-system</item>
298 <item>x-window</item>
299 <item>utilities</item>
300 <item>network</item>
301 <item>graphics</item>
302 <item>multimedia</item>
303 <item>office</item>
304 <item>development</item>
305 <item>system-tools</item>
306 <item>security</item>
307 <item>games</item>
308 <item>misc</item>
309 <item>meta</item>
310 <item>non-free</item>
311 </combobox>
312 <button>
313 <label>List</label>
314 <input file icon="reload"></input>
315 <action>echo "$MIRRORED_CAT" > /tmp/tazpkgbox/mirrored-category</action>
316 <action>refresh:GET</action>
317 </button>
318 <button>
319 <label>Recharge list</label>
320 <input file icon="system-software-update"></input>
321 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
322 <action>refresh:DEV</action>
323 <action>refresh:GET</action>
324 <action>refresh:GETIT</action>
325 <action>refresh:PKG_STATS</action>
326 </button>
327 </hbox>
328 </vbox>
330 <vbox>
331 <tree>
332 <width>620</width><height>240</height>
333 <variable>DEV</variable>
334 <label>Package name|Version|Description</label>
335 <input>/usr/lib/slitaz/tazpkgbox/list undigest</input>
336 <action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
337 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
338 <action>refresh:PKG</action>
339 <action>refresh:GETIT</action>
340 <action>refresh:PKG_STATS</action>
341 <action>refresh:CACHE_STATS</action>
342 </tree>
343 <hbox>
344 <button>
345 <label>Setup undigest mirrors</label>
346 <input file icon="go-next"></input>
347 <action type="launch">SETUP_UNDIGEST</action>
348 </button>
349 <button>
350 <label>Recharge list</label>
351 <input file icon="system-software-update"></input>
352 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
353 <action>refresh:DEV</action>
354 <action>refresh:GET</action>
355 <action>refresh:GETIT</action>
356 <action>refresh:PKG_STATS</action>
357 </button>
358 </hbox>
359 <hbox>
360 <text>
361 <label>"Undigest:"</label>
362 </text>
363 <combobox>
364 <variable>UNDIGEST_ENTRY</variable>
365 <input>echo all; ls /var/lib/tazpkg/undigest 2> /dev/null</input>
366 </combobox>
367 <text>
368 <label>"Category:"</label>
369 </text>
370 <combobox>
371 <variable>UNDIGEST_CAT</variable>
372 <item>all</item>
373 <item>base-system</item>
374 <item>x-window</item>
375 <item>utilities</item>
376 <item>network</item>
377 <item>graphics</item>
378 <item>multimedia</item>
379 <item>office</item>
380 <item>development</item>
381 <item>system-tools</item>
382 <item>security</item>
383 <item>games</item>
384 <item>misc</item>
385 <item>meta</item>
386 <item>non-free</item>
387 </combobox>
388 <button>
389 <label>List</label>
390 <input file icon="reload"></input>
391 <action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY" > /tmp/tazpkgbox/undigest-category</action>
392 <action>refresh:DEV</action>
393 </button>
394 </hbox>
395 </vbox>
397 <vbox>
398 <tree>
399 <width>620</width><height>240</height>
400 <variable>BLOCKED</variable>
401 <label>Package name|Version|Available|Description</label>
402 <input>/usr/lib/slitaz/tazpkgbox/list blocked</input>
403 <action>echo "$BLOCKED" > /tmp/tazpkgbox/pkg</action>
404 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
405 <action>refresh:BLOCKED</action>
406 <action>refresh:PKG_STATS</action>
407 </tree>
408 <hbox>
409 <button>
410 <label>Refresh</label>
411 <input file icon="reload"></input>
412 <action>refresh:BLOCKED</action>
413 <action>refresh:PKG_STATS</action>
414 </button>
415 </hbox>
416 </vbox>
418 <vbox>
419 <tree icon="tazpkg">
420 <width>620</width><height>120</height>
421 <variable>RESULT_INSTALLED</variable>
422 <label>Installed packages|Version|Description / File</label>
423 <input>cat /tmp/tazpkgbox/search-installed</input>
424 <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
425 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
426 <action>/usr/lib/slitaz/tazpkgbox/search</action>
427 <action>refresh:RESULT_INSTALLED</action>
428 <action>refresh:PKG</action>
429 <action>refresh:PKG_STATS</action>
430 <action>refresh:CACHE_STATS</action>
431 </tree>
432 <tree icon="tazpkg">
433 <width>620</width><height>120</height>
434 <variable>RESULT_MIRROR</variable>
435 <label>Mirrored packages|Version|Description / File</label>
436 <input>cat /tmp/tazpkgbox/search-mirrored</input>
437 <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
438 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
439 <action>/usr/lib/slitaz/tazpkgbox/search</action>
440 <action>refresh:RESULT_INSTALLED</action>
441 <action>refresh:PKG</action>
442 <action>refresh:PKG_STATS</action>
443 <action>refresh:CACHE_STATS</action>
444 </tree>
445 <hbox>
446 <entry>
447 <variable>SEARCH</variable>
448 </entry>
449 <button>
450 <label>Search Packages</label>
451 <input file icon="system-search"></input>
452 <action>/usr/lib/slitaz/tazpkgbox/search</action>
453 <action>refresh:RESULT_INSTALLED</action>
454 <action>refresh:RESULT_MIRROR</action>
455 </button>
456 <button>
457 <label>Search Files</label>
458 <input file icon="system-search"></input>
459 <action>/usr/lib/slitaz/tazpkgbox/search --files</action>
460 <action>refresh:RESULT_INSTALLED</action>
461 <action>refresh:RESULT_MIRROR</action>
462 </button>
463 </hbox>
464 </vbox>
466 <vbox>
467 <frame Cache directory>
468 <text use-markup="true" width-chars="60" wrap="false">
469 <label>
470 "The cache directory is used to store downloaded or repacked packages."
471 </label>
472 </text>
473 <hbox>
474 <entry editable="false">
475 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
476 <variable>CACHE_STATS</variable>
477 </entry>
478 <button>
479 <label>Clean cache</label>
480 <input file icon="go-next"></input>
481 <action>rm -rf /var/cache/tazpkg/*</action>
482 <action>refresh:CACHE_STATS</action>
483 </button>
484 </hbox>
485 </frame>
486 <frame Mirror URL>
487 <hbox>
488 <entry>
489 <input>head -n 1 /var/lib/tazpkg/mirror</input>
490 <variable>MIRROR</variable>
491 </entry>
492 <button>
493 <label>Setup</label>
494 <input file icon="go-next"></input>
495 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
496 <action>clear:MIRROR</action>
497 <action>refresh:MIRROR</action>
498 </button>
499 <button>
500 <label>Add</label>
501 <input file icon="gtk-add"></input>
502 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
503 <action>clear:MIRROR</action>
504 <action>refresh:MIRROR</action>
505 </button>
506 </hbox>
507 </frame>
508 <frame Files path>
509 <hbox>
510 <text use-markup="true" width-chars="60">
511 <label>
512 "Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>"
513 </label>
514 </text>
515 </hbox>
516 </frame>
517 <hbox>
518 <frame Journal>
519 <hbox>
520 <button>
521 <label>Show journal</label>
522 <input file icon="find"></input>
523 <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>
524 </button>
525 </hbox>
526 </frame>
527 <frame Configuration files>
528 <hbox>
529 <button>
530 <label>Repack config</label>
531 <input file icon="edit-redo"></input>
532 <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>
533 </button>
534 <button>
535 <label>Config Files</label>
536 <input file icon="tazpkg"></input>
537 <action type="launch">LIST_CONFIG_FILES</action>
538 </button>
539 </hbox>
540 </frame>
541 <frame Packages check>
542 <hbox>
543 <button>
544 <label>Quick check</label>
545 <input file icon="go-next"></input>
546 <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>
547 </button>
548 <button>
549 <label>Full check</label>
550 <input file icon="go-next"></input>
551 <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>
552 </button>
553 </hbox>
554 </frame>
555 </hbox>
556 </vbox>
558 </notebook>
560 <hbox>
561 <text wrap="false">
562 <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>
563 <variable>PKG_STATS</variable>
564 </text>
565 </hbox>
567 <hbox>
568 <button>
569 <label>Wok</label>
570 <input file icon="gtk-open"></input>
571 <action>firefox http://hg.slitaz.org/wok/file/</action>
572 </button>
573 <button help>
574 <label>Help</label>
575 <action type="launch">HELP</action>
576 </button>
577 <button>
578 <label>Exit</label>
579 <input file icon="exit"></input>
580 <action type="exit">Exit</action>
581 </button>
582 </hbox>
584 </vbox>
586 </window>
587 '
589 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
591 exit 0