tazpkg view tazpkgbox @ rev 187

Add undigest support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Oct 27 23:12:36 2008 +0000 (2008-10-27)
parents 7a68f9b5e1c2
children 145e4d5def86
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
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:PKG_STATS</action>
216 <action>refresh:CACHE_STATS</action>
217 </button>
218 </hbox>
219 </vbox>
221 <vbox>
222 <tree>
223 <width>620</width><height>240</height>
224 <variable>GETIT</variable>
225 <label>Package name|Version|Description</label>
226 <input>/usr/lib/slitaz/tazpkgbox/list installable</input>
227 <action>echo "$GETIT" > /tmp/tazpkgbox/pkg</action>
228 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
229 <action>refresh:PKG</action>
230 <action>refresh:GETIT</action>
231 <action>refresh:PKG_STATS</action>
232 <action>refresh:CACHE_STATS</action>
233 </tree>
234 <hbox>
235 <text>
236 <label>"Category:"</label>
237 </text>
238 <combobox>
239 <variable>INSTALLABLE_CAT</variable>
240 <item>all</item>
241 <item>base-system</item>
242 <item>x-window</item>
243 <item>utilities</item>
244 <item>network</item>
245 <item>graphics</item>
246 <item>multimedia</item>
247 <item>office</item>
248 <item>development</item>
249 <item>system-tools</item>
250 <item>security</item>
251 <item>games</item>
252 <item>misc</item>
253 <item>meta</item>
254 <item>non-free</item>
255 </combobox>
256 <button>
257 <label>List</label>
258 <input file icon="reload"></input>
259 <action>echo "$INSTALLABLE_CAT" > /tmp/tazpkgbox/installable-category</action>
260 <action>refresh:GETIT</action>
261 </button>
262 <button>
263 <label>Recharge list</label>
264 <input file icon="system-software-update"></input>
265 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
266 <action>refresh:DEV</action>
267 <action>refresh:GET</action>
268 <action>refresh:GETIT</action>
269 <action>refresh:PKG_STATS</action>
270 </button>
271 </hbox>
272 </vbox>
274 <vbox>
275 <tree>
276 <width>620</width><height>240</height>
277 <variable>GET</variable>
278 <label>Package name|Version|Description</label>
279 <input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
280 <action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
281 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
282 <action>refresh:PKG</action>
283 <action>refresh:GETIT</action>
284 <action>refresh:PKG_STATS</action>
285 <action>refresh:CACHE_STATS</action>
286 </tree>
287 <hbox>
288 <text>
289 <label>"Category:"</label>
290 </text>
291 <combobox>
292 <variable>MIRRORED_CAT</variable>
293 <item>all</item>
294 <item>base-system</item>
295 <item>x-window</item>
296 <item>utilities</item>
297 <item>network</item>
298 <item>graphics</item>
299 <item>multimedia</item>
300 <item>office</item>
301 <item>development</item>
302 <item>system-tools</item>
303 <item>security</item>
304 <item>games</item>
305 <item>misc</item>
306 <item>meta</item>
307 <item>non-free</item>
308 </combobox>
309 <button>
310 <label>List</label>
311 <input file icon="reload"></input>
312 <action>echo "$MIRRORED_CAT" > /tmp/tazpkgbox/mirrored-category</action>
313 <action>refresh:GET</action>
314 </button>
315 <button>
316 <label>Recharge list</label>
317 <input file icon="system-software-update"></input>
318 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
319 <action>refresh:DEV</action>
320 <action>refresh:GET</action>
321 <action>refresh:GETIT</action>
322 <action>refresh:PKG_STATS</action>
323 </button>
324 </hbox>
325 </vbox>
327 <vbox>
328 <tree>
329 <width>620</width><height>240</height>
330 <variable>DEV</variable>
331 <label>Package name|Version|Description</label>
332 <input>/usr/lib/slitaz/tazpkgbox/list undigest</input>
333 <action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
334 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
335 <action>refresh:PKG</action>
336 <action>refresh:GETIT</action>
337 <action>refresh:PKG_STATS</action>
338 <action>refresh:CACHE_STATS</action>
339 </tree>
340 <hbox>
341 <button>
342 <label>Setup undigest mirrors</label>
343 <input file icon="go-next"></input>
344 <action type="launch">SETUP_UNDIGEST</action>
345 </button>
346 <button>
347 <label>Recharge list</label>
348 <input file icon="system-software-update"></input>
349 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
350 <action>refresh:DEV</action>
351 <action>refresh:GET</action>
352 <action>refresh:GETIT</action>
353 <action>refresh:PKG_STATS</action>
354 </button>
355 </hbox>
356 <hbox>
357 <text>
358 <label>"Undigest:"</label>
359 </text>
360 <combobox>
361 <variable>UNDIGEST_ENTRY</variable>
362 <input>echo all; ls /var/lib/tazpkg/undigest 2> /dev/null</input>
363 </combobox>
364 <text>
365 <label>"Category:"</label>
366 </text>
367 <combobox>
368 <variable>UNDIGEST_CAT</variable>
369 <item>all</item>
370 <item>base-system</item>
371 <item>x-window</item>
372 <item>utilities</item>
373 <item>network</item>
374 <item>graphics</item>
375 <item>multimedia</item>
376 <item>office</item>
377 <item>development</item>
378 <item>system-tools</item>
379 <item>security</item>
380 <item>games</item>
381 <item>misc</item>
382 <item>meta</item>
383 <item>non-free</item>
384 </combobox>
385 <button>
386 <label>List</label>
387 <input file icon="reload"></input>
388 <action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY" > /tmp/tazpkgbox/undigest-category</action>
389 <action>refresh:DEV</action>
390 </button>
391 </hbox>
392 </vbox>
394 <vbox>
395 <tree>
396 <width>620</width><height>240</height>
397 <variable>BLOCKED</variable>
398 <label>Package name|Version|Available|Description</label>
399 <input>/usr/lib/slitaz/tazpkgbox/list blocked</input>
400 <action>echo "$BLOCKED" > /tmp/tazpkgbox/pkg</action>
401 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
402 <action>refresh:BLOCKED</action>
403 <action>refresh:PKG_STATS</action>
404 </tree>
405 <hbox>
406 <button>
407 <label>Refresh</label>
408 <input file icon="reload"></input>
409 <action>refresh:BLOCKED</action>
410 <action>refresh:PKG_STATS</action>
411 </button>
412 </hbox>
413 </vbox>
415 <vbox>
416 <tree icon="tazpkg">
417 <width>620</width><height>120</height>
418 <variable>RESULT_INSTALLED</variable>
419 <label>Installed packages|Version|Description / File</label>
420 <input>cat /tmp/tazpkgbox/search-installed</input>
421 <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
422 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
423 <action>/usr/lib/slitaz/tazpkgbox/search</action>
424 <action>refresh:RESULT_INSTALLED</action>
425 <action>refresh:PKG</action>
426 <action>refresh:PKG_STATS</action>
427 <action>refresh:CACHE_STATS</action>
428 </tree>
429 <tree icon="tazpkg">
430 <width>620</width><height>120</height>
431 <variable>RESULT_MIRROR</variable>
432 <label>Mirrored packages|Version|Description / File</label>
433 <input>cat /tmp/tazpkgbox/search-mirrored</input>
434 <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
435 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
436 <action>/usr/lib/slitaz/tazpkgbox/search</action>
437 <action>refresh:RESULT_INSTALLED</action>
438 <action>refresh:PKG</action>
439 <action>refresh:PKG_STATS</action>
440 <action>refresh:CACHE_STATS</action>
441 </tree>
442 <hbox>
443 <entry>
444 <variable>SEARCH</variable>
445 </entry>
446 <button>
447 <label>Search Packages</label>
448 <input file icon="system-search"></input>
449 <action>/usr/lib/slitaz/tazpkgbox/search</action>
450 <action>refresh:RESULT_INSTALLED</action>
451 <action>refresh:RESULT_MIRROR</action>
452 </button>
453 <button>
454 <label>Search Files</label>
455 <input file icon="system-search"></input>
456 <action>/usr/lib/slitaz/tazpkgbox/search --files</action>
457 <action>refresh:RESULT_INSTALLED</action>
458 <action>refresh:RESULT_MIRROR</action>
459 </button>
460 </hbox>
461 </vbox>
463 <vbox>
464 <frame Cache directory>
465 <text use-markup="true" width-chars="60" wrap="false">
466 <label>
467 "The cache directory is used to store downloaded or repacked packages."
468 </label>
469 </text>
470 <hbox>
471 <entry editable="false">
472 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
473 <variable>CACHE_STATS</variable>
474 </entry>
475 <button>
476 <label>Clean cache</label>
477 <input file icon="go-next"></input>
478 <action>rm -rf /var/cache/tazpkg/*</action>
479 <action>refresh:CACHE_STATS</action>
480 </button>
481 </hbox>
482 </frame>
483 <frame Mirror URL>
484 <hbox>
485 <entry>
486 <input>head -n 1 /var/lib/tazpkg/mirror</input>
487 <variable>MIRROR</variable>
488 </entry>
489 <button>
490 <label>Setup</label>
491 <input file icon="go-next"></input>
492 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
493 <action>clear:MIRROR</action>
494 <action>refresh:MIRROR</action>
495 </button>
496 <button>
497 <label>Add</label>
498 <input file icon="gtk-add"></input>
499 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
500 <action>clear:MIRROR</action>
501 <action>refresh:MIRROR</action>
502 </button>
503 </hbox>
504 </frame>
505 <frame Files path>
506 <hbox>
507 <text use-markup="true" width-chars="60">
508 <label>
509 "Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>"
510 </label>
511 </text>
512 </hbox>
513 </frame>
514 <hbox>
515 <frame Journal>
516 <hbox>
517 <button>
518 <label>Show journal</label>
519 <input file icon="find"></input>
520 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Tazpkg journal (q to quit)" -geometry 80x25+120+120 -e "ls -l /var/log/tazpkg.log | cat - /var/log/tazpkg.log | less"</action>
521 </button>
522 </hbox>
523 </frame>
524 <frame Configuration files>
525 <hbox>
526 <button>
527 <label>Repack config</label>
528 <input file icon="edit-redo"></input>
529 <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>
530 </button>
531 <button>
532 <label>Config Files</label>
533 <input file icon="tazpkg"></input>
534 <action type="launch">LIST_CONFIG_FILES</action>
535 </button>
536 </hbox>
537 </frame>
538 <frame Packages check>
539 <hbox>
540 <button>
541 <label>Quick check</label>
542 <input file icon="go-next"></input>
543 <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>
544 </button>
545 <button>
546 <label>Full check</label>
547 <input file icon="go-next"></input>
548 <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>
549 </button>
550 </hbox>
551 </frame>
552 </hbox>
553 </vbox>
555 </notebook>
557 <hbox>
558 <text wrap="false">
559 <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>
560 <variable>PKG_STATS</variable>
561 </text>
562 </hbox>
564 <hbox>
565 <button>
566 <label>Wok</label>
567 <input file icon="gtk-open"></input>
568 <action>firefox http://hg.slitaz.org/wok/file/</action>
569 </button>
570 <button help>
571 <label>Help</label>
572 <action type="launch">HELP</action>
573 </button>
574 <button>
575 <label>Exit</label>
576 <input file icon="exit"></input>
577 <action type="exit">Exit</action>
578 </button>
579 </hbox>
581 </vbox>
583 </window>
584 '
586 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
588 exit 0