summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/brand.env2
-rwxr-xr-xutils/lib.sh18
-rw-r--r--utils/lxc-searx.env4
-rwxr-xr-xutils/lxc.sh5
-rw-r--r--utils/makefile.include2
-rw-r--r--utils/makefile.lxc7
-rw-r--r--utils/makefile.python28
-rw-r--r--utils/makefile.sphinx10
-rwxr-xr-xutils/searx.sh16
-rwxr-xr-xutils/standalone_searx.py2
10 files changed, 53 insertions, 41 deletions
diff --git a/utils/brand.env b/utils/brand.env
index 660160e43..2e763159d 100644
--- a/utils/brand.env
+++ b/utils/brand.env
@@ -4,4 +4,4 @@ export ISSUE_URL='https://github.com/searx/searx/issues'
export SEARX_URL='https://searx.me'
export DOCS_URL='https://searx.github.io/searx'
export PUBLIC_INSTANCES='https://searx.space'
-export CONTACT_URL='mailto:contact@example.com'
+export CONTACT_URL=''
diff --git a/utils/lib.sh b/utils/lib.sh
index 0d93138cc..8ae6bdd44 100755
--- a/utils/lib.sh
+++ b/utils/lib.sh
@@ -41,7 +41,7 @@ DOT_CONFIG="${DOT_CONFIG:-${REPO_ROOT}/.config.sh}"
source_dot_config() {
if [[ ! -e "${DOT_CONFIG}" ]]; then
- err_msg "configuration does not extsts at: ${DOT_CONFIG}"
+ err_msg "configuration does not exists at: ${DOT_CONFIG}"
return 42
fi
# shellcheck disable=SC1090
@@ -159,7 +159,7 @@ clean_stdin() {
}
wait_key(){
- # usage: waitKEY [<timeout in sec>]
+ # usage: wait_key [<timeout in sec>]
clean_stdin
local _t=$1
@@ -639,7 +639,7 @@ nginx_distro_setup() {
NGINX_DEFAULT_SERVER=/etc/nginx/nginx.conf
# Including *location* directives from a dedicated config-folder into the
- # server directive is, what what fedora and centos (already) does.
+ # server directive is, what fedora and centos (already) does.
NGINX_APPS_ENABLED="/etc/nginx/default.d"
# We add a apps-available folder and linking configurations into the
@@ -692,7 +692,7 @@ nginx_reload() {
nginx_install_app() {
- # usage: nginx_install_app [<template option> ...] <myapp>
+ # usage: nginx_install_app [<template option> ...] <myapp.conf>
#
# <template option>: see install_template
@@ -1381,7 +1381,7 @@ in_container() {
LXC_ENV_FOLDER=
if in_container; then
# shellcheck disable=SC2034
- LXC_ENV_FOLDER="lxc/$(hostname)/"
+ LXC_ENV_FOLDER="lxc-env/$(hostname)/"
fi
lxc_init_container_env() {
@@ -1413,8 +1413,8 @@ LXC_BASE_PACKAGES_centos="bash git python3"
case $DIST_ID in
ubuntu|debian) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_debian}" ;;
arch) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_arch}" ;;
- fedora) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_fedora}" ;;
- centos) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_centos}" ;;
+ fedora) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_fedora}" ;;
+ centos) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_centos}" ;;
*) err_msg "$DIST_ID-$DIST_VERS: pkg_install LXC_BASE_PACKAGES not yet implemented" ;;
esac
@@ -1429,9 +1429,9 @@ lxc_install_base_packages() {
lxc_image_copy() {
- # usage: lxc_copy_image <remote image> <local image>
+ # usage: lxc_image_copy <remote image> <local image>
#
- # lxc_copy_image "images:ubuntu/19.10" "ubu1910"
+ # lxc_image_copy "images:ubuntu/20.04" "ubu2004"
if lxc_image_exists "local:${LXC_SUITE[i+1]}"; then
info_msg "image ${LXC_SUITE[i]} already copied --> ${LXC_SUITE[i+1]}"
diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env
index 3ce10021b..3121b63ce 100644
--- a/utils/lxc-searx.env
+++ b/utils/lxc-searx.env
@@ -23,8 +23,8 @@ lxc_set_suite_env() {
# end of standard support see https://wiki.ubuntu.com/Releases
"$LINUXCONTAINERS_ORG_NAME:ubuntu/16.04" "ubu1604" # April 2021
"$LINUXCONTAINERS_ORG_NAME:ubuntu/18.04" "ubu1804" # April 2023
- "$LINUXCONTAINERS_ORG_NAME:ubuntu/19.10" "ubu1910" # July 2020
- "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.04" "ubu2004" # future (EOL 2030)
+ "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.04" "ubu2004" # April 2025
+ "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.10" "ubu2010" # July 2021
# EOL see https://fedoraproject.org/wiki/Releases
"$LINUXCONTAINERS_ORG_NAME:fedora/31" "fedora31"
diff --git a/utils/lxc.sh b/utils/lxc.sh
index 11dbe578d..39701ef04 100755
--- a/utils/lxc.sh
+++ b/utils/lxc.sh
@@ -32,14 +32,15 @@ apt-get install -y git curl wget
"
ubu1804_boilerplate="$ubu1604_boilerplate"
ubu1904_boilerplate="$ubu1804_boilerplate"
-ubu1910_boilerplate="$ubu1904_boilerplate"
# shellcheck disable=SC2034
ubu2004_boilerplate="
-$ubu1910_boilerplate
+$ubu1904_boilerplate
echo 'Set disable_coredump false' >> /etc/sudo.conf
"
+ubu2010_boilerplate="$ubu1904_boilerplate"
+
# shellcheck disable=SC2034
archlinux_boilerplate="
pacman -Syu --noconfirm
diff --git a/utils/makefile.include b/utils/makefile.include
index 35a5134d9..879dcc23c 100644
--- a/utils/makefile.include
+++ b/utils/makefile.include
@@ -5,7 +5,7 @@ PHONY += lxc-activate lxc-purge
lxc-activate:
@$(MAKE) -s -f "$$(dirname $(abspath $(lastword $(MAKEFILE_LIST))))/makefile.lxc" lxc-activate
lxc-purge:
- $(Q)rm -rf ./lxc
+ $(Q)rm -rf ./lxc-env
else
include /.lxcenv.mk
endif
diff --git a/utils/makefile.lxc b/utils/makefile.lxc
index fd999e40d..95a8d4317 100644
--- a/utils/makefile.lxc
+++ b/utils/makefile.lxc
@@ -9,10 +9,10 @@
# sudo make ./utils/makefile.lxc lxc-activate
# sudo make ./utils/makefile.lxc lxc-deactivate
-LXC_ENV_FOLDER=lxc/$(shell hostname)/
+LXC_ENV_FOLDER=lxc-env/$(shell hostname)/
lxc-help::
- @echo 'LXC: running in container LXC_ENV_FOLDER=$(LXC_ENV_FOLDER)'
+ @echo ' LXC: running in container LXC_ENV_FOLDER=$(LXC_ENV_FOLDER)'
# If not activated, serve target 'lxc-activate' ..
ifeq (,$(wildcard /.lxcenv.mk))
@@ -24,6 +24,9 @@ else
PHONY += lxc-deactivate
lxc-deactivate:
rm /.lxcenv.mk
+$(LXC_ENV_FOLDER):
+ $(Q)mkdir -p $(LXC_ENV_FOLDER)
+ $(Q)echo placeholder > $(LXC_ENV_FOLDER).placeholder
endif
.PHONY: $(PHONY)
diff --git a/utils/makefile.python b/utils/makefile.python
index 12e3e1236..5d0837e00 100644
--- a/utils/makefile.python
+++ b/utils/makefile.python
@@ -75,7 +75,9 @@ msg-python-exe:
https://www.python.org or install it from your package\n\
manager. On debian based OS these requirements are\n\
installed by::\n\n\
- sudo -H apt-get install $(PYTHON)\n" | $(FMT)
+ sudo -H add-apt-repository ppa:deadsnakes/ppa\n\
+ sudo -H apt update\n\
+ sudo -H apt-get install $(PYTHON) $(PYTHON)-venv\n"
ifeq ($(shell which $(PYTHON) >/dev/null 2>&1; echo $$?), 1)
python-exe: msg-python-exe
@@ -95,7 +97,13 @@ quiet_cmd_pyinstall = INSTALL $2
# $2 path to folder with setup.py, this uses pip from pyenv (not OS!)
quiet_cmd_pyenvinstall = PYENV install $2
- cmd_pyenvinstall = $(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) install -e $2$(PY_SETUP_EXTRAS)
+ cmd_pyenvinstall = \
+ if ! cat $(PY_ENV)/requirements.sha256 2>/dev/null | sha256sum --check --status 2>/dev/null; then \
+ $(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) install -e $2$(PY_SETUP_EXTRAS) ;\
+ sha256sum requirements*.txt > $(PY_ENV)/requirements.sha256 ;\
+ else \
+ echo "PYENV $2 already installed"; \
+ fi
# Uninstall the package. Since pip does not uninstall the no longer needed
# depencies (something like autoremove) the depencies remain.
@@ -113,13 +121,15 @@ quiet_cmd_virtualenv = PYENV usage: $ source ./$@/bin/activate
cmd_virtualenv = \
if [ ! -d "./$(PY_ENV)" ];then \
$(PYTHON) -m venv $(VTENV_OPTS) $2; \
+ $(PY_ENV_BIN)/python -m pip install $(PIP_VERBOSE) -U pip wheel setuptools; \
+ $(PY_ENV_BIN)/python -m pip install $(PIP_VERBOSE) -r requirements.txt; \
else \
echo "PYENV using virtualenv from $2"; \
fi
# $2 path to lint
quiet_cmd_pylint = LINT $@
- cmd_pylint = $(PY_ENV_BIN)/python -m pylint --rcfile $(PYLINT_RC) $2
+ cmd_pylint = $(PY_ENV_BIN)/python -m pylint -j 0 --rcfile $(PYLINT_RC) $2
quiet_cmd_pytest = TEST $@
cmd_pytest = $(PY_ENV_BIN)/python -m tox -vv
@@ -193,8 +203,6 @@ pyclean:
pyenv: $(PY_ENV)
$(PY_ENV): python-exe
$(call cmd,virtualenv,$(PY_ENV))
- $(Q)$(PY_ENV_BIN)/python -m pip install $(PIP_VERBOSE) -U pip wheel pip setuptools
- $(Q)$(PY_ENV_BIN)/python -m pip install $(PIP_VERBOSE) -r requirements.txt
PHONY += pylint-exe
pylint-exe: $(PY_ENV)
@@ -220,16 +228,8 @@ PHONY += pydebug
pydebug: $(PY_ENV)
DEBUG=$(DEBUG) $(PY_ENV_BIN)/pytest $(DEBUG) -v $(TEST_FOLDER)/$(TEST)
-# install / uninstall python objects into virtualenv (PYENV)
-pyenv-install: $(PY_ENV)
- @$(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) install -e .
- @echo "ACTIVATE $(call normpath,$(PY_ENV_ACT)) "
-
-pyenv-uninstall: $(PY_ENV)
- @$(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) uninstall --yes .
-
# runs python interpreter from ./local/py<N>/bin/python
-pyenv-python: pyenv-install
+pyenv-python: pyenvinstall
$(PY_ENV_BIN)/python -i
# With 'dependency_links=' setuptools supports dependencies on packages hosted
diff --git a/utils/makefile.sphinx b/utils/makefile.sphinx
index b4f298d50..e73686466 100644
--- a/utils/makefile.sphinx
+++ b/utils/makefile.sphinx
@@ -27,7 +27,7 @@ docs-help:
@echo ' docs-clean - clean intermediate doc objects'
@echo ' $(GH_PAGES) - create & upload github pages'
@echo ' sphinx-pdf - run sphinx latex & pdf targets'
- echo ''
+ @echo ''
@echo ' books/{name}.html : build only the HTML of document {name}'
@echo ' valid values for books/{name}.html are:'
@echo ' $(BOOKS_HTML)' | $(FMT)
@@ -99,7 +99,7 @@ sphinx-pdf: sphinx-latex
@echo "SPHINX *.pdf --> file://$(abspath $(DOCS_DIST)/pdf)"
PHONY += sphinx-latex
-sphinx-latex: texlive sphinx-doc
+sphinx-latex: pyenvinstall texlive
$(SPHINXBUILD) $(SPHINX_VERBOSE) $(SPHINXOPTS)\
-b latex \
-c $(DOCS_FOLDER) \
@@ -124,7 +124,7 @@ $(BOOKS_DIST):
mkdir -p $(BOOKS_DIST)
PHONY += $(BOOKS_HTML)
-$(BOOKS_HTML): sphinx-doc | $(BOOKS_DIST)
+$(BOOKS_HTML): pyenvinstall | $(BOOKS_DIST)
SPHINX_CONF=$(patsubst books/%.html,%,$@)/conf.py \
$(SPHINXBUILD) $(SPHINX_VERBOSE) $(SPHINXOPTS)\
-b html \
@@ -135,7 +135,7 @@ $(BOOKS_HTML): sphinx-doc | $(BOOKS_DIST)
@echo "SPHINX $@ --> file://$(abspath $(BOOKS_DIST)/$(patsubst books/%.html,%,$@))"
PHONY += $(BOOKS_HTML)
-$(BOOKS_LIVE): sphinx-live | $(BOOKS_DIST)
+$(BOOKS_LIVE): pyenvinstall | $(BOOKS_DIST)
PATH="$(PY_ENV_BIN):$(PATH)" \
SPHINX_CONF=$(patsubst books/%.live,%,$@)/conf.py \
$(PY_ENV_BIN)/sphinx-autobuild --poll -B --host 0.0.0.0 --port 8080 $(SPHINX_VERBOSE) $(SPHINXOPTS)\
@@ -152,7 +152,7 @@ $(BOOKS_PDF): %.pdf : %.latex
@echo "SPHINX $@ --> file://$(abspath $(BOOKS_DIST)/$(patsubst books/%.pdf,%,$@))/pdf"
PHONY += $(BOOKS_LATEX)
-$(BOOKS_LATEX): sphinx-doc | $(BOOKS_DIST)
+$(BOOKS_LATEX): pyenvinstall | $(BOOKS_DIST)
SPHINX_CONF=$(patsubst books/%.latex,%,$@)/conf.py \
$(SPHINXBUILD) $(SPHINX_VERBOSE) $(SPHINXOPTS)\
-b latex \
diff --git a/utils/searx.sh b/utils/searx.sh
index 5a24a016e..b7d3b8e1c 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"
@@ -50,7 +50,7 @@ shellcheck"
BUILD_PACKAGES_debian="\
firefox graphviz imagemagick texlive-xetex librsvg2-bin
-texlive-latex-recommended texlive-extra-utils ttf-dejavu
+texlive-latex-recommended texlive-extra-utils fonts-dejavu
latexmk"
# pacman packages
@@ -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
@@ -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"
@@ -412,7 +420,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
diff --git a/utils/standalone_searx.py b/utils/standalone_searx.py
index c52035fb9..89023f41b 100755
--- a/utils/standalone_searx.py
+++ b/utils/standalone_searx.py
@@ -15,7 +15,7 @@ Example to use this script:
.. code:: bash
- $ SEARX_DEBUG=1 python3 utils/standalone_searx.py rain
+ $ python3 utils/standalone_searx.py rain
Example to run it from python: