# HG changeset patch # User Christophe Lincoln # Date 1334275829 -7200 # Node ID 59ac27af090dc076e2c41e40f61e61c234d5728b # Parent b9c12aaeae873f9a0302a576ec030a4948c77054 tazpkg-box: add support for tazpkg-url: tazpkg://url.to.repo/version/pkg.tazpkg diff -r b9c12aaeae87 -r 59ac27af090d tazpkg-box --- a/tazpkg-box Thu Apr 12 17:49:54 2012 +0000 +++ b/tazpkg-box Fri Apr 13 02:10:29 2012 +0200 @@ -9,16 +9,23 @@ # Authors : Christophe Lincoln # +title=$(gettext "TazPKG Action") icon="/usr/share/pixmaps/tazpkg.png" +opts="--image=tazpkg --image-on-top --width=520 --center --on-top" + +# Nice GTK output for install and extract. +output() { + yad --text-info $opts --text="$title" \ + --height=260 --title="$title" --window-icon=$icon \ + --tail --margins=4 --button="gtk-close:0" +} # Main GUI box function with pure Yad spec actions_main() { - title=$(gettext "TazPKG actions") text=$(gettext "Package name:") - yad --text="$text ${pkg%.tazpkg}" \ - --title="$title" --width=480 --height=100 \ - --center --on-top --window-icon=$icon \ - --image="tazpkg" --image-on-top \ + yad --text="$text ${pkg%.tazpkg}" $opts \ + --title="$title" --height=100 \ + --window-icon=$icon --image-on-top \ --button="Install:3" --button="Extract:2" \ --button="gtk-close:1" } @@ -31,25 +38,31 @@ # Deal with --button values case $ret in 1) exit 0 ;; - 2) tazpkg extract $pkg | $0 output ;; - 3) tazpkg -i $pkg --forced | $0 output ;; + 2) tazpkg extract $pkg | output ;; + 3) tazpkg -i $pkg --forced | output ;; esac } +# TazPKG URL Handler. +dl_inst() { + pkg=$(basename $url) + gettext "Downloading: $pkg"; echo -e "\n" + cd /tmp && wget $url 2>&1 + tazpkg -i $pkg --forced 2>&1 + rm -f $pkg +} + # # Script commands # case "$1" in usage|help|-u|-h) - echo "Usage: $(basename $0) [command] [pkg|cmd]" ;; - output) - # Nice GTK output for install and extract. - sed -e s'/\[^Gm]*./ /g' -e s'/^=.*//' | \ - yad --text-info \ - --width=480 --height=260 --center --on-top \ - --title="TazPKG" --window-icon=$icon \ - --margins=4 --button="gtk-close:0" ;; + echo "Usage: $(basename $0) [actions|url] [pkg]" ;; + tazpkg://*) + # TazPKG URL's handler. + url="http://${1#tazpkg://}" + dl_inst | output ;; actions) pkg=$(basename $2) cd $(dirname $2)