Advertisement
BillyGalbreath

Auto update Discord-Canary on Debian

Mar 21st, 2019
5,435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.52 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement