Advertisement
Guest User

Untitled

a guest
May 12th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. s_username="${BASH_ARGV[1]}"
  4. s_command="${BASH_ARGV[0]}"
  5.  
  6. if [[ -z "$s_command" ]]; then
  7. exit
  8. fi
  9.  
  10. if [[ -z "$s_username" ]]; then
  11. s_username="root"
  12. fi
  13.  
  14. s_password=$(
  15. zenity --entry --hide-text --modal \
  16. --title="Uruchom jako $s_username" \
  17. --text="Uruchamianie polecenia:\n\t$s_command\njako użytkownik:\n\t$s_username\n\nProszę podać hasło." \
  18. --ok-label="Uruchom" --cancel-label="Anuluj" 2> /dev/null
  19. )
  20.  
  21. if [[ -n "$s_password" ]]; then
  22.  
  23. sudo -K
  24. sudo -H -S -p "" mousepad <<< "$s_password"
  25.  
  26. if [[ $? -gt 0 ]]; then
  27. zenity --error --text="Podane hasło jest niepoprawne." 2> /dev/null
  28. fi
  29.  
  30. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement