tazusb diff tazusb-box @ rev 155
Update pt_BR.po
author | Claudinei Pereira <claudinei@slitaz.org> |
---|---|
date | Sat Mar 08 02:21:09 2014 +0000 (2014-03-08) |
parents | a5f5b6aad358 |
children | 8ddffadf56a6 |
line diff
1.1 --- a/tazusb-box Sun Apr 15 19:07:56 2012 +0200 1.2 +++ b/tazusb-box Sat Mar 08 02:21:09 2014 +0000 1.3 @@ -6,6 +6,7 @@ 1.4 # 1.5 # Authors : Christophe Lincoln <pankso@slitaz.org> 1.6 # 1.7 +. /lib/libtaz.sh 1.8 1.9 # TazUSBbox is only for root. 1.10 if test $(id -u) != 0 ; then 1.11 @@ -13,9 +14,12 @@ 1.12 exit 0 1.13 fi 1.14 1.15 +# We can specify an ISO on cmdline: tazusb-box --iso=/path/to/image.iso 1.16 +[ "$iso" ] || iso=" " 1.17 + 1.18 title="TazUSB Box" 1.19 -icon="usb-creator" 1.20 -opts="--image=usb-creator --image-on-top --width=520 --center --on-top" 1.21 +icon="/usr/share/pixmaps/slitaz-icon.png" 1.22 +opts="--window-icon=$icon --height=220 --width=520 --center --on-top" 1.23 1.24 # I18n 1.25 . /usr/bin/gettext.sh 1.26 @@ -34,9 +38,8 @@ 1.27 1.28 # Nice GTK output for commands. 1.29 output() { 1.30 - yad --text-info $opts --text="<b>$title</b>" \ 1.31 - --height=260 --title="$title" --window-icon=$icon \ 1.32 - --tail --margins=4 --button="Reboot:reboot" --button="gtk-close:0" 1.33 + yad --text-info $opts --title="$title" --tail --margins=4 \ 1.34 + --button="Reboot:reboot" --button="gtk-close:0" 1.35 } 1.36 1.37 list_devices() { 1.38 @@ -49,35 +52,35 @@ 1.39 } 1.40 1.41 # Main GUI box function with pure Yad spec 1.42 -tazusb_main() { 1.43 - yad --form $opts --text="$info" \ 1.44 - --title="$title" --height=200 \ 1.45 +usbbox_main() { 1.46 + yad --form $opts --title="$title" --text="$info" \ 1.47 + --image=usb-creator --image-on-top \ 1.48 --field="$(gettext "ISO Image:")":FL \ 1.49 --field="$(gettext "USB Media:")":CB \ 1.50 - " " "$(list_devices)" 1.51 + "$iso" "$(list_devices)" 1.52 } 1.53 1.54 # Handler 1.55 -tazusb() { 1.56 +usbbox() { 1.57 # Store box results 1.58 - main=$(tazusb_main) 1.59 - ret=$? 1.60 + main=$(usbbox_main) 1.61 + 1.62 # Deal with --button values 1.63 - case $ret in 1.64 + case $? in 1.65 1) exit 0 ;; 1.66 *) continue ;; 1.67 esac 1.68 + 1.69 # Deal with $main values. Exit if any device. 1.70 dev=$(echo $main | cut -d "|" -f 2) 1.71 if ! echo $dev | grep -q /dev; then 1.72 - exit 0 1.73 - fi 1.74 + echo "No device: exit" && exit 0 1.75 + fi 1.76 if echo "$main" | grep -q ".iso|"; then 1.77 iso=$(echo $main | cut -d "|" -f 1) 1.78 - yes "" | /usr/bin/tazusb gen-iso2usb $iso $dev --raw-out | output 1.79 - exit 0 1.80 + yes "" | tazusb gen-iso2usb $iso $dev --output=raw | output 1.81 else 1.82 - yes "" | /usr/bin/tazusb gen-liveusb $dev --raw-out | output 1.83 + yes "" | tazusb gen-liveusb $dev --output=raw | output 1.84 fi 1.85 } 1.86 1.87 @@ -87,9 +90,11 @@ 1.88 1.89 case "$1" in 1.90 usage) 1.91 - echo "Usage: $(basename $0) [command]" ;; 1.92 - *) 1.93 - tazusb ;; 1.94 + echo "Usage: $(basename $0) [list]" ;; 1.95 + list) 1.96 + list_devices ;; 1.97 + *) 1.98 + usbbox ;; 1.99 esac 1.100 1.101 exit 0