The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 

105 satır
2.8 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. function die() {
  6. if [[ -z "${SCRIPT}" ]]; then
  7. echo 1>&2 "${1}"
  8. else
  9. echo 1>&2 "${SCRIPT}: ${1}"
  10. fi
  11. exit 1
  12. }
  13. function handle_help_request() {
  14. if [[ -z "${2}" ]]; then
  15. return
  16. fi
  17. if [[ ${2} == "-h" || ${2} == "--help" ]]; then
  18. while IFS='' read -r line || [[ -n "$line" ]]; do
  19. if [[ ${line} =~ ^#.* ]]; then
  20. if [[ ! ${line} =~ ^#!/bin/bash.* ]]; then
  21. echo "${line}"
  22. fi
  23. else
  24. break
  25. fi
  26. done <"${1}"
  27. exit 1
  28. fi
  29. }
  30. function make_temp() {
  31. prefix="${1}"
  32. suffix="${2}"
  33. echo "$(mktemp ${prefix}.${suffix}.XXXXXXXX)"
  34. }
  35. function make_temp_dir() {
  36. prefix="${1}"
  37. suffix="${2}"
  38. echo "$(mktemp -d ${prefix}.${suffix}.XXXXXXXX)"
  39. }
  40. function quote_args() {
  41. args=""
  42. for i in "$@"; do
  43. if [[ "$i" =~ \ |\' ]]; then
  44. i="${i//\\/\\\\}"
  45. args="$args \"${i//\"/\\\"}\""
  46. else
  47. args="$args ${i}"
  48. fi
  49. done
  50. echo -n ${args}
  51. }
  52. handle_help_request "${0}" "${1}"
  53. # Ensure we can find run.sh
  54. if [[ -z "${BUBBLE_SCRIPTS}" ]] ; then
  55. BC_DIR="$(cd "$(dirname "${0}")" && pwd)"
  56. RUN_SH="$(find "${BC_DIR}" -type f -name "run.sh" | head -1)"
  57. if [[ -z "${RUN_SH}" ]] ; then
  58. RUN_SH="$(find . -type f -name "run.sh" | head -1)"
  59. fi
  60. if [[ -z "${RUN_SH}" ]] ; then
  61. RUN_SH="$(find ${BC_DIR}/../../bubble -type f -name "run.sh" | head -1)"
  62. fi
  63. if [[ -z "${RUN_SH}" ]] ; then
  64. die "run.sh script not found. Set BUBBLE_SCRIPTS to be the directory containing run.sh"
  65. fi
  66. BUBBLE_SCRIPTS="$(dirname "${RUN_SH}")"
  67. elif [[ ! -f "${BUBBLE_SCRIPTS}/run.sh" ]] ; then
  68. die "run.sh script not found in BUBBLE_SCRIPTS dir (${BUBBLE_SCRIPTS})"
  69. fi
  70. if [[ -z "${BUBBLE_JAR}" ]] ; then
  71. if [[ -f "${HOME}/api/bubble.jar" ]] ; then
  72. BUBBLE_JAR="${HOME}/api/bubble.jar"
  73. elif [[ -f "/home/bubble/api/bubble.jar" ]] ; then
  74. BUBBLE_JAR="/home/bubble/api/bubble.jar"
  75. elif [[ -f "${BUBBLE_SCRIPTS}/../bubble.jar" ]] ; then
  76. BUBBLE_JAR="${BUBBLE_SCRIPTS}/../bubble.jar"
  77. else
  78. BUBBLE_JAR="$(find "${BUBBLE_SCRIPTS}/../bubble-server/target" -type f -name "bubble*.jar" | head -1)"
  79. fi
  80. fi
  81. if [[ -z "${BUBBLE_JAR}" ]] ; then
  82. echo 1>&2 "warning: bubble jar could not be located"
  83. fi
  84. # Check to see if we are on the PATH, if not suggest that we could be
  85. BUBBLE_BIN="$(cd "$(dirname "${0}")" && pwd)"
  86. if [[ -z "${BUBBLE_SKIP_PATH_WARNING}" && -z "$(which "$(basename "${0}")")" ]] ; then
  87. echo 1>&2 "Note: ${BUBBLE_BIN} is not on your PATH. To make things easier, add it to your PATH:"
  88. echo 1>&2 ""
  89. echo 1>&2 "export PATH=\${PATH}:${BUBBLE_BIN}"
  90. echo 1>&2 ""
  91. echo 1>&2 "(set BUBBLE_SKIP_PATH_WARNING to silence this warning)"
  92. export BUBBLE_SKIP_PATH_WARNING=1
  93. fi