123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- #!/usr/bin/env bash
- . /dev/null
- SEARX_SRC_INIT_FILES=()
- eval orig_"$(declare -f source_dot_config)"
- source_dot_config() {
-
-
-
- if [ -z "$eval_SEARX_SRC" ]; then
- export eval_SEARX_SRC='true'
- SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
- SEARX_PYENV=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_PYENV)
- SEARXNG_SETTINGS_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_SETTINGS_PATH)
- if [ ! -r "${SEARX_SRC}" ]; then
- info_msg "not yet cloned: ${SEARX_SRC}"
- orig_source_dot_config
- return 0
- fi
- info_msg "using instance at: ${SEARX_SRC}"
-
- if [ -r "${SEARX_SRC}/.config.sh" ]; then
- info_msg "switching to ${SEARX_SRC}/.config.sh"
- DOT_CONFIG="${SEARX_SRC}/.config.sh"
- else
- info_msg "using local config: ${DOT_CONFIG}"
- fi
- init_SEARX_SRC_INIT_FILES
- fi
- }
- init_SEARX_SRC_INIT_FILES(){
-
-
-
-
-
-
-
-
-
-
- SEARX_SRC_INIT_FILES=()
- if [ ! -r "$SEARX_SRC" ]; then
- return 0
- fi
- local fname
- local msg=""
-
-
- while IFS= read -r fname; do
- if [ -z "$fname" ]; then
- continue
- fi
- if [ -r "${SEARX_SRC}/${fname}" ]; then
-
- if ! cmp --silent "${REPO_ROOT}/${fname}" "${SEARX_SRC}/${fname}"; then
- SEARX_SRC_INIT_FILES+=("${fname}")
- info_msg "local clone (workingtree), modified file: ./$fname"
- msg="to update use: sudo -H ./utils/searx.sh install init-src"
- fi
- fi
- done <<< "$(git diff --name-only)"
- [ -n "$msg" ] && info_msg "$msg"
- }
- install_log_searx_instance() {
- echo -e "---- SearXNG instance setup ${_BBlue}(status: $(install_searx_get_state))${_creset}"
- echo -e " SEARXNG_SETTINGS_PATH : ${_BBlue}${SEARXNG_SETTINGS_PATH}${_creset}"
- echo -e " SEARX_PYENV : ${_BBlue}${SEARX_PYENV}${_creset}"
- echo -e " SEARX_SRC : ${_BBlue}${SEARX_SRC:-none}${_creset}"
- echo -e " SEARXNG_URL : ${_BBlue}${SEARXNG_URL:-none}${_creset}"
- if in_container; then
-
-
- echo -e "---- container setup"
- echo -e " ${_BBlack}HINT:${_creset} searx only listen on loopback device" \
- "${_BBlack}inside${_creset} the container."
- for ip in $(global_IPs) ; do
- if [[ $ip =~ .*:.* ]]; then
- echo " container (IPv6): [${ip#*|}]"
- else
-
- echo " container (IPv4): ${ip#*|}"
- fi
- done
- fi
- }
- install_searx_get_state(){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if [ -f /etc/searx/settings.yml ]; then
- err_msg "settings.yml in /etc/searx/ is deprecated, move file to folder /etc/searxng/"
- fi
- if ! [ -r "${SEARX_SRC}" ]; then
- echo "missing-searx-clone"
- return
- fi
- if ! [ -f "${SEARX_PYENV}/bin/activate" ]; then
- echo "missing-searx-pyenv"
- return
- fi
- if ! [ -r "${SEARXNG_SETTINGS_PATH}" ]; then
- echo "missing-settings"
- return
- fi
- if ! [ ${#SEARX_SRC_INIT_FILES[*]} -eq 0 ]; then
- echo "installer-modified"
- return
- fi
- echo "python-installed"
- }
- source "${REPO_ROOT}/utils/brand.env"
- SEARXNG_URL="${SEARXNG_URL:-http://$(uname -n)}"
- if in_container; then
-
- SEARXNG_URL="http://$(primary_ip)"
- fi
- PUBLIC_URL="${SEARXNG_URL}"
- source_dot_config
- source "${REPO_ROOT}/utils/lxc-searx.env"
- in_container && lxc_set_suite_env
|