The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

71 lignes
2.4 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. ARCH="$(uname -m)"
  15. if [[ "${ARCH}" == "x86_64" ]] ; then
  16. VULTR_ARCH="amd64"
  17. elif [[ "${ARCH}" == "arm64" ]] ; then
  18. VULTR_ARCH="arm64"
  19. fi
  20. CURL=""
  21. if [[ -z "$(which curl)" ]] ; then
  22. if [[ -f /usr/bin/curl ]] ; then
  23. CURL=/usr/bin/curl
  24. fi
  25. else
  26. CURL="$(which curl)"
  27. fi
  28. # Install packer
  29. if [[ ! -f ${HOME}/packer/packer ]] ; then
  30. PACKER_VERSION=1.8.3
  31. if [[ "${PLATFORM}" == "Darwin" ]] ; then
  32. PACKER_FILE=packer_${PACKER_VERSION}_darwin_amd64.zip
  33. elif [[ "${PLATFORM}" == "Linux" ]] ; then
  34. PACKER_FILE=packer_${PACKER_VERSION}_linux_amd64.zip
  35. else
  36. die "Add packer support to script ${0} for platform ${PLATFORM}"
  37. fi
  38. PACKER_URL=https://releases.hashicorp.com/packer/${PACKER_VERSION}/${PACKER_FILE}
  39. mkdir -p ${HOME}/packer && cd ${HOME}/packer && "${CURL}" -L ${PACKER_URL} -o ${PACKER_FILE} && unzip ${PACKER_FILE} || die "Error installing packer"
  40. echo "Packer successfully installed"
  41. else
  42. echo "Packer already installed"
  43. fi
  44. # Install packer Vultr plugin
  45. if [[ ! -f ${HOME}/.packer.d/plugins/packer-builder-vultr ]] ; then
  46. PACKER_VULTR_VERSION=2.4.5
  47. if [[ "${PLATFORM}" == "Darwin" ]] ; then
  48. PACKER_VULTR_FILE=packer-plugin-vultr_v${PACKER_VULTR_VERSION}_x5.0_darwin_${VULTR_ARCH}.zip
  49. elif [[ "${PLATFORM}" == "Linux" ]] ; then
  50. PACKER_VULTR_FILE=packer-plugin-vultr_v${PACKER_VULTR_VERSION}_x5.0_linux_${VULTR_ARCH}.zip
  51. elif [[ "${PLATFORM}" == "Windows" ]] ; then
  52. PACKER_VULTR_FILE=packer-plugin-vultr_v${PACKER_VULTR_VERSION}_x5.0_windows_${VULTR_ARCH}.zip
  53. else
  54. die "Add packer vultr support to script ${0} for platform ${PLATFORM}"
  55. fi
  56. PACKER_VULTR_URL=https://github.com/vultr/packer-plugin-vultr/releases/download/v${PACKER_VULTR_VERSION}/${PACKER_VULTR_FILE}
  57. echo "PACKER_VULTR_URL is ${PACKER_VULTR_URL}"
  58. mkdir -p ${HOME}/.packer.d/plugins \
  59. && cd ${HOME}/.packer.d/plugins \
  60. && "${CURL}" -L ${PACKER_VULTR_URL} -o ${PACKER_VULTR_FILE} \
  61. && unzip ${PACKER_VULTR_FILE} \
  62. || die "Error installing packer vultr plugin"
  63. echo "Packer Vultr plugin successfully installed"
  64. else
  65. echo "Packer vultr plugin already installed"
  66. fi