tazpkg view tazpkgbox @ rev 229
tazpkgbox: display icons and notify packages scan
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Feb 21 15:15:21 2009 +0100 (2009-02-21) |
parents | 6b0bd0333c2e |
children | 9f4db6b4a0ef |
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 2009.
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 # Scan notifycation
160 desktopbox notify "Scanning packages database" 6 &
162 # Main dialog
163 export TAZPKG_DIALOG='
164 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
165 <vbox>
167 <hbox>
168 <text use-markup="true">
169 <label>"<b>Packages Manager</b>"</label>
170 </text>
171 <pixmap>
172 <input file>/usr/share/pixmaps/tazpkg.png</input>
173 </pixmap>
174 </hbox>
176 <notebook labels="Installed|Installable|Mirrored|Undigest|Blocked|Search|Configuration">
178 <vbox>
179 <tree>
180 <width>620</width><height>240</height>
181 <variable>PKG</variable>
182 <label>Package name|Version|Description</label>
183 <input>/usr/lib/slitaz/tazpkgbox/list installed</input>
184 <item icon="tazpkg">dummy | -</item>
185 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
186 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
187 <action>refresh:PKG</action>
188 <action>refresh:GETIT</action>
189 <action>refresh:PKG_STATS</action>
190 <action>refresh:CACHE_STATS</action>
191 </tree>
192 <hbox>
193 <text>
194 <label>"Category:"</label>
195 </text>
196 <combobox>
197 <variable>INSTALLED_CAT</variable>
198 <item>all</item>
199 <item>base-system</item>
200 <item>x-window</item>
201 <item>utilities</item>
202 <item>network</item>
203 <item>graphics</item>
204 <item>multimedia</item>
205 <item>office</item>
206 <item>development</item>
207 <item>system-tools</item>
208 <item>security</item>
209 <item>games</item>
210 <item>misc</item>
211 <item>meta</item>
212 <item>non-free</item>
213 </combobox>
214 <button>
215 <label>List</label>
216 <input file icon="reload"></input>
217 <action>echo "$INSTALLED_CAT" > /tmp/tazpkgbox/installed-category</action>
218 <action>refresh:PKG</action>
219 </button>
220 </hbox>
221 </vbox>
223 <vbox>
224 <tree>
225 <width>620</width><height>240</height>
226 <variable>GETIT</variable>
227 <label>Package name|Version|Description</label>
228 <input>/usr/lib/slitaz/tazpkgbox/list installable</input>
229 <item icon="tazpkg">dummy | -</item>
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 </hbox>
266 </vbox>
268 <vbox>
269 <tree>
270 <width>620</width><height>240</height>
271 <variable>GET</variable>
272 <label>Package name|Version|Description</label>
273 <input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
274 <item icon="tazpkg">dummy | -</item>
275 <action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
276 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
277 <action>refresh:PKG</action>
278 <action>refresh:GETIT</action>
279 <action>refresh:PKG_STATS</action>
280 <action>refresh:CACHE_STATS</action>
281 </tree>
282 <hbox>
283 <text>
284 <label>"Category:"</label>
285 </text>
286 <combobox>
287 <variable>MIRRORED_CAT</variable>
288 <item>all</item>
289 <item>base-system</item>
290 <item>x-window</item>
291 <item>utilities</item>
292 <item>network</item>
293 <item>graphics</item>
294 <item>multimedia</item>
295 <item>office</item>
296 <item>development</item>
297 <item>system-tools</item>
298 <item>security</item>
299 <item>games</item>
300 <item>misc</item>
301 <item>meta</item>
302 <item>non-free</item>
303 </combobox>
304 <button>
305 <label>List</label>
306 <input file icon="reload"></input>
307 <action>echo "$MIRRORED_CAT" > /tmp/tazpkgbox/mirrored-category</action>
308 <action>refresh:GET</action>
309 </button>
310 </hbox>
311 </vbox>
313 <vbox>
314 <tree>
315 <width>620</width><height>240</height>
316 <variable>DEV</variable>
317 <label>Package name|Version|Description</label>
318 <input>/usr/lib/slitaz/tazpkgbox/list undigest</input>
319 <action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
320 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
321 <action>refresh:PKG</action>
322 <action>refresh:GETIT</action>
323 <action>refresh:PKG_STATS</action>
324 <action>refresh:CACHE_STATS</action>
325 </tree>
326 <hbox>
327 <button>
328 <label>Setup undigest mirrors</label>
329 <input file icon="go-next"></input>
330 <action type="launch">SETUP_UNDIGEST</action>
331 </button>
332 </hbox>
333 <hbox>
334 <text>
335 <label>"Undigest:"</label>
336 </text>
337 <combobox>
338 <variable>UNDIGEST_ENTRY</variable>
339 '
340 for i in all $(ls /var/lib/tazpkg/undigest 2> /dev/null); do
341 TAZPKG_DIALOG="$TAZPKG_DIALOG <item>$i</item> "
342 done
343 tmp=' </combobox>
344 <text>
345 <label>"Category:"</label>
346 </text>
347 <combobox>
348 <variable>UNDIGEST_CAT</variable>
349 <item>all</item>
350 <item>base-system</item>
351 <item>x-window</item>
352 <item>utilities</item>
353 <item>network</item>
354 <item>graphics</item>
355 <item>multimedia</item>
356 <item>office</item>
357 <item>development</item>
358 <item>system-tools</item>
359 <item>security</item>
360 <item>games</item>
361 <item>misc</item>
362 <item>meta</item>
363 <item>non-free</item>
364 </combobox>
365 <button>
366 <label>List</label>
367 <input file icon="reload"></input>
368 <action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY" > /tmp/tazpkgbox/undigest-category</action>
369 <action>refresh:DEV</action>
370 </button>
371 </hbox>
372 </vbox>
374 <vbox>
375 <tree>
376 <width>620</width><height>240</height>
377 <variable>BLOCKED</variable>
378 <label>Package name|Version|Available|Description</label>
379 <input>/usr/lib/slitaz/tazpkgbox/list blocked</input>
380 <action>echo "$BLOCKED" > /tmp/tazpkgbox/pkg</action>
381 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
382 <action>refresh:BLOCKED</action>
383 <action>refresh:PKG_STATS</action>
384 </tree>
385 <hbox>
386 <button>
387 <label>Refresh</label>
388 <input file icon="reload"></input>
389 <action>refresh:BLOCKED</action>
390 <action>refresh:PKG_STATS</action>
391 </button>
392 </hbox>
393 </vbox>
395 <vbox>
396 <tree icon="tazpkg">
397 <width>620</width><height>120</height>
398 <variable>RESULT_INSTALLED</variable>
399 <label>Installed packages|Version|Description / File</label>
400 <input>cat /tmp/tazpkgbox/search-installed</input>
401 <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
402 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
403 <action>/usr/lib/slitaz/tazpkgbox/search</action>
404 <action>refresh:RESULT_INSTALLED</action>
405 <action>refresh:PKG</action>
406 <action>refresh:PKG_STATS</action>
407 <action>refresh:CACHE_STATS</action>
408 </tree>
409 <tree icon="tazpkg">
410 <width>620</width><height>120</height>
411 <variable>RESULT_MIRROR</variable>
412 <label>Mirrored packages|Version|Description / File</label>
413 <input>cat /tmp/tazpkgbox/search-mirrored</input>
414 <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
415 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
416 <action>/usr/lib/slitaz/tazpkgbox/search</action>
417 <action>refresh:RESULT_INSTALLED</action>
418 <action>refresh:PKG</action>
419 <action>refresh:PKG_STATS</action>
420 <action>refresh:CACHE_STATS</action>
421 </tree>
422 <hbox>
423 <entry>
424 <variable>SEARCH</variable>
425 </entry>
426 <button>
427 <label>Search Packages</label>
428 <input file icon="system-search"></input>
429 <action>/usr/lib/slitaz/tazpkgbox/search</action>
430 <action>refresh:RESULT_INSTALLED</action>
431 <action>refresh:RESULT_MIRROR</action>
432 </button>
433 <button>
434 <label>Search Files</label>
435 <input file icon="system-search"></input>
436 <action>/usr/lib/slitaz/tazpkgbox/search --files</action>
437 <action>refresh:RESULT_INSTALLED</action>
438 <action>refresh:RESULT_MIRROR</action>
439 </button>
440 </hbox>
441 </vbox>
443 <vbox>
444 <frame Files and Cache directory>
445 <text use-markup="true" width-chars="60" wrap="false">
446 <label>"
447 Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>
448 The cache directory is used to store downloaded or repacked packages.
449 "</label>
450 </text>
451 <hbox>
452 <entry editable="false">
453 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
454 <variable>CACHE_STATS</variable>
455 </entry>
456 <button>
457 <label>Clean cache</label>
458 <input file icon="go-next"></input>
459 <action>rm -rf /var/cache/tazpkg/*</action>
460 <action>refresh:CACHE_STATS</action>
461 </button>
462 </hbox>
463 </frame>
464 <frame Mirror URL>
465 <hbox>
466 <entry>
467 <input>head -n 1 /var/lib/tazpkg/mirror</input>
468 <variable>MIRROR</variable>
469 </entry>
470 <button>
471 <label>Setup</label>
472 <input file icon="go-next"></input>
473 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
474 <action>clear:MIRROR</action>
475 <action>refresh:MIRROR</action>
476 </button>
477 <button>
478 <label>Add</label>
479 <input file icon="gtk-add"></input>
480 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
481 <action>clear:MIRROR</action>
482 <action>refresh:MIRROR</action>
483 </button>
484 </hbox>
485 </frame>
486 <hbox>
487 <frame Journal>
488 <hbox>
489 <button>
490 <label>Show journal</label>
491 <input file icon="find"></input>
492 <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>
493 </button>
494 </hbox>
495 </frame>
496 <frame Configuration files>
497 <hbox>
498 <button>
499 <label>Repack config</label>
500 <input file icon="edit-redo"></input>
501 <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>
502 </button>
503 <button>
504 <label>Config Files</label>
505 <input file icon="tazpkg"></input>
506 <action type="launch">LIST_CONFIG_FILES</action>
507 </button>
508 </hbox>
509 </frame>
510 <frame Packages check>
511 <hbox>
512 <button>
513 <label>Quick check</label>
514 <input file icon="go-next"></input>
515 <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>
516 </button>
517 <button>
518 <label>Full check</label>
519 <input file icon="go-next"></input>
520 <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>
521 </button>
522 </hbox>
523 </frame>
524 </hbox>
525 </vbox>
527 </notebook>
529 <hbox>
530 <text wrap="false">
531 <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>
532 <variable>PKG_STATS</variable>
533 </text>
534 </hbox>
536 <hbox>
537 <button>
538 <label>Recharge lists</label>
539 <input file icon="system-software-update"></input>
540 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
541 <action>refresh:DEV</action>
542 <action>refresh:GET</action>
543 <action>refresh:GETIT</action>
544 <action>refresh:PKG_STATS</action>
545 </button>
546 <button>
547 <label>Upgrade all</label>
548 <input file icon="system-software-update"></input>
549 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
550 <action>refresh:PKG</action>
551 <action>refresh:DEV</action>
552 <action>refresh:GET</action>
553 <action>refresh:GETIT</action>
554 <action>refresh:PKG_STATS</action>
555 <action>refresh:CACHE_STATS</action>
556 </button>
557 <button>
558 <label>Wok</label>
559 <input file icon="gtk-open"></input>
560 <action>firefox http://hg.slitaz.org/wok/file/</action>
561 </button>
562 <button help>
563 <label>Help</label>
564 <action type="launch">HELP</action>
565 </button>
566 <button>
567 <label>Exit</label>
568 <input file icon="exit"></input>
569 <action type="exit">Exit</action>
570 </button>
571 </hbox>
573 </vbox>
575 </window>
576 '
577 TAZPKG_DIALOG="$TAZPKG_DIALOG$tmp"
579 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
581 exit 0