Guest User

Untitled

a guest
Apr 9th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #!/bin/bash
  2. BA_LAST_OCTET=144
  3. BA_IP=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | awk -F'.' '{print $1,$2,$3"."}' OFS='.')$BA_LAST_OCTET
  4. PROMPT="Sudo password: "
  5.  
  6. CAN_I_RUN_SUDO=$(sudo -n uptime 2>&1|grep "load"|wc -l)
  7. if [ ${CAN_I_RUN_SUDO} -le 0 ]
  8. then
  9. . getpass.sh $1
  10.  
  11. echo $PASSWORD | sudo -S : >/dev/null 2>&1
  12. fi
  13. OUTPUT=$(sudo mount.cifs //$BA_IP/huginn/ /mnt/huginn/ -o username=fileshare,password="",rw,file_mode=0777,dir_mode=0777 2>&1)
  14. if [ -z "$OUTPUT" ]; then
  15. HUGINN="Huginn... Mounted."
  16. else
  17.  
  18. HUGINN="Huginn... Error.n"$OUTPUT
  19. fi
  20. OUTPUT=$(sudo mount.cifs //$BA_IP/muninn/ /mnt/muninn/ -o username=fileshare,password="",rw,file_mode=0777,dir_mode=0777 2>&1)
  21. if [ -z "$OUTPUT" ]; then
  22. MUNINN="Muninn... Mounted."
  23. else
  24.  
  25. MUNINN="Muninn... Error.n"$OUTPUT
  26. fi
  27. MSG=$HUGINN"n"$MUNINN"nFinalized."
  28. if [[ $1 == "--gui" ]] ; then
  29. zenity --info --title="Blackarmor" --text="$MSG" 2>/dev/null
  30. else
  31. echo -e "Mounting Blackarmor shares... nn"$MSG
  32. fi
  33.  
  34. Huginn... Error.
  35. sudo: no tty present and no askpass program specified
  36. Muninn... Error.
  37. sudo: no tty present and no askpass program specified
  38. Finalized.
  39.  
  40. [Nemo Action]
  41. Active=true
  42. Name=Mount Blackarmor share
  43. Exec=/bin/bash /usr/bin/ba --gui
  44. Selection=Any
  45. Extensions=any;
  46.  
  47. . getpass.sh $1
  48.  
  49. echo $PASSWORD | sudo -S : >/dev/null 2>&1
  50.  
  51. #. getpass.sh $1
  52.  
  53. SUDO_ASKPASS=/usr/bin/ssh-askpass sudo -A : >/dev/null 2>&1
  54.  
  55. SUDO_ASKPASS=/usr/libexec/openssh/x11-ssh-askpass sudo -A somecommand
  56.  
  57. Defaults:myname !requiretty
Add Comment
Please, Sign In to add comment