diff options
Diffstat (limited to 'utils/filtron.sh')
| -rwxr-xr-x | utils/filtron.sh | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/utils/filtron.sh b/utils/filtron.sh index eb34b2413..4e8d6aa5d 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -46,8 +46,8 @@ GO_VERSION="go1.17.2" GO_PKG_URL="https://golang.org/dl/${GO_VERSION}.linux-amd64.tar.gz" GO_TAR=$(basename "$GO_PKG_URL") -APACHE_FILTRON_SITE="searx.conf" -NGINX_FILTRON_SITE="searx.conf" +APACHE_FILTRON_SITE="searxng.conf" +NGINX_FILTRON_SITE="searxng.conf" # shellcheck disable=SC2034 CONFIG_FILES=( @@ -64,6 +64,7 @@ usage() { usage:: $(basename "$0") shell $(basename "$0") install [all|user|rules] + $(basename "$0") reinstall all $(basename "$0") update [filtron] $(basename "$0") remove [all] $(basename "$0") activate [service] @@ -77,9 +78,12 @@ shell start interactive shell from user ${SERVICE_USER} install / remove :all: complete setup of filtron service - :check: check the filtron installation :user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME) :rules: reinstall filtron rules $FILTRON_RULES +install + :check: check the filtron installation +reinstall: + :all: runs 'install/remove all' update filtron Update filtron installation ($SERVICE_HOME) activate service @@ -133,6 +137,16 @@ main() { ;; *) usage "$_usage"; exit 42;; esac ;; + reinstall) + rst_title "re-install $SERVICE_NAME" part + sudo_or_exit + case $2 in + all) + remove_all + install_all + ;; + *) usage "$_usage"; exit 42;; + esac ;; install) rst_title "$SERVICE_NAME" part sudo_or_exit @@ -271,9 +285,19 @@ install_check() { if [[ "${GO_VERSION}" > "$(go_version)" ]]; then warn_msg "golang ($(go_version)) needs to be $GO_VERSION at least" + warn_msg "you need to reinstall $SERVICE_USER --> $0 reinstall all" else info_msg "golang $(go_version) is installed (min needed is: $GO_VERSION)" fi + + if [ -f "${APACHE_SITES_AVAILABLE}/searx.conf" ]; then + warn_msg "old searx.conf apache site exists" + fi + + if [ -f "${NGINX_APPS_AVAILABLE}/searx.conf" ]; then + warn_msg "old searx.conf nginx site exists" + fi + } go_version(){ @@ -316,7 +340,7 @@ EOF cat > "$GO_ENV" <<EOF export GOPATH=\$HOME/go-apps -export PATH=\$PATH:\$HOME/local/go/bin:\$GOPATH/bin +export PATH=\$HOME/local/go/bin:\$GOPATH/bin:\$PATH EOF echo "Environment $GO_ENV has been setup." @@ -335,7 +359,7 @@ install_filtron() { rst_title "Install filtron in user's ~/go-apps" section echo tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" 2>&1 | prefix_stdout "$_svcpr" -go get -v -u github.com/asciimoo/filtron +go install -v github.com/asciimoo/filtron@latest EOF } @@ -343,7 +367,7 @@ update_filtron() { rst_title "Update filtron" section echo tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" 2>&1 | prefix_stdout "$_svcpr" -go get -v -u github.com/asciimoo/filtron +go install -v github.com/asciimoo/filtron@latest EOF } @@ -560,7 +584,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_FILTRON_SITE} # shellcheck disable=SC2034 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) # shellcheck disable=SC2034 - SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH) + SEARXNG_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_URL_PATH) nginx_install_app --variant=filtron "${NGINX_FILTRON_SITE}" info_msg "testing public url .." |