[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>
This commit is contained in:
Markus Heiser 2020-12-23 16:06:06 +01:00
parent 0fc3759d74
commit 5fc9273e23
2 changed files with 12 additions and 1 deletions

View File

@ -28,7 +28,10 @@ fi
# SEARX_INTERNAL_URL="127.0.0.1:8888" # SEARX_INTERNAL_URL="127.0.0.1:8888"
# SEARX_SETTINGS_TEMPLATE="${REPO_ROOT}/utils/templates/etc/searx/use_default_settings.yml" # SEARX_SETTINGS_TEMPLATE="${REPO_ROOT}/utils/templates/etc/searx/use_default_settings.yml"
# Only change, if you maintain a searx brand in your searx fork. # Only change, if you maintain a searx brand in your searx fork (GIT_URL) which
# is not hold by branch 'master'. The branch has to be a local branch, in the
# repository from which you install (which is most often the case). If you want
# to install branch 'foo', don't forget to run 'git branch foo origin/foo' once.
# GIT_BRANCH="${GIT_BRANCH:-master}" # GIT_BRANCH="${GIT_BRANCH:-master}"
# filtron.sh # filtron.sh

View File

@ -388,6 +388,14 @@ clone_searx() {
err_msg "to clone searx sources, user $SERVICE_USER hast to be created first" err_msg "to clone searx sources, user $SERVICE_USER hast to be created first"
return 42 return 42
fi fi
if [[ ! $(git show-ref "refs/heads/${GIT_BRANCH}") ]]; then
warn_msg "missing local branch ${GIT_BRANCH}"
info_msg "create local branch ${GIT_BRANCH} from start point: origin/${GIT_BRANCH}"
git branch "${GIT_BRANCH}" "origin/${GIT_BRANCH}"
fi
if [[ ! $(git branch --show-current) == "${GIT_BRANCH}" ]]; then
warn_msg "take into account, installing branch $GIT_BRANCH while current branch is $(git branch --show-current)"
fi
export SERVICE_HOME export SERVICE_HOME
git_clone "$REPO_ROOT" "$SEARX_SRC" \ git_clone "$REPO_ROOT" "$SEARX_SRC" \
"$GIT_BRANCH" "$SERVICE_USER" "$GIT_BRANCH" "$SERVICE_USER"