tazpkg rev 82 2.1

Add Tazpkgbox (GUI)
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 09 17:26:35 2008 +0200 (2008-05-09)
parents dec437264c66
children 4892fb5eaa5f
files tazpkgbox
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tazpkgbox	Fri May 09 17:26:35 2008 +0200
     1.3 @@ -0,0 +1,305 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# GTKdialog interface to SliTaz Packages Manager aka Tazpkg. Functions
     1.7 +# path: /usr/lib/slitaz/tazpkgbox. Notes: Notebook tab are vbox, tab are 
     1.8 +# used to indent.
     1.9 +#
    1.10 +# (C) GNU gpl v3 - SliTaz GNU/Linux 2008.
    1.11 +#
    1.12 +VERSION=24080508
    1.13 +
    1.14 +# Tazpkgbox is only for root.
    1.15 +if test $(id -u) != 0 ; then
    1.16 +	exec subox tazpkgbox
    1.17 +	exit 0
    1.18 +fi
    1.19 +
    1.20 +# We need at least a mirror URL.
    1.21 +if [ ! -f /var/lib/tazpkg/mirror ]; then
    1.22 +	tazpkg >/dev/null
    1.23 +fi
    1.24 +
    1.25 +# Tmp dir and files used to get pkgs infos on the fly. Clean also
    1.26 +# list and search files to load less data and have a faster start.
    1.27 +mkdir -p /tmp/tazpkgbox
    1.28 +echo "all" > /tmp/tazpkgbox/installed-category
    1.29 +echo "all" > /tmp/tazpkgbox/mirrored-category
    1.30 +echo "" > /tmp/tazpkgbox/search-installed
    1.31 +echo "" > /tmp/tazpkgbox/search-mirrored
    1.32 +
    1.33 +# English/French help dialod.
    1.34 +export HELP='
    1.35 +<window title="Tazpkgbox Help" icon-name="help">
    1.36 +<vbox>
    1.37 +	<text use-markup="true" width-chars="54">
    1.38 +		<label>"
    1.39 +<b>Tazpkgbox - Packages Manager Help</b>"
    1.40 +		</label>
    1.41 +	</text>
    1.42 +	
    1.43 +	<frame English>
    1.44 +		<text wrap="false">
    1.45 +			<label>"
    1.46 +Tazpkgbox is a simple and easy to use interface to SliTaz
    1.47 +packages manager aka Tazpkg. You can install, remove, repack or
    1.48 +get packages by clicking on the package item. Search engine let
    1.49 +you find and install new applications in a few mouse click.
    1.50 +Downloaded and repacked are stored in: /var/cache/tazpkg"
    1.51 +			</label>
    1.52 +		</text>
    1.53 +	</frame>
    1.54 +	
    1.55 +	<frame Français>
    1.56 +		<text wrap="false">
    1.57 +			<label>"
    1.58 +Tazpkgbox est une interface graphique au gestionnaire de paquet
    1.59 +de Slitaz aka Tazpkg. Simple et facile à utiliser, vous pouvez 
    1.60 +installer, télécharger ou supprimer des paquet en double-cliquant
    1.61 +sur sa ligne. Les paquets téléchargés ou recréés sont stocké 
    1.62 +dans: /var/cache/tazpkg"
    1.63 +			</label>
    1.64 +		</text>
    1.65 +	</frame>
    1.66 +	
    1.67 +	<hbox>
    1.68 +		<button ok>
    1.69 +			<action type="closewindow">HELP</action>
    1.70 +		</button>
    1.71 +	</hbox>
    1.72 +</vbox>
    1.73 +</window>
    1.74 +'
    1.75 +
    1.76 +# Main dialog
    1.77 +export TAZPKG_DIALOG='
    1.78 +<window title="SliTaz Packages Manager" icon-name="package-x-generic">
    1.79 +<vbox>
    1.80 +
    1.81 +	<hbox>
    1.82 +		<text use-markup="true">
    1.83 +			<label>"<b>Packages Manager</b>"</label>
    1.84 +		</text>
    1.85 +		<pixmap>
    1.86 +			<input file>/usr/share/pixmaps/tazpkg.png</input>
    1.87 +		</pixmap>
    1.88 +	</hbox>
    1.89 +
    1.90 +	<notebook labels="Installed|Mirrored|Search|Configuration">
    1.91 +
    1.92 +	<vbox>
    1.93 +		<tree>
    1.94 +			<width>580</width><height>240</height>
    1.95 +			<variable>PKG</variable>
    1.96 +			<label>Package name|Version|Description</label>
    1.97 +			<input>/usr/lib/slitaz/tazpkgbox/list installed</input>
    1.98 +			<action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
    1.99 +			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
   1.100 +			<action>refresh:PKG</action>
   1.101 +			<action>refresh:PKG_STATS</action>
   1.102 +			<action>refresh:CACHE_STATS</action>
   1.103 +		</tree>
   1.104 +		<hbox>
   1.105 +			<text>
   1.106 +				<label>"Category:"</label>
   1.107 +			</text>
   1.108 +			<combobox>
   1.109 +				<variable>INSTALLED_CAT</variable>
   1.110 +				<item>all</item>
   1.111 +				<item>base-system</item>
   1.112 +				<item>utilities</item>
   1.113 +				<item>network</item>
   1.114 +				<item>graphics</item>
   1.115 +				<item>multimedia</item>
   1.116 +				<item>office</item>
   1.117 +				<item>development</item>
   1.118 +				<item>system-tools</item>
   1.119 +				<item>security</item>
   1.120 +				<item>games</item>
   1.121 +				<item>misc</item>
   1.122 +				<item>meta</item>
   1.123 +				<item>non-free</item>
   1.124 +			</combobox>
   1.125 +			<button>
   1.126 +				<label>List</label>
   1.127 +				<input file icon="reload"></input>
   1.128 +				<action>echo "$INSTALLED_CAT" > /tmp/tazpkgbox/installed-category</action>
   1.129 +				<action>refresh:PKG</action>
   1.130 +			</button>
   1.131 +			<button>
   1.132 +				<label>Upgrade all</label>
   1.133 +				<input file icon="system-software-update"></input>
   1.134 +				<action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2"</action>
   1.135 +				<action>refresh:PKG</action>
   1.136 +				<action>refresh:PKG_STATS</action>
   1.137 +				<action>refresh:CACHE_STATS</action>
   1.138 +			</button>
   1.139 +		</hbox>
   1.140 +	</vbox>
   1.141 +
   1.142 +	<vbox>
   1.143 +		<tree>
   1.144 +			<width>580</width><height>240</height>
   1.145 +			<variable>GET</variable>
   1.146 +			<label>Package name|Version|Description</label>
   1.147 +			<input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
   1.148 +			<action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
   1.149 +			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
   1.150 +			<action>refresh:PKG</action>
   1.151 +			<action>refresh:PKG_STATS</action>
   1.152 +			<action>refresh:CACHE_STATS</action>
   1.153 +		</tree>
   1.154 +		<hbox>
   1.155 +			<combobox>
   1.156 +				<variable>MIRRORED_CAT</variable>
   1.157 +				<item>all</item>
   1.158 +				<item>base-system</item>
   1.159 +				<item>utilities</item>
   1.160 +				<item>network</item>
   1.161 +				<item>graphics</item>
   1.162 +				<item>multimedia</item>
   1.163 +				<item>office</item>
   1.164 +				<item>development</item>
   1.165 +				<item>system-tools</item>
   1.166 +				<item>security</item>
   1.167 +				<item>games</item>
   1.168 +				<item>misc</item>
   1.169 +				<item>meta</item>
   1.170 +				<item>non-free</item>
   1.171 +			</combobox>
   1.172 +			<button>
   1.173 +				<label>List</label>
   1.174 +				<input file icon="reload"></input>
   1.175 +				<action>echo "$MIRRORED_CAT" > /tmp/tazpkgbox/mirrored-category</action>
   1.176 +				<action>refresh:GET</action>
   1.177 +			</button>
   1.178 +			<button>
   1.179 +				<label>Recharge list</label>
   1.180 +				<input file icon="system-software-update"></input>         
   1.181 +				<action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2"</action>
   1.182 +				<action>refresh:GET</action>
   1.183 +				<action>refresh:PKG_STATS</action>
   1.184 +			</button>
   1.185 +		</hbox>
   1.186 +	</vbox>
   1.187 +
   1.188 +	<vbox>
   1.189 +		<tree icon="tazpkg">
   1.190 +			<width>580</width><height>120</height>
   1.191 +			<variable>RESULT_INSTALLED</variable>
   1.192 +			<label>Installed packages|Version|Description</label>
   1.193 +			<input>cat /tmp/tazpkgbox/search-installed</input>
   1.194 +			<action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
   1.195 +			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
   1.196 +			<action>/usr/lib/slitaz/tazpkgbox/search</action>
   1.197 +			<action>refresh:RESULT_INSTALLED</action>
   1.198 +			<action>refresh:PKG</action>
   1.199 +			<action>refresh:PKG_STATS</action>
   1.200 +			<action>refresh:CACHE_STATS</action>
   1.201 +		</tree>
   1.202 +		<tree icon="tazpkg">
   1.203 +			<width>580</width><height>120</height>
   1.204 +			<variable>RESULT_MIRROR</variable>
   1.205 +			<label>Mirrored packages|Version|Description</label>
   1.206 +			<input>cat /tmp/tazpkgbox/search-mirrored</input>
   1.207 +			<action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
   1.208 +			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
   1.209 +			<action>/usr/lib/slitaz/tazpkgbox/search</action>
   1.210 +			<action>refresh:RESULT_INSTALLED</action>
   1.211 +			<action>refresh:PKG</action>
   1.212 +			<action>refresh:PKG_STATS</action>
   1.213 +			<action>refresh:CACHE_STATS</action>
   1.214 +		</tree>
   1.215 +		<hbox>
   1.216 +			<entry>
   1.217 +				<variable>SEARCH</variable>
   1.218 +			</entry>
   1.219 +			<button>
   1.220 +				<label>Search</label>
   1.221 +				<input file icon="system-search"></input>
   1.222 +				<action>/usr/lib/slitaz/tazpkgbox/search</action>
   1.223 +				<action>refresh:RESULT_INSTALLED</action>
   1.224 +				<action>refresh:RESULT_MIRROR</action>
   1.225 +			</button>
   1.226 +		</hbox>
   1.227 +	</vbox>
   1.228 +
   1.229 +	<vbox>
   1.230 +		<frame Cache directory>
   1.231 +			<text use-markup="true" width-chars="60">
   1.232 +				<label>
   1.233 +"The cache directory is used to store downloaded or repacked packages."
   1.234 +				</label>
   1.235 +			</text>       
   1.236 +			<hbox>
   1.237 +				<entry editable="false">
   1.238 +					<input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
   1.239 +					<variable>CACHE_STATS</variable>
   1.240 +				</entry>
   1.241 +				<button>
   1.242 +					<label>Clean cache</label>
   1.243 +					<input file icon="go-next"></input> 
   1.244 +					<action>rm -rf /var/cache/tazpkg/*</action>
   1.245 +					<action>refresh:CACHE_STATS</action>
   1.246 +				</button>
   1.247 +			</hbox>
   1.248 +		</frame>
   1.249 +		<frame Mirror URL>
   1.250 +			<hbox>
   1.251 +				<entry>
   1.252 +					<input>head -n 1 /var/lib/tazpkg/mirror</input>
   1.253 +					<variable>MIRROR</variable>
   1.254 +				</entry>
   1.255 +				<button>
   1.256 +					<label>Setup</label>
   1.257 +					<input file icon="go-next"></input>
   1.258 +					<action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
   1.259 +					<action>clear:MIRROR</action>
   1.260 +					<action>refresh:MIRROR</action>
   1.261 +				</button>
   1.262 +				<button>
   1.263 +					<label>Add</label>
   1.264 +					<input file icon="gtk-add"></input>
   1.265 +					<action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
   1.266 +					<action>clear:MIRROR</action>
   1.267 +					<action>refresh:MIRROR</action>
   1.268 +				</button>
   1.269 +			</hbox>
   1.270 +		</frame>
   1.271 +		<frame Files path>
   1.272 +			<text use-markup="true" width-chars="60">
   1.273 +				<label>
   1.274 +"Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>"
   1.275 +				</label>
   1.276 +			</text>
   1.277 +		</frame>
   1.278 +	</vbox>
   1.279 +
   1.280 +	</notebook>
   1.281 +
   1.282 +	<hbox>
   1.283 +		<text>
   1.284 +			<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 | wc -l` to upgrade "</input>
   1.285 +			<variable>PKG_STATS</variable>
   1.286 +		</text>
   1.287 +	</hbox>
   1.288 +
   1.289 +	<hbox>
   1.290 +		<button help>
   1.291 +			<label>Help</label>
   1.292 +			<action type="launch">HELP</action>
   1.293 +		</button>
   1.294 +		<button>
   1.295 +			<label>Exit</label>
   1.296 +			<input file icon="exit"></input>
   1.297 +			<action type="exit">Exit</action>
   1.298 +		</button>
   1.299 +	</hbox>
   1.300 +
   1.301 +</vbox>
   1.302 +
   1.303 +</window>
   1.304 +'
   1.305 +
   1.306 +gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
   1.307 +
   1.308 +exit 0