From 0fc3759d74a84229d9db39693d2b14a1b85320e0 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 23 Dec 2020 14:10:07 +0100 Subject: [PATCH 1/2] [fix] use SEARX_SETTINGS_TEMPLATE from .config environment In commit a70b9b9f the SEARX_SETTINGS_TEMPLATE environment was added to the .config file, but was not use in utils/searx.sh. Signed-off-by: Markus Heiser --- utils/searx.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/searx.sh b/utils/searx.sh index 5a24a016..e252bd4d 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -36,7 +36,7 @@ GIT_BRANCH="${GIT_BRANCH:-master}" SEARX_PYENV="${SERVICE_HOME}/searx-pyenv" SEARX_SRC="${SERVICE_HOME}/searx-src" SEARX_SETTINGS_PATH="/etc/searx/settings.yml" -SEARX_SETTINGS_TEMPLATE="${REPO_ROOT}/utils/templates/etc/searx/use_default_settings.yml" +SEARX_SETTINGS_TEMPLATE="${SEARX_SETTINGS_TEMPLATE:-${REPO_ROOT}/utils/templates/etc/searx/use_default_settings.yml}" SEARX_UWSGI_APP="searx.ini" # shellcheck disable=SC2034 SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket" @@ -157,7 +157,7 @@ install / remove :searx-src: clone $GIT_URL :pyenv: create/remove virtualenv (python) in $SEARX_PYENV :uwsgi: install searx uWSGI application - :settings: reinstall settings from ${REPO_ROOT}/searx/settings.yml + :settings: reinstall settings from ${SEARX_SETTINGS_TEMPLATE} :packages: install needed packages from OS package manager :buildhost: install packages from OS package manager needed by buildhosts update searx @@ -412,7 +412,7 @@ install_settings() { mkdir -p "$(dirname ${SEARX_SETTINGS_PATH})" if [[ ! -f ${SEARX_SETTINGS_PATH} ]]; then - info_msg "install settings ${REPO_ROOT}/searx/settings.yml" + info_msg "install settings ${SEARX_SETTINGS_TEMPLATE}" info_msg " --> ${SEARX_SETTINGS_PATH}" cp "${SEARX_SETTINGS_TEMPLATE}" "${SEARX_SETTINGS_PATH}" configure_searx From 5fc9273e230af1e47486055769f9a32104acbda5 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 23 Dec 2020 16:06:06 +0100 Subject: [PATCH 2/2] [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 --- .config.sh | 5 ++++- utils/searx.sh | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.config.sh b/.config.sh index f9bac738..7eed5f68 100644 --- a/.config.sh +++ b/.config.sh @@ -28,7 +28,10 @@ fi # SEARX_INTERNAL_URL="127.0.0.1:8888" # 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}" # filtron.sh diff --git a/utils/searx.sh b/utils/searx.sh index e252bd4d..3a21e222 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -388,6 +388,14 @@ clone_searx() { err_msg "to clone searx sources, user $SERVICE_USER hast to be created first" return 42 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 git_clone "$REPO_ROOT" "$SEARX_SRC" \ "$GIT_BRANCH" "$SERVICE_USER"