tazpkg view tazpkgbox @ rev 224
Add pre_depends
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Feb 18 17:07:17 2009 +0000 (2009-02-18) |
parents | 2f8faaf570c5 |
children | e3aebbd89277 |
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 '
372 for i in all $(ls /var/lib/tazpkg/undigest 2> /dev/null); do
373 TAZPKG_DIALOG="$TAZPKG_DIALOG <item>$i</item> "
374 done
375 tmp=' </combobox>
376 <text>
377 <label>"Category:"</label>
378 </text>
379 <combobox>
380 <variable>UNDIGEST_CAT</variable>
381 <item>all</item>
382 <item>base-system</item>
383 <item>x-window</item>
384 <item>utilities</item>
385 <item>network</item>
386 <item>graphics</item>
387 <item>multimedia</item>
388 <item>office</item>
389 <item>development</item>
390 <item>system-tools</item>
391 <item>security</item>
392 <item>games</item>
393 <item>misc</item>
394 <item>meta</item>
395 <item>non-free</item>
396 </combobox>
397 <button>
398 <label>List</label>
399 <input file icon="reload"></input>
400 <action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY" > /tmp/tazpkgbox/undigest-category</action>
401 <action>refresh:DEV</action>
402 </button>
403 </hbox>
404 </vbox>
406 <vbox>
407 <tree>
408 <width>620</width><height>240</height>
409 <variable>BLOCKED</variable>
410 <label>Package name|Version|Available|Description</label>
411 <input>/usr/lib/slitaz/tazpkgbox/list blocked</input>
412 <action>echo "$BLOCKED" > /tmp/tazpkgbox/pkg</action>
413 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
414 <action>refresh:BLOCKED</action>
415 <action>refresh:PKG_STATS</action>
416 </tree>
417 <hbox>
418 <button>
419 <label>Refresh</label>
420 <input file icon="reload"></input>
421 <action>refresh:BLOCKED</action>
422 <action>refresh:PKG_STATS</action>
423 </button>
424 </hbox>
425 </vbox>
427 <vbox>
428 <tree icon="tazpkg">
429 <width>620</width><height>120</height>
430 <variable>RESULT_INSTALLED</variable>
431 <label>Installed packages|Version|Description / File</label>
432 <input>cat /tmp/tazpkgbox/search-installed</input>
433 <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
434 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
435 <action>/usr/lib/slitaz/tazpkgbox/search</action>
436 <action>refresh:RESULT_INSTALLED</action>
437 <action>refresh:PKG</action>
438 <action>refresh:PKG_STATS</action>
439 <action>refresh:CACHE_STATS</action>
440 </tree>
441 <tree icon="tazpkg">
442 <width>620</width><height>120</height>
443 <variable>RESULT_MIRROR</variable>
444 <label>Mirrored packages|Version|Description / File</label>
445 <input>cat /tmp/tazpkgbox/search-mirrored</input>
446 <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
447 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
448 <action>/usr/lib/slitaz/tazpkgbox/search</action>
449 <action>refresh:RESULT_INSTALLED</action>
450 <action>refresh:PKG</action>
451 <action>refresh:PKG_STATS</action>
452 <action>refresh:CACHE_STATS</action>
453 </tree>
454 <hbox>
455 <entry>
456 <variable>SEARCH</variable>
457 </entry>
458 <button>
459 <label>Search Packages</label>
460 <input file icon="system-search"></input>
461 <action>/usr/lib/slitaz/tazpkgbox/search</action>
462 <action>refresh:RESULT_INSTALLED</action>
463 <action>refresh:RESULT_MIRROR</action>
464 </button>
465 <button>
466 <label>Search Files</label>
467 <input file icon="system-search"></input>
468 <action>/usr/lib/slitaz/tazpkgbox/search --files</action>
469 <action>refresh:RESULT_INSTALLED</action>
470 <action>refresh:RESULT_MIRROR</action>
471 </button>
472 </hbox>
473 </vbox>
475 <vbox>
476 <frame Cache directory>
477 <text use-markup="true" width-chars="60" wrap="false">
478 <label>
479 "The cache directory is used to store downloaded or repacked packages."
480 </label>
481 </text>
482 <hbox>
483 <entry editable="false">
484 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
485 <variable>CACHE_STATS</variable>
486 </entry>
487 <button>
488 <label>Clean cache</label>
489 <input file icon="go-next"></input>
490 <action>rm -rf /var/cache/tazpkg/*</action>
491 <action>refresh:CACHE_STATS</action>
492 </button>
493 </hbox>
494 </frame>
495 <frame Mirror URL>
496 <hbox>
497 <entry>
498 <input>head -n 1 /var/lib/tazpkg/mirror</input>
499 <variable>MIRROR</variable>
500 </entry>
501 <button>
502 <label>Setup</label>
503 <input file icon="go-next"></input>
504 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
505 <action>clear:MIRROR</action>
506 <action>refresh:MIRROR</action>
507 </button>
508 <button>
509 <label>Add</label>
510 <input file icon="gtk-add"></input>
511 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
512 <action>clear:MIRROR</action>
513 <action>refresh:MIRROR</action>
514 </button>
515 </hbox>
516 </frame>
517 <frame Files path>
518 <hbox>
519 <text use-markup="true" width-chars="60">
520 <label>
521 "Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>"
522 </label>
523 </text>
524 </hbox>
525 </frame>
526 <hbox>
527 <frame Journal>
528 <hbox>
529 <button>
530 <label>Show journal</label>
531 <input file icon="find"></input>
532 <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>
533 </button>
534 </hbox>
535 </frame>
536 <frame Configuration files>
537 <hbox>
538 <button>
539 <label>Repack config</label>
540 <input file icon="edit-redo"></input>
541 <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>
542 </button>
543 <button>
544 <label>Config Files</label>
545 <input file icon="tazpkg"></input>
546 <action type="launch">LIST_CONFIG_FILES</action>
547 </button>
548 </hbox>
549 </frame>
550 <frame Packages check>
551 <hbox>
552 <button>
553 <label>Quick check</label>
554 <input file icon="go-next"></input>
555 <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>
556 </button>
557 <button>
558 <label>Full check</label>
559 <input file icon="go-next"></input>
560 <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>
561 </button>
562 </hbox>
563 </frame>
564 </hbox>
565 </vbox>
567 </notebook>
569 <hbox>
570 <text wrap="false">
571 <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>
572 <variable>PKG_STATS</variable>
573 </text>
574 </hbox>
576 <hbox>
577 <button>
578 <label>Wok</label>
579 <input file icon="gtk-open"></input>
580 <action>firefox http://hg.slitaz.org/wok/file/</action>
581 </button>
582 <button help>
583 <label>Help</label>
584 <action type="launch">HELP</action>
585 </button>
586 <button>
587 <label>Exit</label>
588 <input file icon="exit"></input>
589 <action type="exit">Exit</action>
590 </button>
591 </hbox>
593 </vbox>
595 </window>
596 '
597 TAZPKG_DIALOG="$TAZPKG_DIALOG$tmp"
599 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
601 exit 0