tazpkg view tazpkgbox @ rev 323
Show search Description button
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Feb 23 10:12:13 2010 +0100 (2010-02-23) |
parents | 317b65f3d2a0 |
children | 50b4af64dff1 |
line source
1 #!/bin/sh
2 #
3 # GTKdialog interface to SliTaz Packages Manager aka Tazpkg. Notes:
4 # Notebook tab are vbox, tabs are used to indent and functions are
5 # split and found in $LIB.
6 #
7 # (C) GNU gpl v3 - SliTaz GNU/Linux 2010.
8 #
9 VERSION=3.2.1
11 # Functions path.
12 export LIB=/usr/lib/slitaz/tazpkgbox
14 # Tazpkgbox is only for root.
15 if test $(id -u) != 0 ; then
16 exec subox tazpkgbox
17 exit 0
18 fi
20 # We need at least a mirror URL.
21 if [ ! -f /var/lib/tazpkg/mirror ]; then
22 tazpkg >/dev/null
23 fi
25 RELEASE=$(cat /etc/slitaz-release)
26 case "$1" in
27 dliso)
28 echo "Downloading packages-$RELEASE.iso into $2..."
29 cd $2
30 for i in $(cat /var/lib/tazpkg/mirror) ; do
31 wget ${i%packages*}/iso/$RELEASE/packages-$RELEASE.iso && break
32 done
33 exit 0;;
34 instiso)
35 PKGSIGN="LABEL=\"packages-$RELEASE\" TYPE=\"iso9660\""
36 PKGDEV=$(blkid $2 | grep "$PKGSIGN" | cut -d: -f1)
37 [ -z "$PKGDEV$2" -a -L /dev/cdrom ] && PKGDEV=$(blkid /dev/cdrom | grep "$PKGSIGN" | cut -d: -f1)
38 if [ -n "$PKGDEV" ]; then
39 mkdir /packages 2> /dev/null
40 mount -t iso9660 -o ro $PKGDEV /packages
41 /packages/install.sh
42 fi
43 exit 0;;
44 esac
45 # Tmp dir and files used to get pkgs info on the fly. Clean also
46 # lists and searches for files to load less data and have a faster start.
47 mkdir -p /tmp/tazpkgbox
48 echo "all" > /tmp/tazpkgbox/status
49 echo "all" > /tmp/tazpkgbox/category
50 echo "all" > /tmp/tazpkgbox/undigest-category
51 echo "" > /tmp/tazpkgbox/search
53 # English/French help dialog.
54 export HELP='
55 <window title="Tazpkgbox Help" icon-name="help">
56 <vbox>
57 <text use-markup="true" width-chars="54">
58 <label>"
59 <b>Tazpkgbox - Packages Manager Help</b>"
60 </label>
61 </text>
63 <frame English>
64 <text wrap="false">
65 <label>"
66 Tazpkgbox is a simple and easy to use interface to the SliTaz
67 package manager - aka Tazpkg. You can install, remove, repack or
68 get packages by double-clicking on the package item. A Search engine
69 lets you find and install new applications in a few mouse clicks."
70 </label>
71 </text>
72 </frame>
74 <frame Français>
75 <text wrap="false">
76 <label>"
77 Tazpkgbox est une interface graphique au gestionnaire de paquet
78 de Slitaz aka Tazpkg. Simple et facile à utiliser, vous pouvez
79 installer, télécharger ou supprimer des paquets en double-cliquant
80 sur sa ligne. La fonction de recherche permet de facilement trouver
81 et installer des logiciels ou fichiers."
82 </label>
83 </text>
84 </frame>
86 <hbox>
87 <button ok>
88 <action type="closewindow">HELP</action>
89 </button>
90 </hbox>
91 </vbox>
92 </window>
93 '
95 FILES="$2"
96 [ "$1" = "list_config" ] || FILES=""
98 export SETUP_DVD="
99 <window title=\"Packages archive\" icon-name=\"media-cdrom\">
100 <vbox>
101 <text use-markup=\"true\" width-chars=\"54\">
102 <label>\"
103 <b>Tazpkgbox - Packages Archive Manager</b>\"
104 </label>
105 </text>
106 <frame English>
107 <text wrap=\"false\">
108 <label>\"
109 An ISO image with all $(cat /etc/slitaz-release) packages is available on Slitaz mirrors.
110 You can burn it onto a DVD or install it on an USB key and each
111 package becomes installable without an Internet connection.\"
112 </label>
113 </text>
114 </frame>
116 <frame Français>
117 <text wrap=\"false\">
118 <label>\"
119 Une image ISO installable sur clé USB ou gravable sur DVD est
120 disponible sur les mirroirs Slitaz. Elle contient tous les paquets
121 de la version $(cat /etc/slitaz-release) pour pouvoir installer des paquets sans
122 connexion Internet.\"
123 </label>
124 </text>
125 </frame>
126 <frame>
127 <hbox>
128 <text use-markup=\"true\">
129 <label>\"<b>ISO image : </b>\"</label>
130 </text>
131 <entry>
132 <variable>PKGISO</variable>
133 </entry>
134 <button>
135 <input file stock=\"gtk-open\"></input>
136 <action type=\"fileselect\">PKGISO</action>
137 </button>
138 <button>
139 <label>Install ISO</label>
140 <input file icon=\"go-jump\"></input>
141 <action>xterm -T \"Install ISO\" -geometry 80x16+120+120 -e \"tazpkgbox instiso \$PKGISO; sleep 2\" 2>/dev/null</action>
142 <action>refresh:PKG</action>
143 <action>refresh:PKG_STATS</action>
144 <action>refresh:CACHE_STATS</action>
145 </button>
146 </hbox>
147 </frame>
148 <hbox>
149 <button>
150 <label>Download ISO</label>
151 <input file icon=\"system-software-update\"></input>
152 <action>xterm -T \"Download ISO\" -geometry 80x16+120+120 -e \"tazpkgbox dliso /tmp; sleep 2\" 2>/dev/null</action>
153 </button>
154 <button>
155 <input file icon=\"media-cdrom\"></input>
156 <label>Burn DVD</label>
157 <action>burnbox</action>
158 </button>
159 <button>
160 <label>Install DVD/USB key</label>
161 <input file icon=\"go-jump\"></input>
162 <action>xterm -T \"Install DVD/USB key\" -geometry 80x16+120+120 -e \"tazpkgbox instiso; sleep 2\" 2>/dev/null</action>
163 <action>refresh:PKG</action>
164 <action>refresh:PKG_STATS</action>
165 <action>refresh:CACHE_STATS</action>
166 </button>
167 <button>
168 <input file icon=\"gtk-close\"></input>
169 <action type=\"closewindow\">SETUP_DVD</action>
170 </button>
171 </hbox>
172 </vbox>
173 </window>
174 "
176 export LIST_CONFIG_FILES="
177 <window title=\"configuration files\" icon-name=\"system-file-manager\">
178 <vbox>
179 <tree exported_column=\"5\">
180 <width>560</width><height>160</height>
181 <variable>CONF_FILE</variable>
182 <label>Access | User | Group | Size | Update Date | Name</label>
183 <input>tazpkg list-config --box $FILES</input>
184 <action>leafpad \$CONF_FILE</action>
185 </tree>
186 <hbox>
187 <text wrap=\"false\">
188 <label>
189 \"Only files with Update Date have been modified after package installation\"
190 </label>
191 </text>
192 <button>
193 <input file icon=\"gtk-close\"></input>
194 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
195 </button>
196 </hbox>
197 </vbox>
198 </window>
199 "
200 if [ "$1" = "list_config" ]; then
201 gtkdialog --center --program=LIST_CONFIG_FILES >/dev/null
202 exit 0
203 fi
205 export SETUP_UNDIGEST='
206 <window title="undigest mirrors" icon-name="tazpkg">
207 <vbox>
208 <tree>
209 <width>560</width><height>160</height>
210 <variable>UNDIGEST_LIST</variable>
211 <label>Name | URL</label>
212 <input>tazpkg list-undigest --box</input>
213 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_LIST; sleep 2"</action>
214 </tree>
215 <hbox>
216 <text>
217 <label>URL:</label>
218 </text>
219 <entry>
220 <variable>UNDIGEST_URL</variable>
221 </entry>
222 </hbox>
223 <hbox>
224 <text>
225 <label>Name:</label>
226 </text>
227 <entry>
228 <variable>UNDIGEST_NAME</variable>
229 </entry>
230 <button>
231 <label>Add</label>
232 <input file icon="gtk-add"></input>
233 <action>tazpkg add-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
234 <action>refresh:UNDIGEST_LIST</action>
235 </button>
236 <button>
237 <label>Remove</label>
238 <input file icon="gtk-remove"></input>
239 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_NAME; sleep 2"</action>
240 <action>refresh:UNDIGEST_LIST</action>
241 </button>
242 <button>
243 <label>Update</label>
244 <input file icon="reload"></input>
245 <action>tazpkg setup-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
246 <action>refresh:UNDIGEST_LIST</action>
247 </button>
248 <button>
249 <input file icon="gtk-close"></input>
250 <action type="closewindow">SETUP_UNDIGEST</action>
251 </button>
252 </hbox>
253 </vbox>
254 </window>
255 '
257 # Scan notification
258 desktopbox notify "Scanning packages database" 6 &
260 # Main dialog
261 export TAZPKG_DIALOG='
262 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
263 <vbox>
265 <hbox>
266 <text use-markup="true">
267 <label>"<b>Packages Manager</b>"</label>
268 </text>
269 <pixmap>
270 <input file>/usr/share/pixmaps/tazpkg.png</input>
271 </pixmap>
272 </hbox>
274 <notebook labels="Packages|Search|Undigest|Configuration">
276 <vbox>
277 <tree>
278 <width>620</width><height>240</height>
279 <variable>PKG</variable>
280 <label>Name|Version|Description</label>
281 <input icon_column="0">$LIB/list all</input>
282 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
283 <action>$LIB/package_infos</action>
284 <action>refresh:PKG</action>
285 <action>refresh:PKG_STATS</action>
286 <action>refresh:CACHE_STATS</action>
287 </tree>
288 <hbox>
289 <text>
290 <label>"Status:"</label>
291 </text>
292 <combobox>
293 <variable>STATUS</variable>
294 <item>all</item>
295 <item>installed</item>
296 <item>installable</item>
297 <item>blocked</item>
298 <item>upgradeable</item>
299 </combobox>
300 <text>
301 <label>"Category:"</label>
302 </text>
303 <combobox>
304 <variable>CAT</variable>
305 <item>all</item>
306 <item>base-system</item>
307 <item>x-window</item>
308 <item>utilities</item>
309 <item>network</item>
310 <item>graphics</item>
311 <item>multimedia</item>
312 <item>office</item>
313 <item>development</item>
314 <item>system-tools</item>
315 <item>security</item>
316 <item>games</item>
317 <item>misc</item>
318 <item>meta</item>
319 <item>non-free</item>
320 </combobox>
321 <button>
322 <label>List</label>
323 <input file icon="reload"></input>
324 <action>echo "$CAT" > /tmp/tazpkgbox/category</action>
325 <action>echo "$STATUS" > /tmp/tazpkgbox/status</action>
326 <action>refresh:PKG</action>
327 </button>
328 </hbox>
329 </vbox>
331 <vbox>
332 <tree>
333 <width>620</width><height>120</height>
334 <variable>RESULT</variable>
335 <label>Packages Name|Version|Description / File</label>
336 <input icon_column="0">cat /tmp/tazpkgbox/search</input>
337 <action>echo "$RESULT" > /tmp/tazpkgbox/pkg</action>
338 <action>$LIB/package_infos</action>
339 <action>$LIB/search packages</action>
340 <action>refresh:RESULT</action>
341 <action>refresh:PKG</action>
342 <action>refresh:PKG_STATS</action>
343 <action>refresh:CACHE_STATS</action>
344 </tree>
345 <hbox>
346 <entry>
347 <variable>SEARCH</variable>
348 </entry>
349 <button>
350 <label>Packages/Description</label>
351 <input file icon="system-search"></input>
352 <action>$LIB/search packages</action>
353 <action>refresh:RESULT</action>
354 </button>
355 <button>
356 <label>Files</label>
357 <input file icon="system-search"></input>
358 <action>$LIB/search files</action>
359 <action>refresh:RESULT</action>
360 </button>
361 '
362 tmp='
363 <button>
364 <label>Tags</label>
365 <input file icon="system-search"></input>
366 <action>$LIB/search tags</action>
367 <action>refresh:RESULT</action>
368 </button>
369 '
370 [ -d /home/slitaz/wok ] && TAZPKG_DIALOG="$TAZPKG_DIALOG $tmp"
371 tmp='
372 </hbox>
373 </vbox>
375 <vbox>
376 <tree>
377 <width>620</width><height>240</height>
378 <variable>DEV</variable>
379 <label>Name|Version|Description</label>
380 <input icon_column="0">$LIB/list undigest</input>
381 <action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
382 <action>$LIB/package_infos</action>
383 <action>refresh:PKG</action>
384 <action>refresh:PKG_STATS</action>
385 <action>refresh:CACHE_STATS</action>
386 </tree>
387 <hbox>
388 <text>
389 <label>"Undigest:"</label>
390 </text>
391 <combobox>
392 <variable>UNDIGEST_ENTRY</variable>
393 '
394 TAZPKG_DIALOG="$TAZPKG_DIALOG $tmp"
395 for i in all $(ls /var/lib/tazpkg/undigest 2> /dev/null); do
396 TAZPKG_DIALOG="$TAZPKG_DIALOG <item>$i</item> "
397 done
398 tmp=' </combobox>
399 <button>
400 <label>Setup undigest mirrors</label>
401 <input file icon="go-next"></input>
402 <action type="launch">SETUP_UNDIGEST</action>
403 </button>
404 </hbox>
405 <hbox>
406 <text>
407 <label>"Status:"</label>
408 </text>
409 <combobox>
410 <variable>UNDIGEST_STATUS</variable>
411 <item>all</item>
412 <item>installed</item>
413 <item>installable</item>
414 <item>blocked</item>
415 <item>upgradeable</item>
416 </combobox>
417 <text>
418 <label>"Category:"</label>
419 </text>
420 <combobox>
421 <variable>UNDIGEST_CAT</variable>
422 <item>all</item>
423 <item>base-system</item>
424 <item>x-window</item>
425 <item>utilities</item>
426 <item>network</item>
427 <item>graphics</item>
428 <item>multimedia</item>
429 <item>office</item>
430 <item>development</item>
431 <item>system-tools</item>
432 <item>security</item>
433 <item>games</item>
434 <item>misc</item>
435 <item>meta</item>
436 <item>non-free</item>
437 </combobox>
438 <button>
439 <label>List</label>
440 <input file icon="reload"></input>
441 <action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY $UNDIGEST_STATUS" > /tmp/tazpkgbox/undigest-category</action>
442 <action>refresh:DEV</action>
443 </button>
444 </hbox>
445 </vbox>
447 <vbox>
448 <frame Files and Cache directory>
449 <text use-markup="true" width-chars="60" wrap="false">
450 <label>"
451 Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>
452 The cache directory is used to store downloaded or repacked packages.
453 "</label>
454 </text>
455 <hbox>
456 <entry editable="false">
457 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
458 <variable>CACHE_STATS</variable>
459 </entry>
460 <button>
461 <label>Clean cache</label>
462 <input file icon="go-next"></input>
463 <action>rm -rf /var/cache/tazpkg/*</action>
464 <action>refresh:CACHE_STATS</action>
465 </button>
466 </hbox>
467 </frame>
468 <frame Mirror URL>
469 <hbox>
470 <entry>
471 <input>head -n 1 /var/lib/tazpkg/mirror</input>
472 <variable>MIRROR</variable>
473 </entry>
474 <button>
475 <label>Setup</label>
476 <input file icon="go-next"></input>
477 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
478 <action>clear:MIRROR</action>
479 <action>refresh:MIRROR</action>
480 </button>
481 <button>
482 <label>Add</label>
483 <input file icon="gtk-add"></input>
484 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
485 <action>clear:MIRROR</action>
486 <action>refresh:MIRROR</action>
487 </button>
488 <button>
489 <input file icon="media-cdrom"></input>
490 <label>DVD</label>
491 <action type="launch">SETUP_DVD</action>
492 </button>
493 </hbox>
494 </frame>
495 <hbox>
496 <frame Journal>
497 <hbox>
498 <button>
499 <label>Show journal</label>
500 <input file icon="find"></input>
501 <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>
502 </button>
503 </hbox>
504 </frame>
505 <frame Configuration files>
506 <hbox>
507 <button>
508 <label>Repack config</label>
509 <input file icon="edit-redo"></input>
510 <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>
511 </button>
512 <button>
513 <label>Config Files</label>
514 <input file icon="tazpkg"></input>
515 <action type="launch">LIST_CONFIG_FILES</action>
516 </button>
517 </hbox>
518 </frame>
519 <frame Packages check>
520 <hbox>
521 <button>
522 <label>Quick check</label>
523 <input file icon="go-next"></input>
524 <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>
525 </button>
526 <button>
527 <label>Full check</label>
528 <input file icon="go-next"></input>
529 <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>
530 </button>
531 </hbox>
532 </frame>
533 </hbox>
534 </vbox>
536 </notebook>
538 <hbox>
539 <text wrap="false" width-chars="82">
540 <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 -n "Packages statistics: $installed installed, $blocked blocked, $installable installable, $undigest undigest, $mirrored mirrored, `cat /var/lib/tazpkg/upgradeable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
541 <variable>PKG_STATS</variable>
542 </text>
543 </hbox>
545 <hbox>
546 <button>
547 <label>Recharge lists</label>
548 <input file icon="system-software-update"></input>
549 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge ; tazpkg upgradeable" 2>/dev/null</action>
550 <action>refresh:DEV</action>
551 <action>refresh:PKG</action>
552 <action>refresh:PKG_STATS</action>
553 <action>refresh:CACHE_STATS</action>
554 </button>
555 <button>
556 <label>Upgrade all</label>
557 <input file icon="system-software-update"></input>
558 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
559 <action>refresh:PKG</action>
560 <action>refresh:DEV</action>
561 <action>refresh:PKG_STATS</action>
562 <action>refresh:CACHE_STATS</action>
563 </button>
564 <button>
565 <label>Wok</label>
566 <input file icon="gtk-open"></input>
567 <action>firefox http://hg.slitaz.org/wok/file/</action>
568 </button>
569 <button help>
570 <label>Help</label>
571 <action type="launch">HELP</action>
572 </button>
573 <button>
574 <label>Exit</label>
575 <input file icon="exit"></input>
576 <action type="exit">Exit</action>
577 </button>
578 </hbox>
580 </vbox>
582 </window>
583 '
584 TAZPKG_DIALOG="$TAZPKG_DIALOG$tmp"
586 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
588 exit 0