slitaz-tools rev 387

subox fix execution (use variable rather than tmp file)
author Christophe Lincoln <pankso@slitaz.org>
date Thu Oct 01 21:24:28 2009 +0200 (2009-10-01)
parents fad3262d280d
children 85c3820a4052
files tinyutils/subox
line diff
     1.1 --- a/tinyutils/subox	Fri Sep 18 13:09:01 2009 +0200
     1.2 +++ b/tinyutils/subox	Thu Oct 01 21:24:28 2009 +0200
     1.3 @@ -15,30 +15,28 @@
     1.4  # Nothing to do if we are root
     1.5  test $(id -u) = 0 && exec $1
     1.6  
     1.7 -# Keep binary name in a tmp file to be used by SU_DIALOG.
     1.8 -echo "$1" > /tmp/subox-exec
     1.9 +# Keep command in an exported variable to be used by SU_DIALOG.
    1.10 +export SU_CMD=$@
    1.11  
    1.12  # Main window and root password default entry set to 'root'.
    1.13  export SU_DIALOG='
    1.14  <window title="Subox">
    1.15    <vbox>
    1.16 -  
    1.17 +
    1.18      <text use-markup="true">
    1.19 -      <label>
    1.20 -"
    1.21 +      <label>"
    1.22  <b>SliTaz - Subox</b>"
    1.23        </label>
    1.24      </text>
    1.25 -    <text wrap="true" width-chars="46">
    1.26 -      <label>
    1.27 -"
    1.28 +    <text wrap="true" width-chars="48">
    1.29 +      <label>"
    1.30  Please enter root password to execute :"
    1.31        </label>
    1.32      </text>
    1.33      <text>
    1.34 -      <input file>/tmp/subox-exec</input>
    1.35 +      <input>echo $SU_CMD</input>
    1.36      </text>
    1.37 -    
    1.38 +
    1.39      <hbox>
    1.40        <text use-markup="true">
    1.41          <label>"<b>Root password :</b>"</label>
    1.42 @@ -48,20 +46,18 @@
    1.43          <variable>PASSWD</variable>
    1.44        </entry>
    1.45      </hbox>
    1.46 -    
    1.47 +
    1.48      <hbox>
    1.49        <button ok>
    1.50 -        <action>echo $PASSWD | su -c "`cat /tmp/subox-exec`" &</action>
    1.51 +        <action>echo $PASSWD | su -c "$SU_CMD" &</action>
    1.52          <action type="closewindow">SU_DIALOG</action>
    1.53        </button>
    1.54        <button cancel></button>
    1.55      </hbox>
    1.56 -  
    1.57 +
    1.58    </vbox>
    1.59  </window>
    1.60  '
    1.61  
    1.62  gtkdialog --center --program=SU_DIALOG
    1.63 -
    1.64 -# Let other user lauch subox.
    1.65 -rm /tmp/subox-exec
    1.66 +exit 0