tazpkg rev 589
tazpkg-box: add support for tazpkg-url: tazpkg://url.to.repo/version/pkg.tazpkg
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Apr 13 02:10:29 2012 +0200 (2012-04-13) |
parents | b9c12aaeae87 |
children | 255cddc8eb36 |
files | tazpkg-box |
line diff
1.1 --- a/tazpkg-box Thu Apr 12 17:49:54 2012 +0000 1.2 +++ b/tazpkg-box Fri Apr 13 02:10:29 2012 +0200 1.3 @@ -9,16 +9,23 @@ 1.4 # Authors : Christophe Lincoln <pankso@slitaz.org> 1.5 # 1.6 1.7 +title=$(gettext "TazPKG Action") 1.8 icon="/usr/share/pixmaps/tazpkg.png" 1.9 +opts="--image=tazpkg --image-on-top --width=520 --center --on-top" 1.10 + 1.11 +# Nice GTK output for install and extract. 1.12 +output() { 1.13 + yad --text-info $opts --text="<b>$title</b>" \ 1.14 + --height=260 --title="$title" --window-icon=$icon \ 1.15 + --tail --margins=4 --button="gtk-close:0" 1.16 +} 1.17 1.18 # Main GUI box function with pure Yad spec 1.19 actions_main() { 1.20 - title=$(gettext "TazPKG actions") 1.21 text=$(gettext "Package name:") 1.22 - yad --text="$text <b>${pkg%.tazpkg}</b>" \ 1.23 - --title="$title" --width=480 --height=100 \ 1.24 - --center --on-top --window-icon=$icon \ 1.25 - --image="tazpkg" --image-on-top \ 1.26 + yad --text="$text <b>${pkg%.tazpkg}</b>" $opts \ 1.27 + --title="$title" --height=100 \ 1.28 + --window-icon=$icon --image-on-top \ 1.29 --button="Install:3" --button="Extract:2" \ 1.30 --button="gtk-close:1" 1.31 } 1.32 @@ -31,25 +38,31 @@ 1.33 # Deal with --button values 1.34 case $ret in 1.35 1) exit 0 ;; 1.36 - 2) tazpkg extract $pkg | $0 output ;; 1.37 - 3) tazpkg -i $pkg --forced | $0 output ;; 1.38 + 2) tazpkg extract $pkg | output ;; 1.39 + 3) tazpkg -i $pkg --forced | output ;; 1.40 esac 1.41 } 1.42 1.43 +# TazPKG URL Handler. 1.44 +dl_inst() { 1.45 + pkg=$(basename $url) 1.46 + gettext "Downloading: $pkg"; echo -e "\n" 1.47 + cd /tmp && wget $url 2>&1 1.48 + tazpkg -i $pkg --forced 2>&1 1.49 + rm -f $pkg 1.50 +} 1.51 + 1.52 # 1.53 # Script commands 1.54 # 1.55 1.56 case "$1" in 1.57 usage|help|-u|-h) 1.58 - echo "Usage: $(basename $0) [command] [pkg|cmd]" ;; 1.59 - output) 1.60 - # Nice GTK output for install and extract. 1.61 - sed -e s'/\[^Gm]*./ /g' -e s'/^=.*//' | \ 1.62 - yad --text-info \ 1.63 - --width=480 --height=260 --center --on-top \ 1.64 - --title="TazPKG" --window-icon=$icon \ 1.65 - --margins=4 --button="gtk-close:0" ;; 1.66 + echo "Usage: $(basename $0) [actions|url] [pkg]" ;; 1.67 + tazpkg://*) 1.68 + # TazPKG URL's handler. 1.69 + url="http://${1#tazpkg://}" 1.70 + dl_inst | output ;; 1.71 actions) 1.72 pkg=$(basename $2) 1.73 cd $(dirname $2)