slitaz-tools rev 35

Add subox a Gtkdialog to su
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jan 13 22:02:50 2008 +0100 (2008-01-13)
parents 6766819798c7
children 0ae81ea9ef1a
files tinyutils/subox
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tinyutils/subox	Sun Jan 13 22:02:50 2008 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +#! /bin/sh
     1.5 +#
     1.6 +# Gtkdialog to execute program as root from a WM menu.
     1.7 +# - SliTaz GNU/Linux 2008.
     1.8 +#
     1.9 +VERSION=20080113
    1.10 +
    1.11 +# Usage.
    1.12 +if [ -z "$1" ]; then
    1.13 +    echo "Slitaz subox version : $VERSION"
    1.14 +    echo -e "\nUsage : subox program\n"
    1.15 +    exit 0
    1.16 +fi
    1.17 +
    1.18 +# Keep binary name in a tmp file to be used by SU_DIALOG.
    1.19 +echo "$1" > /tmp/subox-exec
    1.20 +
    1.21 +# Main window and root passord default entry set to 'root'.
    1.22 +export SU_DIALOG='
    1.23 +  <vbox>
    1.24 +  
    1.25 +    <text use-markup="true">
    1.26 +      <label>
    1.27 +"
    1.28 +<b>SliTaz - Subox</b>"
    1.29 +      </label>
    1.30 +    </text>
    1.31 +    <text wrap="true" width-chars="46">
    1.32 +      <label>
    1.33 +"
    1.34 +Please enter root password to execute :"
    1.35 +      </label>
    1.36 +    </text>
    1.37 +    <text>
    1.38 +      <input file>/tmp/subox-exec</input>
    1.39 +    </text>
    1.40 +    
    1.41 +    <hbox>
    1.42 +      <text use-markup="true">
    1.43 +        <label>"<b>Root password :</b>"</label>
    1.44 +      </text>
    1.45 +      <entry visibility="false">
    1.46 +        <default>root</default>
    1.47 +        <variable>PASSWD</variable>
    1.48 +      </entry>
    1.49 +    </hbox>
    1.50 +    
    1.51 +    <hbox>
    1.52 +      <button ok>
    1.53 +        <action>echo $PASSWD | su -c `cat /tmp/subox-exec` &</action>
    1.54 +        <action type="closewindow">SU_DIALOG</action>
    1.55 +      </button>
    1.56 +      <button cancel></button>
    1.57 +    </hbox>
    1.58 +  
    1.59 +  </vbox>
    1.60 +'
    1.61 +
    1.62 +gtkdialog --program=SU_DIALOG