install.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/env bash
  2. set -o errexit
  3. set -o nounset
  4. set -o pipefail
  5. echo "Installing runtipi..."
  6. LATEST_VERSION=$(curl -s https://api.github.com/repos/meienberger/runtipi/releases/latest | grep tag_name | cut -d '"' -f4)
  7. ### --------------------------------
  8. ### CLI arguments
  9. ### --------------------------------
  10. UPDATE="false"
  11. while [ -n "${1-}" ]; do
  12. case "$1" in
  13. --update) UPDATE="true" ;;
  14. --)
  15. shift # The double dash makes them parameters
  16. break
  17. ;;
  18. *) echo "Option $1 not recognized" && exit 1 ;;
  19. esac
  20. shift
  21. done
  22. if [[ "${UPDATE}" == "false" ]]; then
  23. mkdir -p runtipi
  24. cd runtipi || exit
  25. fi
  26. curl --location https://api.github.com/repos/meienberger/runtipi/tarball/"${LATEST_VERSION}" -o runtipi.tar.gz
  27. mkdir runtipi-"${LATEST_VERSION}"
  28. tar -xzf runtipi.tar.gz -C runtipi-"${LATEST_VERSION}" --strip-components=1
  29. rm runtipi.tar.gz
  30. # copy from downloaded /scripts/*
  31. if [ -d "scripts" ]; then
  32. rm -rf scripts
  33. fi
  34. mkdir scripts
  35. cp -r runtipi-"${LATEST_VERSION}"/scripts/* ./scripts
  36. # copy from downloaded /templates/*
  37. if [ -d "templates" ]; then
  38. rm -rf templates
  39. fi
  40. mkdir templates
  41. cp -r runtipi-"${LATEST_VERSION}"/templates/* ./templates
  42. # copy from downloaded /traefik/*
  43. if [ -d "traefik" ]; then
  44. rm -rf traefik
  45. fi
  46. mkdir traefik
  47. cp -r runtipi-"${LATEST_VERSION}"/traefik/* ./traefik
  48. # copy from downloaded /docker-compose.yml
  49. if [ -f "docker-compose.yml" ]; then
  50. rm -f docker-compose.yml
  51. fi
  52. cp -r runtipi-"${LATEST_VERSION}"/docker-compose.yml .
  53. # copy from downloaded /package.json
  54. if [ -f "package.json" ]; then
  55. rm -f package.json
  56. fi
  57. cp -r runtipi-"${LATEST_VERSION}"/package.json .
  58. mkdir -p state
  59. ## remove downloaded folder
  60. rm -rf runtipi-"${LATEST_VERSION}"
  61. sudo ./scripts/start.sh