From d026486ce39d02f1e282024b397581b18f327135 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 19 Sep 2024 09:17:28 +0200 Subject: [PATCH] [fix] scripts: elimination of limitations on dedicated distributions The restriction of shell scripts to certain distributions is only required for certain actions such as the installation of a SearXNG instance. The maintenance scripts and build processes were previously also restricted to these specific distributions. With this patch, the build processes (such as the build of online documentation) can now also be executed on all Linux distributions. Signed-off-by: Markus Heiser --- utils/lib.sh | 21 +++++++++------------ utils/lxc.sh | 2 ++ utils/searxng.sh | 17 ++++++++++++++--- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/utils/lib.sh b/utils/lib.sh index b932b875c..7e80b12f1 100755 --- a/utils/lib.sh +++ b/utils/lib.sh @@ -958,7 +958,6 @@ nginx_distro_setup() { ;; esac } -nginx_distro_setup install_nginx(){ info_msg "installing nginx ..." @@ -1127,8 +1126,6 @@ apache_distro_setup() { esac } -apache_distro_setup - install_apache(){ info_msg "installing apache ..." pkg_install "$APACHE_PACKAGES" @@ -1291,8 +1288,6 @@ uWSGI_distro_setup() { esac } -uWSGI_distro_setup - install_uwsgi(){ info_msg "installing uwsgi ..." pkg_install "$uWSGI_PACKAGES" @@ -1685,13 +1680,15 @@ LXC_BASE_PACKAGES_fedora="bash git @development-tools python" # yum packages 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}" ;; - *) err_msg "$DIST_ID-$DIST_VERS: pkg_install LXC_BASE_PACKAGES not yet implemented" ;; -esac +lxc_distro_setup() { + 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}" ;; + *) err_msg "$DIST_ID-$DIST_VERS: pkg_install LXC_BASE_PACKAGES not yet implemented" ;; + esac +} lxc_install_base_packages() { info_msg "install LXC_BASE_PACKAGES in container $1" diff --git a/utils/lxc.sh b/utils/lxc.sh index 723451115..32f0ad9b3 100755 --- a/utils/lxc.sh +++ b/utils/lxc.sh @@ -135,6 +135,8 @@ main() { local exit_val local _usage="unknown or missing $1 command $2" + lxc_distro_setup + # don't check prerequisite when in recursion if [[ ! $1 == __* ]] && [[ ! $1 == --help ]]; then if ! in_container; then diff --git a/utils/searxng.sh b/utils/searxng.sh index c15c18218..a1bce5f9f 100755 --- a/utils/searxng.sh +++ b/utils/searxng.sh @@ -164,9 +164,16 @@ EOF } main() { - required_commands \ - sudo systemctl install git wget curl \ - || exit + case $1 in + install|remove|instance) + nginx_distro_setup + apache_distro_setup + uWSGI_distro_setup + required_commands \ + sudo systemctl install git wget curl \ + || exit + ;; + esac local _usage="unknown or missing $1 command $2" @@ -898,6 +905,10 @@ _searxng.instance.inspect() { } searxng.doc.rst() { + + local APACHE_SITES_AVAILABLE="/etc/apache2/sites-available" + local NGINX_APPS_AVAILABLE="/etc/nginx/default.apps-available" + local debian="${SEARXNG_PACKAGES_debian}" local arch="${SEARXNG_PACKAGES_arch}" local fedora="${SEARXNG_PACKAGES_fedora}"