on master help sign in
Merge pull request #2417 from return42/fix-seetings-template

[fix] use SEARX_SETTINGS_TEMPLATE from .config environment

commitd1291862122bcaffaaab36448dc6cc401c5c41b0 authorAlexandre Flament <alex@al-f.net> dateThu 24 Dec 2020, 10:00 (6 years ago) parentc2aaf6f5fc9273
2 files changed+15−4
.config.sh+4−1 utils/searx.sh+11−3
.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+11−3
@@ -36,7 +36,7 @@ GIT_BRANCH="${GIT_BRANCH:-master}"
3636SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"
3737SEARX_SRC="${SERVICE_HOME}/searx-src"
3838SEARX_SETTINGS_PATH="/etc/searx/settings.yml"
39−SEARX_SETTINGS_TEMPLATE="${REPO_ROOT}/utils/templates/etc/searx/use_default_settings.yml"
39+SEARX_SETTINGS_TEMPLATE="${SEARX_SETTINGS_TEMPLATE:-${REPO_ROOT}/utils/templates/etc/searx/use_default_settings.yml}"
4040SEARX_UWSGI_APP="searx.ini"
4141# shellcheck disable=SC2034
4242SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket"
@@ -157,7 +157,7 @@ install / remove
157157 :searx-src: clone $GIT_URL
158158 :pyenv: create/remove virtualenv (python) in $SEARX_PYENV
159159 :uwsgi: install searx uWSGI application
160− :settings: reinstall settings from ${REPO_ROOT}/searx/settings.yml
160+ :settings: reinstall settings from ${SEARX_SETTINGS_TEMPLATE}
161161 :packages: install needed packages from OS package manager
162162 :buildhost: install packages from OS package manager needed by buildhosts
163163update searx
@@ -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"
@@ -412,7 +420,7 @@ install_settings() {
412420 mkdir -p "$(dirname ${SEARX_SETTINGS_PATH})"
413421
414422 if [[ ! -f ${SEARX_SETTINGS_PATH} ]]; then
415− info_msg "install settings ${REPO_ROOT}/searx/settings.yml"
423+ info_msg "install settings ${SEARX_SETTINGS_TEMPLATE}"
416424 info_msg " --> ${SEARX_SETTINGS_PATH}"
417425 cp "${SEARX_SETTINGS_TEMPLATE}" "${SEARX_SETTINGS_PATH}"
418426 configure_searx