Advertisement
Guest User

Adobe Reader IPV6 patch for AUR

a guest
Jul 4th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.50 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. echo 'Warning: This patch depends on: acroread, sed, sudo.'
  4. echo 'Optionally, for a GUI, it depends on gksu and notify-send.'
  5.  
  6. COMMENTING="Applying patch..."
  7. UNCOMMENTING="Patch worked. Reversing patch..."
  8. FIX_NOT_RUN_SUMMARY="The Adobe Reader patch did not run!"
  9. FIX_NOT_RUN_DESC="The patch needs ROOT permission to edit your /etc/hosts file."
  10. CMD_CMMT='sed -i "/::1/ s/^/# /" /etc/hosts'
  11.  
  12. # Check for running instance
  13. if pidof -x "acroread" >/dev/null; then
  14.         echo "Adobe Reader already running, skipping patch!"
  15.         notify-send "Adobe Reader already running, skipping patch!"
  16.         acroread "$1"
  17.         exit 0
  18. fi
  19.  
  20. if [[ $DISPLAY ]] && ! tty; then
  21.         #Invocation from GUI
  22.         notify-send "$COMMENTING"
  23.         gksu --message "$FIX_NOT_RUN_DESC" "$CMD_CMMT";
  24.         if [ $? -eq 0 ]; then
  25.                 notify-send --icon=dialog-error "$FIX_NOT_RUN_SUMMARY" "$FIX_NOT_RUN_DESC";
  26.                 exit 126;
  27.         fi
  28. else
  29.         #Invocation from terminal
  30.         echo "$COMMENTING"
  31.         sudo sed -i "/::1/ s/^/# /" /etc/hosts || { echo "$FIX_NOT_RUN_DESC"; exit 126; }
  32. fi
  33.  
  34. #Launch Adobe Reader in the background
  35. nohup acroread "$1" &>/dev/null &disown
  36.  
  37. echo 'Waiting for Reader...'
  38. sleep 5
  39.  
  40. if [[ $DISPLAY ]] && ! tty; then
  41.         #Invocation from GUI
  42.         notify-send "$UNCOMMENTING"
  43.         sed -i "/::1/ s/# *//" /etc/hosts
  44. else
  45.         #Invocation from terminal
  46.         echo "$UNCOMMENTING"
  47.         sudo sed -i "/::1/ s/# *//" /etc/hosts
  48. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement