A simple gksu replacement using yad
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

#!/bin/sh
case $LANG in
pl*)
TITLE="Uwierzytelnianie"
TEXT=" Wymagana jest Autentykacja \n dla użytkownika: <b>$USER</b>"
PASS=" Hasło: "
WRONG=" Błędne hasło, spróbuj ponownie "
OK="--button=Uwierzytelnij:0"
CANCEL="--button=Anuluj:1"
;;
es*)
TITLE="Autenticación"
TEXT="Se requiere autenticación \n para el usuario: <b>$USER</b>"
PASS=" Contraseña: "
WRONG=" Contraseña incorrecta, inténtelo de nuevo"
OK="--button=Autenticar:0"
CANCEL="--button=Cancelar:1"
;;
*)
TITLE="Authentication"
TEXT=" Authentication needed for user: <b>$USER</b>"
PASS=" Password: "
WRONG=" Wrong password, retry "
OK="--button=Authenticate:0"
CANCEL="--button=Cancel:1"
;;
esac
PASSWD="$(yad --entry --entry-label "$PASS" --hide-text --image=dialog-password --window-icon=distributor-logo-mabox --width=360 --text="$TEXT" --title="$TITLE" --center $CANCEL $OK)"
if [ "$dialog_pressed_label" = 'cancel' ]; then
echo "triggered cancel"
exit
elif [ -z "$PASSWD" ]; then
echo "triggered empty"
exit
else
echo triggered PW
echo "$PASSWD" | sudo -S "$@"
fi
if [ $? = 1 ]; then
PASSWD="$(yad --entry --entry-label "$PASS" --hide-text --image=dialog-error --window-icon=distributor-logo-mabox --width=360 --text="$WRONG" --title="$TITLE" --center $CANCEL $OK)"
echo "$PASSWD" | sudo -S "$@"
fi