tazusb rev 125

tazusb-box: output comma
nds in a GTK box
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 15 19:07:56 2012 +0200 (2012-04-15)
parents bee939ce59f7
children dd5861613bb6
files tazusb-box
line diff
     1.1 --- a/tazusb-box	Sun Apr 15 17:41:46 2012 +0200
     1.2 +++ b/tazusb-box	Sun Apr 15 19:07:56 2012 +0200
     1.3 @@ -9,15 +9,20 @@
     1.4  
     1.5  # TazUSBbox is only for root.
     1.6  if test $(id -u) != 0 ; then
     1.7 -	exec tazbox su tazusbbox
     1.8 +	exec tazbox su tazusb-box
     1.9  	exit 0
    1.10  fi
    1.11  
    1.12 +title="TazUSB Box"
    1.13 +icon="usb-creator"
    1.14 +opts="--image=usb-creator --image-on-top --width=520 --center --on-top"
    1.15 +
    1.16  # I18n
    1.17  . /usr/bin/gettext.sh
    1.18  TEXTDOMAIN='tazusb-box'
    1.19  export TEXTDOMAIN
    1.20  
    1.21 +# Main text information
    1.22  info="$(gettext "<b>Generate SliTaz LiveUSB media and boot in RAM!</b> \
    1.23  Insert a LiveCD into the cdrom drive or use a local ISO image, select \
    1.24  the correct device and press OK.")
    1.25 @@ -27,18 +32,11 @@
    1.26  # Functions
    1.27  #
    1.28  
    1.29 -gen_live()
    1.30 -{
    1.31 -	[ -z "$DEVICE" ] && exit 0 
    1.32 -	if [ -n "$ISO_IMAGE" ]; then
    1.33 -		xterm -T "Tazusb gen-iso2usb" \
    1.34 -			-geometry 80x16 \
    1.35 -			-e "tazusb gen-iso2usb $ISO_IMAGE $DEVICE; exit 0"
    1.36 -	else
    1.37 -		xterm -T "Tazusb gen-liveusb" \
    1.38 -			-geometry 80x16 \
    1.39 -			-e "tazusb gen-liveusb $DEVICE; exit 0"
    1.40 -	fi
    1.41 +# Nice GTK output for commands.
    1.42 +output() {
    1.43 +	yad --text-info $opts --text="<b>$title</b>" \
    1.44 +		--height=260 --title="$title" --window-icon=$icon \
    1.45 +		--tail --margins=4 --button="Reboot:reboot" --button="gtk-close:0"
    1.46  }
    1.47  
    1.48  list_devices() {
    1.49 @@ -52,10 +50,8 @@
    1.50  
    1.51  # Main GUI box function with pure Yad spec
    1.52  tazusb_main() {
    1.53 -	yad --form --text="$info" --title="TazUSB Box" \
    1.54 -		--height=200 --width=500 --borders=4 \
    1.55 -		--image=usb-creator --image-on-top \
    1.56 -		--window-icon=usb-creator \
    1.57 +	yad --form $opts --text="$info" \
    1.58 +		--title="$title" --height=200 \
    1.59  		--field="$(gettext "ISO Image:")":FL \
    1.60  		--field="$(gettext "USB Media:")":CB \
    1.61  		" " "$(list_devices)"
    1.62 @@ -78,13 +74,10 @@
    1.63  	fi 
    1.64  	if echo "$main" | grep -q ".iso|"; then
    1.65  		iso=$(echo $main | cut -d "|" -f 1)
    1.66 -		terminal -T "Tazusb gen-iso2usb" \
    1.67 -			-geometry 80x16 \
    1.68 -			-e "tazusb gen-iso2usb $iso $dev; sleep 4; exit 0"
    1.69 +		yes "" | /usr/bin/tazusb gen-iso2usb $iso $dev --raw-out | output
    1.70 +		exit 0
    1.71  	else
    1.72 -		terminal -T "Tazusb gen-liveusb" \
    1.73 -			-geometry 80x16 \
    1.74 -			-e "tazusb gen-liveusb $dev; sleep 4; exit 0"
    1.75 +		yes "" | /usr/bin/tazusb gen-liveusb $dev --raw-out | output
    1.76  	fi
    1.77  }
    1.78