slitaz-tools view tinyutils/subox @ rev 208

calendar: no more hardcoded date
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue May 27 15:32:37 2008 +0000 (2008-05-27)
parents 6e50cf1c3f92
children db0e82bebc70
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 binary name in a tmp file to be used by SU_DIALOG.
19 echo "$1" > /tmp/subox-exec
21 # Main window and root passord default entry set to 'root'.
22 export SU_DIALOG='
23 <window title="Subox">
24 <vbox>
26 <text use-markup="true">
27 <label>
28 "
29 <b>SliTaz - Subox</b>"
30 </label>
31 </text>
32 <text wrap="true" width-chars="46">
33 <label>
34 "
35 Please enter root password to execute :"
36 </label>
37 </text>
38 <text>
39 <input file>/tmp/subox-exec</input>
40 </text>
42 <hbox>
43 <text use-markup="true">
44 <label>"<b>Root password :</b>"</label>
45 </text>
46 <entry visibility="false">
47 <default>root</default>
48 <variable>PASSWD</variable>
49 </entry>
50 </hbox>
52 <hbox>
53 <button ok>
54 <action>echo $PASSWD | su -c "`cat /tmp/subox-exec`" &</action>
55 <action type="closewindow">SU_DIALOG</action>
56 </button>
57 <button cancel></button>
58 </hbox>
60 </vbox>
61 </window>
62 '
64 gtkdialog --center --program=SU_DIALOG