slitaz-tools rev 464
subox: can save and remember passwd
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Mar 24 22:03:29 2010 +0100 (2010-03-24) |
parents | aa61397a4475 |
children | 431e76f19704 |
files | tinyutils/subox |
line diff
1.1 --- a/tinyutils/subox Wed Mar 24 06:37:36 2010 -0400 1.2 +++ b/tinyutils/subox Wed Mar 24 22:03:29 2010 +0100 1.3 @@ -3,7 +3,7 @@ 1.4 # Gtkdialog to execute program as root from a WM menu. 1.5 # (c) SliTaz GNU/Linux 2008-2010 - GNU gpl. 1.6 # 1.7 -VERSION=20100314 1.8 +VERSION=20100324 1.9 1.10 # Usage. 1.11 if [ -z "$1" ]; then 1.12 @@ -26,7 +26,7 @@ 1.13 export SU_CMD=$1 1.14 1.15 # Main window and root password default entry set to 'root'. 1.16 -export SU_DIALOG=' 1.17 +SU_DIALOG=' 1.18 <window title="Subox" skip_taskbar_hint="true"> 1.19 <vbox> 1.20 1.21 @@ -47,14 +47,29 @@ 1.22 <text use-markup="true"> 1.23 <label>"'`gettext "<b>Admin password :</b>"`'"</label> 1.24 </text> 1.25 - <entry visibility="false"> 1.26 + <entry visibility="false">' 1.27 + 1.28 +# Check if we have a saved passwd. 1.29 +if [ -s $HOME/.config/slitaz/subox.conf ]; then 1.30 + PASSWD=`cat $HOME/.config/slitaz/subox.conf` 1.31 + [ -n "$PASSWD" ] && SU_DIALOG="$SU_DIALOG <default>$PASSWD</default>" 1.32 +fi 1.33 + 1.34 +export SU_DIALOG=''${SU_DIALOG}' 1.35 <variable>PASSWD</variable> 1.36 </entry> 1.37 </hbox> 1.38 1.39 <hbox> 1.40 + <checkbox> 1.41 + <label>"'`gettext "Autosave password"`'"</label> 1.42 + <variable>AUTOSAVE</variable> 1.43 + <default>false</default> 1.44 + </checkbox> 1.45 <button ok> 1.46 <action>echo $PASSWD | su -c "$SU_CMD" &</action> 1.47 + <action>[ $AUTOSAVE == true ] && echo $PASSWD > '$HOME/.config/slitaz/subox.conf'</action> 1.48 + <action>[ $AUTOSAVE == true ] && chmod 0600 '$HOME/.config/slitaz/subox.conf'</action> 1.49 <action type="closewindow">SU_DIALOG</action> 1.50 </button> 1.51 <button cancel></button> 1.52 @@ -63,6 +78,6 @@ 1.53 </vbox> 1.54 </window>' 1.55 1.56 -gtkdialog --center --program=SU_DIALOG 1.57 +gtkdialog --center --program=SU_DIALOG > /dev/null 1.58 1.59 exit 0