tazusb view tazusbbox @ rev 57

Gettextize tazusbbox
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 19 21:31:14 2010 +0100 (2010-02-19)
parents 7ea3be71a573
children
line source
1 #!/bin/sh
2 #
3 # Tiny GTKdialog interface to SliTaz Live USB tool aka TazUSB.
4 #
5 # (c) 2010 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 # Include gettext helper script.
15 . /usr/bin/gettext.sh
17 # Export package name for gettext.
18 TEXTDOMAIN='tazusbbox'
19 export TEXTDOMAIN
21 # $BIN for functions.
22 export BIN=$0
24 # Functions
26 gen_live()
27 {
28 [ -z "$DEVICE" ] && exit 0
29 if [ -n "$ISO_IMAGE" ]; then
30 xterm -T "Tazusb gen-iso2usb" \
31 -geometry 80x16 \
32 -e "tazusb gen-iso2usb $ISO_IMAGE $DEVICE; exit 0"
33 else
34 xterm -T "Tazusb gen-liveusb" \
35 -geometry 80x16 \
36 -e "tazusb gen-liveusb $DEVICE; exit 0"
37 fi
38 }
40 box()
41 {
42 MAIN_DIALOG='
43 <window title="'`gettext "TazUSB Box"`'" icon-name="media-flash">
44 <vbox>
46 <text width-chars="60">
47 <label>"'`gettext "
48 Generate SliTaz LiveUSB media and boot in RAM! Insert a LiveCD into
49 the cdrom drive, select the correct device and press Generate.
50 "`'"</label>
51 </text>
53 <frame '`gettext "ISO to USB (Optional default is CDROM)"`'>
54 <hbox>
55 <text use-markup="true">
56 <label>"'`gettext "<b>ISO image:</b>"`'"</label>
57 </text>
58 <entry accept="filename">
59 <variable>ISO_IMAGE</variable>
60 </entry>
61 <button>
62 <input file icon="tazlito"></input>
63 <action type="fileselect">ISO_IMAGE</action>
64 </button>
65 </hbox>
66 </frame>
68 <hbox>
69 <text use-markup="true">
70 <label>"'`gettext "<b>USB Media:</b>"`'"</label>
71 </text>
72 <combobox>
73 <variable>DEVICE</variable>'
74 if [ -d /proc/scsi/usb-storage ]; then
75 MAIN_DIALOG=${MAIN_DIALOG}"
76 <item></item>"
77 for i in `blkid | cut -d ":" -f 1`; do
78 MAIN_DIALOG=${MAIN_DIALOG}"
79 <item>$i</item>"
80 done
81 else
82 MAIN_DIALOG=${MAIN_DIALOG}'
83 <item>'`gettext "Not found"`'</item>'
84 fi
85 export MAIN_DIALOG=${MAIN_DIALOG}'
86 </combobox>
87 </hbox>
88 <hbox>
89 <button>
90 <label>'`gettext "Generate"`'</label>
91 <input file icon="forward"></input>
92 <action>$BIN gen_live</action>
93 <action>clear:ISO_IMAGE</action>
94 </button>
95 <button>
96 <label>'`gettext "Exit"`'</label>
97 <input file icon="exit"></input>
98 <action type="exit">exit</action>
99 </button>
100 </hbox>
102 </vbox>
103 </window>'
104 gtkdialog --center --program=MAIN_DIALOG #>/dev/null
105 }
107 if [ -n "$1" ]; then
108 $1
109 else
110 box
111 fi
113 exit 0