slitaz-tools view tinyutils/subox @ rev 445

gettextize subox and scpbox
author Christophe Lincoln <pankso@slitaz.org>
date Sat Mar 20 01:02:21 2010 +0100 (2010-03-20)
parents 8ec105954ae9
children 4fd7d6aa39f3
line source
1 #!/bin/sh
2 #
3 # Gtkdialog to execute program as root from a WM menu.
4 # (c) SliTaz GNU/Linux 2008-2010 - GNU gpl.
5 #
6 VERSION=20100314
8 # Usage.
9 if [ -z "$1" ]; then
10 echo "Slitaz subox version : $VERSION"
11 echo -e "\nUsage : subox program\n"
12 exit 0
13 fi
15 # Nothing to do if we are root
16 test $(id -u) = 0 && exec $@
18 # Include gettext helper script.
19 . /usr/bin/gettext.sh
21 # Export package name for gettext.
22 TEXTDOMAIN='subox'
23 export TEXTDOMAIN
25 # Keep command in an exported variable to be used by SU_DIALOG.
26 export SU_CMD=$@
28 # Main window and root password default entry set to 'root'.
29 export SU_DIALOG='
30 <window title="Subox" skip_taskbar_hint="true">
31 <vbox>
33 <text use-markup="true">
34 <label>"
35 <b>SliTaz - Subox</b>"
36 </label>
37 </text>
38 <text wrap="true" width-chars="64">
39 <label>"'`gettext "
40 Please enter root password (default root) to execute :"`' '$1'
41 "
42 </label>
43 </text>
45 <hbox>
46 <text use-markup="true">
47 <label>"'`gettext "<b>Administrator password :</b>"`'"</label>
48 </text>
49 <entry visibility="false">
50 <variable>PASSWD</variable>
51 </entry>
52 </hbox>
54 <hbox>
55 <button ok>
56 <action>echo $PASSWD | su -c "$SU_CMD" &</action>
57 <action type="closewindow">SU_DIALOG</action>
58 </button>
59 <button cancel></button>
60 </hbox>
62 </vbox>
63 </window>'
65 gtkdialog --center --program=SU_DIALOG
67 exit 0