tazusb rev 36

Add a tiny GUI to gen LiveUSB (tazusbbox)
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 20 01:38:24 2009 +0100 (2009-02-20)
parents 4b4a49e1d93d
children 0f20a4a82c78
files applications/tazusbbox.desktop tazusbbox
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/applications/tazusbbox.desktop	Fri Feb 20 01:38:24 2009 +0100
     1.3 @@ -0,0 +1,8 @@
     1.4 +[Desktop Entry]
     1.5 +Encoding=UTF-8
     1.6 +Name=Tazlito LiveUSB Tool
     1.7 +Name[fr]=Créer un LiveUSB
     1.8 +Exec=subox tazusbbox
     1.9 +Icon=media-flash
    1.10 +Type=Application
    1.11 +Categories=System;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tazusbbox	Fri Feb 20 01:38:24 2009 +0100
     2.3 @@ -0,0 +1,122 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# Tiny GTKdialog interface to SliTaz Live USB tool aka TazUSB.
     2.7 +#
     2.8 +# (c) 2009 SliTaz GNU/Linux - GNU gpl v3
     2.9 +#
    2.10 +
    2.11 +# TazUSBbox is only for root.
    2.12 +if test $(id -u) != 0 ; then
    2.13 +	exec subox tazusbbox
    2.14 +	exit 0
    2.15 +fi
    2.16 +
    2.17 +# Languages messages translations
    2.18 +
    2.19 +case $LANG in
    2.20 +	fr*)
    2.21 +		MAIN_MSG="
    2.22 +Générer un LiveUSB de SliTaz et démarrer! Insérer un LiveCD dans
    2.23 +le lecteur de cdrom, séléctionner le media et appuyer sur générer.
    2.24 +"
    2.25 +		GENERATE_BUTTON="Générer"
    2.26 +		EXIT_BUTTON="Quitter" ;;
    2.27 +	*)
    2.28 +		MAIN_MSG="
    2.29 +Generate SliTaz LiveUSB media and boot in RAM! Insert a LiveCD into
    2.30 +the cdrom driver, select the correct device and press Generate.
    2.31 +"
    2.32 +		GENERATE_BUTTON="Generate"
    2.33 +		EXIT_BUTTON="Exit" ;;
    2.34 +esac
    2.35 +
    2.36 +# Functions
    2.37 +
    2.38 +gen_live()
    2.39 +{
    2.40 +	[ -z "$DEVICE" ] && exit 0 
    2.41 +	if [ -n "$ISO_IMAGE" ]; then
    2.42 +		xterm -T "Tazusb gen-iso2usb" \
    2.43 +			-geometry 80x16 \
    2.44 +			-e "tazusb gen-iso2usb $ISO_IMAGE $DEVICE; \
    2.45 +			echo -e \"----\nPress ENTER to close...\"; read i; exit 0"
    2.46 +	else
    2.47 +		xterm -T "Tazusb gen-liveusb" \
    2.48 +			-geometry 80x16 \
    2.49 +			-e "tazusb gen-liveusb $DEVICE; \
    2.50 +			echo -e \"----\nPress ENTER to close...\"; read i; exit 0"
    2.51 +	fi
    2.52 +}
    2.53 +
    2.54 +box()
    2.55 +{
    2.56 +	MAIN_DIALOG="
    2.57 +<window title=\"TazUSB Box\" icon-name=\"media-flash\">
    2.58 +<vbox>
    2.59 +	
    2.60 +	<text width-chars=\"60\">
    2.61 +		<label>\"$MAIN_MSG\"</label>
    2.62 +	</text>
    2.63 +
    2.64 +	<frame ISO to USB (Optional default is CDROM)>
    2.65 +		<hbox>
    2.66 +			<text use-markup=\"true\">
    2.67 +				<label>\"<b>ISO image:</b>\"</label>
    2.68 +			</text>
    2.69 +			<entry accept=\"filename\">
    2.70 +				<label>Select an ISO image</label>
    2.71 +				<variable>ISO_IMAGE</variable>
    2.72 +			</entry>
    2.73 +			<button>
    2.74 +				<input file stock=\"gtk-open\"></input>
    2.75 +				<action type=\"fileselect\">ISO_IMAGE</action>
    2.76 +			</button>
    2.77 +		</hbox>
    2.78 +	</frame>
    2.79 +	
    2.80 +	<hbox>
    2.81 +		<text use-markup=\"true\">
    2.82 +			<label>\"<b>USB Media:</b>\"</label>
    2.83 +		</text>
    2.84 +		<combobox>
    2.85 +			<variable>DEVICE</variable>"
    2.86 +			if [ -d /proc/scsi/usb-storage ]; then
    2.87 +				MAIN_DIALOG=${MAIN_DIALOG}"
    2.88 +				<item></item>"
    2.89 +				for i in `blkid | cut -d ":" -f 1`; do
    2.90 +					MAIN_DIALOG=${MAIN_DIALOG}"
    2.91 +					<item>$i</item>"
    2.92 +				done
    2.93 +			else
    2.94 +				MAIN_DIALOG=${MAIN_DIALOG}"
    2.95 +				<item>Not found</item>"
    2.96 +			fi
    2.97 +			export MAIN_DIALOG=${MAIN_DIALOG}"
    2.98 +		</combobox>
    2.99 +	</hbox>
   2.100 +	<hbox>
   2.101 +		<button>
   2.102 +			<label>$GENERATE_BUTTON</label>
   2.103 +			<input file icon=\"forward\"></input>	
   2.104 +			<action>$0 gen_live</action>
   2.105 +			<action>clear:ISO_IMAGE</action>
   2.106 +		</button>
   2.107 +		<button>
   2.108 +			<label>$EXIT_BUTTON</label>
   2.109 +			<input file icon=\"exit\"></input>
   2.110 +			<action type=\"exit\">exit</action>
   2.111 +		</button>
   2.112 +	</hbox>
   2.113 +	
   2.114 +</vbox>
   2.115 +</window>"
   2.116 +	gtkdialog --center --program=MAIN_DIALOG #>/dev/null
   2.117 +}
   2.118 +
   2.119 +if [ -n "$1" ]; then
   2.120 +	$1
   2.121 +else
   2.122 +	box
   2.123 +fi
   2.124 +
   2.125 +exit 0