The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

58 рядки
2.0 KiB

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. # Installs Packer and the Packer Vultr plugin.
  6. #
  7. # It is safe to run this command multiple times, it is idempotent.
  8. #
  9. function die {
  10. echo 1>&2 "${1}"
  11. exit 1
  12. }
  13. PLATFORM="$(uname -s)"
  14. CURL=""
  15. if [[ -z "$(which curl)" ]] ; then
  16. if [[ -f /usr/bin/curl ]] ; then
  17. CURL=/usr/bin/curl
  18. fi
  19. else
  20. CURL="$(which curl)"
  21. fi
  22. # Install packer
  23. if [[ ! -f ${HOME}/packer/packer ]] ; then
  24. PACKER_VERSION=1.6.5
  25. if [[ "${PLATFORM}" == "Darwin" ]] ; then
  26. PACKER_FILE=packer_${PACKER_VERSION}_darwin_amd64.zip
  27. elif [[ "${PLATFORM}" == "Linux" ]] ; then
  28. PACKER_FILE=packer_${PACKER_VERSION}_linux_amd64.zip
  29. else
  30. die "Add packer support to script ${0} for platform ${PLATFORM}"
  31. fi
  32. PACKER_URL=https://releases.hashicorp.com/packer/${PACKER_VERSION}/${PACKER_FILE}
  33. mkdir -p ${HOME}/packer && cd ${HOME}/packer && "${CURL}" -L ${PACKER_URL} -o ${PACKER_FILE} && unzip ${PACKER_FILE} || die "Error installing packer"
  34. echo "Packer successfully installed"
  35. else
  36. echo "Packer already installed"
  37. fi
  38. # Install packer Vultr plugin
  39. if [[ ! -f ${HOME}/.packer.d/plugins/packer-builder-vultr ]] ; then
  40. PACKER_VULTR_VERSION=1.0.15
  41. if [[ "${PLATFORM}" == "Darwin" ]] ; then
  42. PACKER_VULTR_FILE=packer-builder-vultr_${PACKER_VULTR_VERSION}_macOs_64-bit.tar.gz
  43. elif [[ "${PLATFORM}" == "Linux" ]] ; then
  44. PACKER_VULTR_FILE=packer-builder-vultr_${PACKER_VULTR_VERSION}_linux_64-bit.tar.gz
  45. else
  46. die "Add packer vultr support to script ${0} for platform ${PLATFORM}"
  47. fi
  48. PACKER_VULTR_URL=https://github.com/vultr/packer-builder-vultr/releases/download/v${PACKER_VULTR_VERSION}/${PACKER_VULTR_FILE}
  49. mkdir -p ${HOME}/.packer.d/plugins && cd ${HOME}/.packer.d/plugins && "${CURL}" -L ${PACKER_VULTR_URL} -o ${PACKER_VULTR_FILE} && tar xzf ${PACKER_VULTR_FILE} || die "Error installing packer vultr plugin"
  50. echo "Packer Vultr plugin successfully installed"
  51. else
  52. echo "Packer vultr plugin already installed"
  53. fi