on master help sign in
[mod] utils/searx.sh install: create branch if not already exists

This patch keeps an eye on: 1. When installing searx, the branch to install needs to be a local branch. 2. The branch to install can be different from the current branch. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commit5fc9273e230af1e47486055769f9a32104acbda5 authorMarkus Heiser <markus.heiser@darmarit.de> dateWed 23 Dec 2020, 16:06 (6 years ago) parent0fc3759
2 files changed+12−1
.config.sh+4−1 utils/searx.sh+8
.config.sh+4−1
@@ -28,7 +28,10 @@ fi
2828# SEARX_INTERNAL_URL="127.0.0.1:8888"
2929# SEARX_SETTINGS_TEMPLATE="${REPO_ROOT}/utils/templates/etc/searx/use_default_settings.yml"
3030
31−# Only change, if you maintain a searx brand in your searx fork.
31+# Only change, if you maintain a searx brand in your searx fork (GIT_URL) which
32+# is not hold by branch 'master'. The branch has to be a local branch, in the
33+# repository from which you install (which is most often the case). If you want
34+# to install branch 'foo', don't forget to run 'git branch foo origin/foo' once.
3235# GIT_BRANCH="${GIT_BRANCH:-master}"
3336
3437# filtron.sh
utils/searx.sh+8
@@ -388,6 +388,14 @@ clone_searx() {
388388 err_msg "to clone searx sources, user $SERVICE_USER hast to be created first"
389389 return 42
390390 fi
391+ if [[ ! $(git show-ref "refs/heads/${GIT_BRANCH}") ]]; then
392+ warn_msg "missing local branch ${GIT_BRANCH}"
393+ info_msg "create local branch ${GIT_BRANCH} from start point: origin/${GIT_BRANCH}"
394+ git branch "${GIT_BRANCH}" "origin/${GIT_BRANCH}"
395+ fi
396+ if [[ ! $(git branch --show-current) == "${GIT_BRANCH}" ]]; then
397+ warn_msg "take into account, installing branch $GIT_BRANCH while current branch is $(git branch --show-current)"
398+ fi
391399 export SERVICE_HOME
392400 git_clone "$REPO_ROOT" "$SEARX_SRC" \
393401 "$GIT_BRANCH" "$SERVICE_USER"