The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

106 行
2.6 KiB

  1. #!/bin/bash
  2. function die {
  3. if [[ -z "${SCRIPT}" ]] ; then
  4. echo 1>&2 "${1}"
  5. else
  6. echo 1>&2 "${SCRIPT}: ${1}"
  7. fi
  8. exit 1
  9. }
  10. function handle_help_request () {
  11. if [[ -z "${2}" ]] ; then
  12. return
  13. fi
  14. if [[ ${2} == "-h" || ${2} == "--help" ]] ; then
  15. while IFS='' read -r line || [[ -n "$line" ]]; do
  16. if [[ ${line} =~ ^#.* ]] ; then
  17. if [[ ! ${line} =~ ^#!/bin/bash.* ]] ; then
  18. echo "${line}"
  19. fi
  20. else
  21. break
  22. fi
  23. done < "${1}"
  24. exit 1
  25. fi
  26. }
  27. function make_temp () {
  28. prefix="${1}"
  29. suffix="${2}"
  30. echo "$(mktemp ${prefix}.XXXXXXXX${suffix})"
  31. }
  32. function make_temp_dir () {
  33. prefix="${1}"
  34. suffix="${2}"
  35. echo "$(mktemp -d ${prefix}.XXXXXXXX${suffix})"
  36. }
  37. function quote_args () {
  38. args=""
  39. for i in "$@"; do
  40. if [[ "$i" =~ \ |\' ]] ; then
  41. i="${i//\\/\\\\}"
  42. args="$args \"${i//\"/\\\"}\""
  43. else
  44. args="$args ${i}"
  45. fi
  46. done
  47. echo -n ${args}
  48. }
  49. handle_help_request ${0} ${1}
  50. # Ensure we can find run.sh
  51. if [[ -z "${BUBBLE_SCRIPTS}" ]] ; then
  52. RUN_SH="$(find $(cd $(dirname ${0}) && pwd) -type f -name "run.sh" | head -1)"
  53. if [[ -z "${RUN_SH}" ]] ; then
  54. RUN_SH="$(find . -type f -name "run.sh" | head -1)"
  55. fi
  56. if [[ -z "${RUN_SH}" ]] ; then
  57. die "run.sh script not found. Set BUBBLE_SCRIPTS to be the directory containing run.sh"
  58. fi
  59. BUBBLE_SCRIPTS="$(dirname "${RUN_SH}")"
  60. elif [[ ! -f "${BUBBLE_SCRIPTS}/run.sh" ]] ; then
  61. die "run.sh script not found in BUBBLE_SCRIPTS dir (${BUBBLE_SCRIPTS})"
  62. fi
  63. if [[ -z "${BUBBLE_PASS}" ]] ; then
  64. if [[ ! -z "${REQUIRE_BUBBLE_PASS}" ]] ; then
  65. die "No BUBBLE_PASS env var defined"
  66. fi
  67. BUBBLE_PASS=password
  68. fi
  69. if [[ -z "${BUBBLE_USER}" ]] ; then
  70. if [[ ! -z "${REQUIRE_BUBBLE_USER}" ]] ; then
  71. die "No BUBBLE_USER env var defined"
  72. fi
  73. BUBBLE_USER=root
  74. fi
  75. if [[ -z "${BUBBLE_JAR}" ]] ; then
  76. if [[ -f "${HOME}/current/bubble.jar" ]] ; then
  77. BUBBLE_JAR="${HOME}/current/bubble.jar"
  78. elif [[ -f "/home/bubble/current/bubble.jar" ]] ; then
  79. BUBBLE_JAR="/home/bubble/current/bubble.jar"
  80. else
  81. BUBBLE_JAR="$(find ${BUBBLE_SCRIPTS}/../bubble-server/target -type f -name bubble*.jar | head -1)"
  82. fi
  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. export BUBBLE_SKIP_PATH_WARNING=1
  92. fi