You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

setup.sh 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. cat << "EOF"
  3. __ .___
  4. ____ _____/ !_ ____ __! _/____
  5. / \ / _ \ __\ ______ _/ ___\ / __ |/ \
  6. | | ( <_> ) | /_____/ \ \___/ /_/ | | \
  7. |___| /\____/|__| \___ >____ |___| /
  8. \/ \/ \/ \/
  9. PRESENTS: not-server
  10. .:| https://git.teknik.io/not-cdn/not-server |:.
  11. EOF
  12. # add current directory to PATH
  13. # shellcheck disable=SC2155
  14. export PATH=$PATH:$(pwd)
  15. # check for rclone and valid configuration
  16. if ! [ -x "$(command -v rclone)" ]
  17. then
  18. echo "ERROR: rclone binary not found in PATH or current folder"
  19. echo "Install with: curl https://rclone.org/install.sh | sudo bash"
  20. echo "or go to https://rclone.org/install/"
  21. exit 1
  22. fi
  23. echo "Starting rclone, please configure a remote named cdn:"
  24. rclone config --config rclone.conf
  25. # check for caddy
  26. if ! [ -x "$(command -v caddy)" ]
  27. then
  28. echo "caddy binary not found in PATH or current folder"
  29. echo "Install with: curl https://getcaddy.com | bash -s personal"
  30. echo "or go to https://caddyserver.com/download"
  31. exit 1
  32. fi
  33. # set login credentials
  34. USERNAME_DEFAULT="user"
  35. read -r -p "Desired login username [$USERNAME_DEFAULT]: " USERNAME
  36. USERNAME="${USERNAME:-$USERNAME_DEFAULT}"
  37. PASSWORD_DEFAULT="letmein"
  38. read -r -p "Desired login password [$PASSWORD_DEFAULT]: " PASSWORD
  39. PASSWORD="${PASSWORD:-$PASSWORD_DEFAULT}"
  40. sed -i -e "s/basicauth.*$/basicauth \/ $USERNAME $PASSWORD/" Caddyfile
  41. echo "not-server setup complete!"
  42. echo ""
  43. # switch setup
  44. echo "Configure Tinfoil / SX Installer (See README):"
  45. echo -n "Host - "; curl ifconfig.co
  46. echo -n "Port - "; head -1 Caddyfile | cut -d: -f2
  47. echo "Username - $USERNAME"
  48. echo "Password - $PASSWORD"
  49. echo ""
  50. echo "You can now use start.sh"