| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 | #!/usr/bin/env bash# SPDX-License-Identifier: AGPL-3.0-or-later# shellcheck disable=SC2001# shellcheck source=utils/lib.shsource "$(dirname "${BASH_SOURCE[0]}")/lib.sh"# shellcheck source=utils/brand.envsource "${REPO_ROOT}/utils/brand.env"# ----------------------------------------------------------------------------# 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 <<EOFusage::  $(basename "$0") remove     allremove all:    complete uninstall of SearXNG serviceenvironment:  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 removeinstallations 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 forgett 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 "$@"# ----------------------------------------------------------------------------
 |