tazusb view tazusbbox @ rev 40
tazusbbox: remove double anser to close xterm
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Mar 03 02:53:29 2009 +0100 (2009-03-03) |
parents | d020915532df |
children | 7ea3be71a573 |
line source
1 #!/bin/sh
2 #
3 # Tiny GTKdialog interface to SliTaz Live USB tool aka TazUSB.
4 #
5 # (c) 2009 SliTaz GNU/Linux - GNU gpl v3
6 #
8 # TazUSBbox is only for root.
9 if test $(id -u) != 0 ; then
10 exec subox tazusbbox
11 exit 0
12 fi
14 # Languages messages translations
16 case $LANG in
17 fr*)
18 MAIN_MSG="
19 Générer un LiveUSB de SliTaz et démarrer! Insérer un LiveCD dans
20 le lecteur de cdrom, séléctionner le media et appuyer sur générer.
21 "
22 GENERATE_BUTTON="Générer"
23 EXIT_BUTTON="Quitter" ;;
24 *)
25 MAIN_MSG="
26 Generate SliTaz LiveUSB media and boot in RAM! Insert a LiveCD into
27 the cdrom driver, select the correct device and press Generate.
28 "
29 GENERATE_BUTTON="Generate"
30 EXIT_BUTTON="Exit" ;;
31 esac
33 # Functions
35 gen_live()
36 {
37 [ -z "$DEVICE" ] && exit 0
38 if [ -n "$ISO_IMAGE" ]; then
39 xterm -T "Tazusb gen-iso2usb" \
40 -geometry 80x16 \
41 -e "tazusb gen-iso2usb $ISO_IMAGE $DEVICE; exit 0"
42 else
43 xterm -T "Tazusb gen-liveusb" \
44 -geometry 80x16 \
45 -e "tazusb gen-liveusb $DEVICE; exit 0"
46 fi
47 }
49 box()
50 {
51 MAIN_DIALOG="
52 <window title=\"TazUSB Box\" icon-name=\"media-flash\">
53 <vbox>
55 <text width-chars=\"60\">
56 <label>\"$MAIN_MSG\"</label>
57 </text>
59 <frame ISO to USB (Optional default is CDROM)>
60 <hbox>
61 <text use-markup=\"true\">
62 <label>\"<b>ISO image:</b>\"</label>
63 </text>
64 <entry accept=\"filename\">
65 <label>Select an ISO image</label>
66 <variable>ISO_IMAGE</variable>
67 </entry>
68 <button>
69 <input file stock=\"gtk-open\"></input>
70 <action type=\"fileselect\">ISO_IMAGE</action>
71 </button>
72 </hbox>
73 </frame>
75 <hbox>
76 <text use-markup=\"true\">
77 <label>\"<b>USB Media:</b>\"</label>
78 </text>
79 <combobox>
80 <variable>DEVICE</variable>"
81 if [ -d /proc/scsi/usb-storage ]; then
82 MAIN_DIALOG=${MAIN_DIALOG}"
83 <item></item>"
84 for i in `blkid | cut -d ":" -f 1`; do
85 MAIN_DIALOG=${MAIN_DIALOG}"
86 <item>$i</item>"
87 done
88 else
89 MAIN_DIALOG=${MAIN_DIALOG}"
90 <item>Not found</item>"
91 fi
92 export MAIN_DIALOG=${MAIN_DIALOG}"
93 </combobox>
94 </hbox>
95 <hbox>
96 <button>
97 <label>$GENERATE_BUTTON</label>
98 <input file icon=\"forward\"></input>
99 <action>$0 gen_live</action>
100 <action>clear:ISO_IMAGE</action>
101 </button>
102 <button>
103 <label>$EXIT_BUTTON</label>
104 <input file icon=\"exit\"></input>
105 <action type=\"exit\">exit</action>
106 </button>
107 </hbox>
109 </vbox>
110 </window>"
111 gtkdialog --center --program=MAIN_DIALOG #>/dev/null
112 }
114 if [ -n "$1" ]; then
115 $1
116 else
117 box
118 fi
120 exit 0