tazpkg view tazpkgbox @ rev 227

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