diff options
| author | Ivan Gabaldon <igabaldon@inetol.net> | 2025-05-13 21:10:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-13 21:10:02 +0200 |
| commit | 1a8884fa26bedf983516308e69b9863888cd397e (patch) | |
| tree | 962feae057a8d93bb78e704ea23a40c0da006fe2 /utils | |
| parent | 4fb29aae812aa464c12fd959fc24dd91934f6a3b (diff) | |
| parent | 2cfd3fc44b16e7f3c6010c0ac1004efb6dacf382 (diff) | |
[enh] tidy: clean old morty, filtron, searx references
Everyone should have already switched from legacy methods.
Diffstat (limited to 'utils')
| -rwxr-xr-x | utils/filtron.sh | 125 | ||||
| -rwxr-xr-x | utils/lib.sh | 4 | ||||
| -rwxr-xr-x | utils/morty.sh | 124 | ||||
| -rwxr-xr-x | utils/searx.sh | 88 | ||||
| -rwxr-xr-x | utils/searxng.sh | 9 | ||||
| -rw-r--r-- | utils/templates/lib/systemd/system/filtron.service | 29 | ||||
| -rw-r--r-- | utils/templates/lib/systemd/system/morty.service | 29 |
7 files changed, 2 insertions, 406 deletions
diff --git a/utils/filtron.sh b/utils/filtron.sh deleted file mode 100755 index 2ac3b6dfd..000000000 --- a/utils/filtron.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: AGPL-3.0-or-later -# shellcheck disable=SC2001 - -# shellcheck source=utils/lib.sh -source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" - -# ---------------------------------------------------------------------------- -# config -# ---------------------------------------------------------------------------- - -PUBLIC_URL="${PUBLIC_URL:-${SEARXNG_URL}}" - -FILTRON_ETC="/etc/filtron" - -SERVICE_NAME="filtron" -SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}" -SERVICE_SYSTEMD_UNIT="${SYSTEMD_UNITS}/${SERVICE_NAME}.service" - -APACHE_FILTRON_SITE="searx.conf" -NGINX_FILTRON_SITE="searx.conf" - -# ---------------------------------------------------------------------------- -usage() { -# ---------------------------------------------------------------------------- - - # shellcheck disable=SC1117 - cat <<EOF -usage:: - $(basename "$0") remove all - $(basename "$0") apache remove - $(basename "$0") nginx remove - -remove all : drop all components of the filtron service -apache remove : drop apache site ${APACHE_FILTRON_SITE} -nginx remove : drop nginx site ${NGINX_FILTRON_SITE} - -environment: - PUBLIC_URL : ${PUBLIC_URL} -EOF - - [[ -n ${1} ]] && err_msg "$1" -} - -main() { - local _usage="unknown or missing $1 command $2" - - case $1 in - -h|--help) usage; exit 0;; - remove) - sudo_or_exit - case $2 in - all) remove_all;; - *) usage "$_usage"; exit 42;; - esac ;; - apache) - sudo_or_exit - case $2 in - remove) remove_apache_site ;; - *) usage "$_usage"; exit 42;; - esac ;; - nginx) - sudo_or_exit - case $2 in - remove) remove_nginx_site ;; - *) usage "$_usage"; exit 42;; - esac ;; - *) usage "unknown or missing command $1"; exit 42;; - esac -} - -remove_all() { - rst_title "De-Install $SERVICE_NAME (service)" - - rst_para "\ -It goes without saying that this script can only be used to remove -installations that were installed with this script." - - if ! systemd_remove_service "${SERVICE_NAME}" "${SERVICE_SYSTEMD_UNIT}"; then - return 42 - fi - drop_service_account "${SERVICE_USER}" - rm -r "$FILTRON_ETC" 2>&1 | prefix_stdout - if service_is_available "${PUBLIC_URL}"; then - MSG="** Don't forget to remove your public site! (${PUBLIC_URL}) **" wait_key 10 - fi -} - -remove_apache_site() { - - rst_title "Remove Apache site $APACHE_FILTRON_SITE" - - rst_para "\ -This removes apache site ${APACHE_FILTRON_SITE}." - - ! apache_is_installed && err_msg "Apache is not installed." - - if ! ask_yn "Do you really want to continue?" Yn; then - return - fi - - apache_remove_site "$APACHE_FILTRON_SITE" - -} - -remove_nginx_site() { - - rst_title "Remove nginx site $NGINX_FILTRON_SITE" - - rst_para "\ -This removes nginx site ${NGINX_FILTRON_SITE}." - - ! nginx_is_installed && err_msg "nginx is not installed." - - if ! ask_yn "Do you really want to continue?" Yn; then - return - fi - - nginx_remove_app "$FILTRON_FILTRON_SITE" - -} - -# ---------------------------------------------------------------------------- -main "$@" -# ---------------------------------------------------------------------------- diff --git a/utils/lib.sh b/utils/lib.sh index ead4b0c61..d3d515c0a 100755 --- a/utils/lib.sh +++ b/utils/lib.sh @@ -1802,8 +1802,8 @@ url_replace_hostname(){ # to replace hostname by primary IP:: # - # url_replace_hostname http://searx-ubu1604/morty $(primary_ip) - # http://10.246.86.250/morty + # url_replace_hostname http://searx-ubu1604/example $(primary_ip) + # http://10.246.86.250/example # shellcheck disable=SC2001 echo "$1" | sed "s|\(http[s]*://\)[^/]*\(.*\)|\1$2\2|" diff --git a/utils/morty.sh b/utils/morty.sh deleted file mode 100755 index 52f0fec31..000000000 --- a/utils/morty.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: AGPL-3.0-or-later - -# shellcheck source=utils/lib.sh -source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" - -# ---------------------------------------------------------------------------- -# config -# ---------------------------------------------------------------------------- - -PUBLIC_URL="${PUBLIC_URL:-${SEARXNG_URL}}" - -MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}" -PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty/}" -PUBLIC_URL_MORTY="${PUBLIC_URL_MORTY:-$(echo "$PUBLIC_URL" | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}}" - -SERVICE_NAME="morty" -SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}" -SERVICE_SYSTEMD_UNIT="${SYSTEMD_UNITS}/${SERVICE_NAME}.service" - -# Apache Settings - -APACHE_MORTY_SITE="morty.conf" -NGINX_MORTY_SITE="morty.conf" - -# ---------------------------------------------------------------------------- -usage() { -# ---------------------------------------------------------------------------- - - # shellcheck disable=SC1117 - cat <<EOF -usage:: - $(basename "$0") remove all - $(basename "$0") apache remove - $(basename "$0") nginx remove - -remove all : drop all components of the morty service -apache remove : drop apache site ${APACHE_MORTY_SITE} -nginx remove : drop nginx site ${NGINX_MORTY_SITE} - -environment: - PUBLIC_URL_MORTY : ${PUBLIC_URL_MORTY} -EOF - - [[ -n ${1} ]] && err_msg "$1" -} - -main() { - local _usage="ERROR: unknown or missing $1 command $2" - - case $1 in - -h|--help) usage; exit 0;; - remove) - sudo_or_exit - case $2 in - all) remove_all;; - *) usage "$_usage"; exit 42;; - esac ;; - apache) - sudo_or_exit - case $2 in - remove) remove_apache_site ;; - *) usage "$_usage"; exit 42;; - esac ;; - nginx) - sudo_or_exit - case $2 in - remove) remove_nginx_site ;; - *) usage "$_usage"; exit 42;; - esac ;; - *) usage "ERROR: unknown or missing command $1"; exit 42;; - esac -} - - -remove_all() { - rst_title "De-Install $SERVICE_NAME (service)" - - rst_para "\ -It goes without saying that this script can only be used to remove -installations that were installed with this script." - - if systemd_remove_service "${SERVICE_NAME}" "${SERVICE_SYSTEMD_UNIT}"; then - drop_service_account "${SERVICE_USER}" - fi -} - - -remove_apache_site() { - - rst_title "Remove Apache site $APACHE_MORTY_SITE" - - rst_para "\ -This removes apache site ${APACHE_MORTY_SITE}." - - ! apache_is_installed && err_msg "Apache is not installed." - - if ! ask_yn "Do you really want to continue?" Yn; then - return - fi - - apache_remove_site "$APACHE_MORTY_SITE" -} - -remove_nginx_site() { - - rst_title "Remove nginx site $NGINX_MORTY_SITE" - - rst_para "\ -This removes nginx site ${NGINX_MORTY_SITE}." - - ! nginx_is_installed && err_msg "nginx is not installed." - - if ! ask_yn "Do you really want to continue?" Yn; then - return - fi - - nginx_remove_app "$NGINX_MORTY_SITE" - -} - -# ---------------------------------------------------------------------------- -main "$@" -# ---------------------------------------------------------------------------- diff --git a/utils/searx.sh b/utils/searx.sh deleted file mode 100755 index 1d339cd68..000000000 --- a/utils/searx.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: AGPL-3.0-or-later -# shellcheck disable=SC2001 - -# shellcheck source=utils/lib.sh -source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" - -# ---------------------------------------------------------------------------- -# config -# ---------------------------------------------------------------------------- - -PUBLIC_URL="${PUBLIC_URL:-${SEARXNG_URL}}" - -SERVICE_NAME="searx" -SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}" -SEARXNG_SETTINGS_PATH="/etc/searx/settings.yml" -SEARXNG_UWSGI_APP="searx.ini" - -# ---------------------------------------------------------------------------- -usage() { -# ---------------------------------------------------------------------------- - - # shellcheck disable=SC1117 - cat <<EOF -usage:: - $(basename "$0") remove all - -remove all: complete uninstall of SearXNG service - -environment: - PUBLIC_URL : ${PUBLIC_URL} -EOF - - [[ -n ${1} ]] && err_msg "$1" -} - -main() { - - local _usage="unknown or missing $1 command $2" - - case $1 in - remove) - rst_title "SearXNG (remove)" part - sudo_or_exit - case $2 in - all) remove_all;; - *) usage "$_usage"; exit 42;; - esac ;; - *) usage "unknown or missing command $1"; exit 42;; - esac -} - -remove_all() { - rst_title "De-Install SearXNG (service)" - - rst_para "\ -It goes without saying that this script can only be used to remove -installations that were installed with this script." - - if ! ask_yn "Do you really want to deinstall SearXNG?"; then - return - fi - remove_searx_uwsgi - drop_service_account "${SERVICE_USER}" - remove_settings - wait_key - if service_is_available "${PUBLIC_URL}"; then - MSG="** Don't forget to remove your public site! (${PUBLIC_URL}) **" wait_key 10 - fi -} - -remove_settings() { - rst_title "remove SearXNG settings" section - echo - info_msg "delete ${SEARXNG_SETTINGS_PATH}" - rm -f "${SEARXNG_SETTINGS_PATH}" -} - -remove_searx_uwsgi() { - rst_title "Remove SearXNG's uWSGI app (searxng.ini)" section - echo - uWSGI_remove_app "$SEARXNG_UWSGI_APP" -} - - -# ---------------------------------------------------------------------------- -main "$@" -# ---------------------------------------------------------------------------- diff --git a/utils/searxng.sh b/utils/searxng.sh index c6c9d5ea8..b34298e85 100755 --- a/utils/searxng.sh +++ b/utils/searxng.sh @@ -553,15 +553,6 @@ searxng.remove.settings() { searxng.check() { rst_title "SearXNG checks" section - - for NAME in "searx" "filtron" "morty"; do - if service_account_is_available "${NAME}"; then - err_msg "There exists an old '${NAME}' account from a previous installation." - else - info_msg "[OK] (old) account '${NAME}' does not exists" - fi - done - "${SEARXNG_PYENV}/bin/python" "${SEARXNG_SRC}/utils/searxng_check.py" } diff --git a/utils/templates/lib/systemd/system/filtron.service b/utils/templates/lib/systemd/system/filtron.service deleted file mode 100644 index 3b0c6edcc..000000000 --- a/utils/templates/lib/systemd/system/filtron.service +++ /dev/null @@ -1,29 +0,0 @@ -[Unit] - -Description=${SERVICE_NAME} -After=syslog.target -After=network.target - -[Service] - -Type=simple -User=${SERVICE_USER} -Group=${SERVICE_GROUP} -WorkingDirectory=${SERVICE_HOME} -ExecStart=${SERVICE_HOME}/go-apps/bin/filtron -api '${FILTRON_API}' -listen '${FILTRON_LISTEN}' -rules '${FILTRON_RULES}' -target '${FILTRON_TARGET}' - -Restart=always -Environment=USER=${SERVICE_USER} HOME=${SERVICE_HOME} - -# Some distributions may not support these hardening directives. If you cannot -# start the service due to an unknown option, comment out the ones not supported -# by your version of systemd. - -ProtectSystem=full -PrivateDevices=yes -PrivateTmp=yes -NoNewPrivileges=true - -[Install] - -WantedBy=multi-user.target diff --git a/utils/templates/lib/systemd/system/morty.service b/utils/templates/lib/systemd/system/morty.service deleted file mode 100644 index 25b676b51..000000000 --- a/utils/templates/lib/systemd/system/morty.service +++ /dev/null @@ -1,29 +0,0 @@ -[Unit] - -Description=${SERVICE_NAME} -After=syslog.target -After=network.target - -[Service] - -Type=simple -User=${SERVICE_USER} -Group=${SERVICE_GROUP} -WorkingDirectory=${SERVICE_HOME} -ExecStart=${SERVICE_HOME}/go-apps/bin/morty -key '${MORTY_KEY}' -listen '${MORTY_LISTEN}' -timeout ${MORTY_TIMEOUT} - -Restart=always -Environment=USER=${SERVICE_USER} HOME=${SERVICE_HOME} DEBUG=${SERVICE_ENV_DEBUG} - -# Some distributions may not support these hardening directives. If you cannot -# start the service due to an unknown option, comment out the ones not supported -# by your version of systemd. - -ProtectSystem=full -PrivateDevices=yes -PrivateTmp=yes -NoNewPrivileges=true - -[Install] - -WantedBy=multi-user.target |