BillyGalbreath

Auto update Discord-Canary on Debian

Mar 21st, 2019
1,175
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. ### ensure script is run as root/sudo
  4. if ! [ $(id -u) = 0 ]; then
  5.     if [ "$1" ]; then
  6.         echo "Error: root privileges required"
  7.         exit 1
  8.     fi
  9.     sudo sh $0 "1"
  10.     exit $?
  11. fi
  12.  
  13.  
  14. ### download and install as root
  15. wget -O /tmp/discord-installer.deb "https://discordapp.com/api/download/canary?platform=linux&format=deb"
  16. dpkg -i /tmp/discord-installer.deb
  17.  
  18.  
  19. ### execute discord as real user that invoked script
  20. sudo -u `[ $SUDO_USER ] && echo $SUDO_USER || echo $(whoami)` discord-canary
RAW Paste Data