install_throttled.sh 799 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. function error {
  3. echo -e "\\e[91m$1\\e[39m"
  4. exit 1
  5. }
  6. function check_internet() {
  7. printf "Checking if you are online..."
  8. wget -q --spider http://github.com
  9. if [ $? -eq 0 ]; then
  10. echo "Online. Continuing."
  11. else
  12. error "Offline. Go connect to the internet then run the script again."
  13. fi
  14. }
  15. check_internet
  16. echo "Downloading throttled.sh script"
  17. sudo wget -O /usr/local/bin/throttled.sh https://gist.githubusercontent.com/aallan/0b03f5dcc65756dde6045c6e96c26459/raw/c0e75e2599d8ed76f834d44bc3ce84e0f5f2f4bc/throttled.sh || error "Failed to download throttled.sh file!"
  18. echo "Setting permissions..."
  19. sudo chmod -R 755 /usr/local/bin/throttled.sh || error "Failed to set permissions for throttled.sh!"
  20. echo "First Run of Throttled.sh..."
  21. sudo /usr/local/bin/throttled.sh