slitaz-tools view tinyutils/subox @ rev 158

Modified tazx for Openbox as default WM
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 22 22:58:03 2008 +0200 (2008-04-22)
parents adb072794713
children 7f10b236e5a3
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 # Keep binary name in a tmp file to be used by SU_DIALOG.
16 echo "$1" > /tmp/subox-exec
18 # Main window and root passord default entry set to 'root'.
19 export SU_DIALOG='
20 <window title="Subox">
21 <vbox>
23 <text use-markup="true">
24 <label>
25 "
26 <b>SliTaz - Subox</b>"
27 </label>
28 </text>
29 <text wrap="true" width-chars="46">
30 <label>
31 "
32 Please enter root password to execute :"
33 </label>
34 </text>
35 <text>
36 <input file>/tmp/subox-exec</input>
37 </text>
39 <hbox>
40 <text use-markup="true">
41 <label>"<b>Root password :</b>"</label>
42 </text>
43 <entry visibility="false">
44 <default>root</default>
45 <variable>PASSWD</variable>
46 </entry>
47 </hbox>
49 <hbox>
50 <button ok>
51 <action>echo $PASSWD | su -c "`cat /tmp/subox-exec`" &</action>
52 <action type="closewindow">SU_DIALOG</action>
53 </button>
54 <button cancel></button>
55 </hbox>
57 </vbox>
58 </window>
59 '
61 gtkdialog --center --program=SU_DIALOG