import yadsu

master
Daniel Napora 2020-09-20 13:33:26 +02:00
parent de025c920c
commit 44af30594b
1 changed files with 45 additions and 0 deletions

45
yadsu 100755
View File

@ -0,0 +1,45 @@
#!/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