tazpkg view tazpkgbox @ rev 139

rename save-config to repack-config, add list-config, update tazpkgbox
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jul 28 09:20:59 2008 +0000 (2008-07-28)
parents 3ad89c4852fb
children a954c610e384
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.3
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 if [ "$1" == "call" ]; then
23 case "$2" in
24 list_config_files)
25 tazpkg list-config | awk '
26 BEGIN { ls=0 } {
27 if (/^===/) ls=1-ls;
28 else if (ls) system("stat -c \"%A|%U|%G|%s|%n\" " $0);
29 }'
30 exit 0;;
31 *) echo "Invalid argument";;
32 esac
33 exit 1
34 fi
36 # Tmp dir and files used to get pkgs infos on the fly. Clean also
37 # list and search files to load less data and have a faster start.
38 mkdir -p /tmp/tazpkgbox
39 echo "all" > /tmp/tazpkgbox/installed-category
40 echo "all" > /tmp/tazpkgbox/installable-category
41 echo "all" > /tmp/tazpkgbox/mirrored-category
42 echo "" > /tmp/tazpkgbox/search-installed
43 echo "" > /tmp/tazpkgbox/search-mirrored
45 # English/French help dialod.
46 export HELP='
47 <window title="Tazpkgbox Help" icon-name="help">
48 <vbox>
49 <text use-markup="true" width-chars="54">
50 <label>"
51 <b>Tazpkgbox - Packages Manager Help</b>"
52 </label>
53 </text>
55 <frame English>
56 <text wrap="false">
57 <label>"
58 Tazpkgbox is a simple and easy to use interface to the SliTaz
59 package manager - aka Tazpkg. You can install, remove, repack or
60 get packages by double-clicking on the package item. A Search engine
61 lets you find and install new applications in a few mouse clicks.
63 Downloaded and repacked packages are stored in: /var/cache/tazpkg"
64 </label>
65 </text>
66 </frame>
68 <frame Français>
69 <text wrap="false">
70 <label>"
71 Tazpkgbox est une interface graphique au gestionnaire de paquet
72 de Slitaz aka Tazpkg. Simple et facile à utiliser, vous pouvez
73 installer, télécharger ou supprimer des paquet en double-cliquant
74 sur sa ligne. Les paquets téléchargés ou recréés sont stocké
75 dans: /var/cache/tazpkg"
76 </label>
77 </text>
78 </frame>
80 <hbox>
81 <button ok>
82 <action type="closewindow">HELP</action>
83 </button>
84 </hbox>
85 </vbox>
86 </window>
87 '
89 export LIST_CONFIG_FILES="
90 <window title=\"configuration files\" icon-name=\"system-file-manager\">
91 <vbox>
92 <tree>
93 <width>600</width><height>160</height>
94 <label>Access | User | Group | Size | Name</label>
95 <input> $0 call list_config_files </input>
96 </tree>
97 <hbox>
98 <button>
99 <input file icon=\"gtk-close\"></input>
100 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
101 </button>
102 </hbox>
103 </vbox>
104 </window>
105 "
107 # Main dialog
108 export TAZPKG_DIALOG='
109 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
110 <vbox>
112 <hbox>
113 <text use-markup="true">
114 <label>"<b>Packages Manager</b>"</label>
115 </text>
116 <pixmap>
117 <input file>/usr/share/pixmaps/tazpkg.png</input>
118 </pixmap>
119 </hbox>
121 <notebook labels="Installed|Installable|Mirrored|Search|Configuration">
123 <vbox>
124 <tree>
125 <width>620</width><height>240</height>
126 <variable>PKG</variable>
127 <label>Package name|Version|Description</label>
128 <input>/usr/lib/slitaz/tazpkgbox/list installed</input>
129 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
130 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
131 <action>refresh:PKG</action>
132 <action>refresh:PKG_STATS</action>
133 <action>refresh:CACHE_STATS</action>
134 </tree>
135 <hbox>
136 <text>
137 <label>"Category:"</label>
138 </text>
139 <combobox>
140 <variable>INSTALLED_CAT</variable>
141 <item>all</item>
142 <item>base-system</item>
143 <item>utilities</item>
144 <item>network</item>
145 <item>graphics</item>
146 <item>multimedia</item>
147 <item>office</item>
148 <item>development</item>
149 <item>system-tools</item>
150 <item>security</item>
151 <item>games</item>
152 <item>misc</item>
153 <item>meta</item>
154 <item>non-free</item>
155 </combobox>
156 <button>
157 <label>List</label>
158 <input file icon="reload"></input>
159 <action>echo "$INSTALLED_CAT" > /tmp/tazpkgbox/installed-category</action>
160 <action>refresh:PKG</action>
161 </button>
162 <button>
163 <label>Upgrade all</label>
164 <input file icon="system-software-update"></input>
165 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
166 <action>refresh:PKG</action>
167 <action>refresh:PKG_STATS</action>
168 <action>refresh:CACHE_STATS</action>
169 </button>
170 </hbox>
171 </vbox>
173 <vbox>
174 <tree>
175 <width>620</width><height>240</height>
176 <variable>GETIT</variable>
177 <label>Package name|Version|Description</label>
178 <input>/usr/lib/slitaz/tazpkgbox/list installable</input>
179 <action>echo "$GETIT" > /tmp/tazpkgbox/pkg</action>
180 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
181 <action>refresh:PKG</action>
182 <action>refresh:GETIT</action>
183 <action>refresh:PKG_STATS</action>
184 <action>refresh:CACHE_STATS</action>
185 </tree>
186 <hbox>
187 <text>
188 <label>"Category:"</label>
189 </text>
190 <combobox>
191 <variable>INSTALLABLE_CAT</variable>
192 <item>all</item>
193 <item>base-system</item>
194 <item>utilities</item>
195 <item>network</item>
196 <item>graphics</item>
197 <item>multimedia</item>
198 <item>office</item>
199 <item>development</item>
200 <item>system-tools</item>
201 <item>security</item>
202 <item>games</item>
203 <item>misc</item>
204 <item>meta</item>
205 <item>non-free</item>
206 </combobox>
207 <button>
208 <label>List</label>
209 <input file icon="reload"></input>
210 <action>echo "$INSTALLABLE_CAT" > /tmp/tazpkgbox/installable-category</action>
211 <action>refresh:GETIT</action>
212 </button>
213 <button>
214 <label>Recharge list</label>
215 <input file icon="system-software-update"></input>
216 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
217 <action>refresh:GETIT</action>
218 <action>refresh:PKG_STATS</action>
219 </button>
220 </hbox>
221 </vbox>
223 <vbox>
224 <tree>
225 <width>620</width><height>240</height>
226 <variable>GET</variable>
227 <label>Package name|Version|Description</label>
228 <input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
229 <action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
230 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
231 <action>refresh:PKG</action>
232 <action>refresh:PKG_STATS</action>
233 <action>refresh:CACHE_STATS</action>
234 </tree>
235 <hbox>
236 <combobox>
237 <variable>MIRRORED_CAT</variable>
238 <item>all</item>
239 <item>base-system</item>
240 <item>utilities</item>
241 <item>network</item>
242 <item>graphics</item>
243 <item>multimedia</item>
244 <item>office</item>
245 <item>development</item>
246 <item>system-tools</item>
247 <item>security</item>
248 <item>games</item>
249 <item>misc</item>
250 <item>meta</item>
251 <item>non-free</item>
252 </combobox>
253 <button>
254 <label>List</label>
255 <input file icon="reload"></input>
256 <action>echo "$MIRRORED_CAT" > /tmp/tazpkgbox/mirrored-category</action>
257 <action>refresh:GET</action>
258 </button>
259 <button>
260 <label>Recharge list</label>
261 <input file icon="system-software-update"></input>
262 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
263 <action>refresh:GET</action>
264 <action>refresh:PKG_STATS</action>
265 </button>
266 </hbox>
267 </vbox>
269 <vbox>
270 <tree icon="tazpkg">
271 <width>620</width><height>120</height>
272 <variable>RESULT_INSTALLED</variable>
273 <label>Installed packages|Version|Description / File</label>
274 <input>cat /tmp/tazpkgbox/search-installed</input>
275 <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
276 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
277 <action>/usr/lib/slitaz/tazpkgbox/search</action>
278 <action>refresh:RESULT_INSTALLED</action>
279 <action>refresh:PKG</action>
280 <action>refresh:PKG_STATS</action>
281 <action>refresh:CACHE_STATS</action>
282 </tree>
283 <tree icon="tazpkg">
284 <width>620</width><height>120</height>
285 <variable>RESULT_MIRROR</variable>
286 <label>Mirrored packages|Version|Description / File</label>
287 <input>cat /tmp/tazpkgbox/search-mirrored</input>
288 <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
289 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
290 <action>/usr/lib/slitaz/tazpkgbox/search</action>
291 <action>refresh:RESULT_INSTALLED</action>
292 <action>refresh:PKG</action>
293 <action>refresh:PKG_STATS</action>
294 <action>refresh:CACHE_STATS</action>
295 </tree>
296 <hbox>
297 <entry>
298 <variable>SEARCH</variable>
299 </entry>
300 <button>
301 <label>Search Packages</label>
302 <input file icon="system-search"></input>
303 <action>/usr/lib/slitaz/tazpkgbox/search</action>
304 <action>refresh:RESULT_INSTALLED</action>
305 <action>refresh:RESULT_MIRROR</action>
306 </button>
307 <button>
308 <label>Search Files</label>
309 <input file icon="system-search"></input>
310 <action>/usr/lib/slitaz/tazpkgbox/search --files</action>
311 <action>refresh:RESULT_INSTALLED</action>
312 <action>refresh:RESULT_MIRROR</action>
313 </button>
314 </hbox>
315 </vbox>
317 <vbox>
318 <frame Cache directory>
319 <text use-markup="true" width-chars="60">
320 <label>
321 "The cache directory is used to store downloaded or repacked packages."
322 </label>
323 </text>
324 <hbox>
325 <entry editable="false">
326 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
327 <variable>CACHE_STATS</variable>
328 </entry>
329 <button>
330 <label>Clean cache</label>
331 <input file icon="go-next"></input>
332 <action>rm -rf /var/cache/tazpkg/*</action>
333 <action>refresh:CACHE_STATS</action>
334 </button>
335 </hbox>
336 </frame>
337 <frame Mirror URL>
338 <hbox>
339 <entry>
340 <input>head -n 1 /var/lib/tazpkg/mirror</input>
341 <variable>MIRROR</variable>
342 </entry>
343 <button>
344 <label>Setup</label>
345 <input file icon="go-next"></input>
346 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
347 <action>clear:MIRROR</action>
348 <action>refresh:MIRROR</action>
349 </button>
350 <button>
351 <label>Add</label>
352 <input file icon="gtk-add"></input>
353 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
354 <action>clear:MIRROR</action>
355 <action>refresh:MIRROR</action>
356 </button>
357 </hbox>
358 </frame>
359 <frame Files path, configuration files and packages check>
360 <hbox>
361 <text use-markup="true" width-chars="60">
362 <label>
363 "Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>"
364 </label>
365 </text>
366 </hbox>
367 <hbox>
368 <button>
369 <label>Repack config</label>
370 <input file icon="edit-redo"></input>
371 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Repack configs" -geometry 80x25+120+120 -e "tazpkg repack-config ; sleep 2" 2> /dev/null</action>
372 </button>
373 <button>
374 <label>Config Files</label>
375 <input file icon="tazpkg"></input>
376 <action type="launch">LIST_CONFIG_FILES</action>
377 </button>
378 <button>
379 <label>Quick check</label>
380 <input file icon="go-next"></input>
381 <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>
382 </button>
383 <button>
384 <label>Full check</label>
385 <input file icon="go-next"></input>
386 <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>
387 </button>
388 </hbox>
389 </frame>
390 </vbox>
392 </notebook>
394 <hbox>
395 <text>
396 <input>echo "Packages: `ls /var/lib/tazpkg/installed | wc -l` installed, `cat /var/lib/tazpkg/packages.list | wc -l` mirrored, `cat /var/lib/tazpkg/upradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
397 <variable>PKG_STATS</variable>
398 </text>
399 </hbox>
401 <hbox>
402 <button>
403 <label>Wok</label>
404 <input file icon="gtk-open"></input>
405 <action>firefox http://hg.slitaz.org/wok/file/</action>
406 </button>
407 <button help>
408 <label>Help</label>
409 <action type="launch">HELP</action>
410 </button>
411 <button>
412 <label>Exit</label>
413 <input file icon="exit"></input>
414 <action type="exit">Exit</action>
415 </button>
416 </hbox>
418 </vbox>
420 </window>
421 '
423 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
425 exit 0