tazpkg view tazpkgbox @ rev 353

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