diff --git a/yadsu b/yadsu new file mode 100755 index 0000000..1d89e03 --- /dev/null +++ b/yadsu @@ -0,0 +1,45 @@ +#!/bin/sh +case $LANG in + pl*) + TITLE="Uwierzytelnianie" + TEXT=" Wymagana jest Autentykacja \n dla użytkownika: $USER" + 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: $USER" + 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: $USER" + 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