slitaz-tools view tinyutils/subox @ rev 390
Add desktop file for Documentation --> GNU GPL
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Oct 01 21:38:06 2009 +0200 (2009-10-01) |
parents | f3862ca85e92 |
children | 722e05609654 |
line source
1 #! /bin/sh
2 #
3 # Gtkdialog to execute program as root from a WM menu.
4 # - SliTaz GNU/Linux 2008.
5 #
6 VERSION=20080113
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 $1
18 # Keep command in an exported variable to be used by SU_DIALOG.
19 export SU_CMD=$@
21 # Main window and root password default entry set to 'root'.
22 export SU_DIALOG='
23 <window title="Subox">
24 <vbox>
26 <text use-markup="true">
27 <label>"
28 <b>SliTaz - Subox</b>"
29 </label>
30 </text>
31 <text wrap="true" width-chars="48">
32 <label>"
33 Please enter root password to execute :"
34 </label>
35 </text>
36 <text>
37 <input>echo $SU_CMD</input>
38 </text>
40 <hbox>
41 <text use-markup="true">
42 <label>"<b>Root password :</b>"</label>
43 </text>
44 <entry visibility="false">
45 <default>root</default>
46 <variable>PASSWD</variable>
47 </entry>
48 </hbox>
50 <hbox>
51 <button ok>
52 <action>echo $PASSWD | su -c "$SU_CMD" &</action>
53 <action type="closewindow">SU_DIALOG</action>
54 </button>
55 <button cancel></button>
56 </hbox>
58 </vbox>
59 </window>
60 '
62 gtkdialog --center --program=SU_DIALOG
63 exit 0