@@ -11,17 +11,20 @@ source_dot_config
1111# ----------------------------------------------------------------------------
1212
1313PUBLIC_URL_PATH_MORTY="/morty"
14−PUBLIC_URL_MORTY="$(dirname ${PUBLIC_URL})${PUBLIC_URL_PATH_MORTY}"
14+PUBLIC_URL_MORTY="$(dirname "${PUBLIC_URL}")${PUBLIC_URL_PATH_MORTY}"
1515
1616MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
17+# shellcheck disable=SC2034
1718MORTY_TIMEOUT=5
1819
1920SERVICE_NAME="morty"
2021SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}"
21−SERVICE_HOME="/home/${SERVICE_USER}"
22+SERVICE_HOME_BASE="${SERVICE_HOME_BASE:-/usr/local}"
23+SERVICE_HOME="${SERVICE_HOME_BASE}/${SERVICE_USER}"
2224SERVICE_SYSTEMD_UNIT="${SYSTEMD_UNITS}/${SERVICE_NAME}.service"
2325# shellcheck disable=SC2034
2426SERVICE_GROUP="${SERVICE_USER}"
27+# shellcheck disable=SC2034
2528SERVICE_ENV_DEBUG=false
2629
2730GO_ENV="${SERVICE_HOME}/.go_env"
@@ -53,14 +56,15 @@ usage::
5356 $(basename "$0") inspect [service]
5457 $(basename "$0") option [debug-on|debug-off]
5558 $(basename "$0") apache [install|remove]
59+ $(basename "$0") info [searx]
5660
5761shell
5862 start interactive shell from user ${SERVICE_USER}
5963install / remove
6064 all: complete setup of morty service
61− user: add/remove service user '$SERVICE_USER' at $SERVICE_HOME
65+ user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
6266update morty
63− Update morty installation of user ${SERVICE_USER}
67+ Update morty installation ($SERVICE_HOME)
6468activate service
6569 activate and start service daemon (systemd unit)
6670deactivate service
@@ -77,17 +81,24 @@ If needed, set the environment variable MORTY_LISTEN in the
7781${DOT_CONFIG#"$REPO_ROOT/"} file::
7882
7983 MORTY_LISTEN : ${MORTY_LISTEN}
80− SERVICE_USER : ${SERVICE_USER}
84+ SERVICE_USER : ${SERVICE_USER}
85+EOF
86+ info_searx
87+ [ ! -z ${1+x} ] && echo -e "$1"
88+}
89+
90+info_searx() {
91+ # shellcheck disable=SC1117
92+ cat <<EOF
8193
8294To activate morty in searx, add result_proxy to your settings.yml::
8395
8496 result_proxy:
8597 url : ${PUBLIC_URL_MORTY}/
8698
87−further read: https://asciimoo.github.io/searx/admin/morty.html
99+further read: ${DOCS_URL}/admin/morty.html
88100
89101EOF
90− [ ! -z ${1+x} ] && echo -e "$1"
91102}
92103
93104main() {
@@ -154,6 +165,11 @@ main() {
154165 remove) remove_apache_site ;;
155166 *) usage "$_usage"; exit 42;;
156167 esac ;;
168+ info)
169+ case $2 in
170+ searx) info_searx ;;
171+ *) usage "$_usage"; exit 42;;
172+ esac ;;
157173 option)
158174 sudo_or_exit
159175 case $2 in
@@ -176,7 +192,7 @@ install_all() {
176192 wait_key
177193 systemd_install_service "${SERVICE_NAME}" "${SERVICE_SYSTEMD_UNIT}"
178194 wait_key
179− echo
195+ info_searx
180196 if ! service_is_available "http://${MORTY_LISTEN}" ; then
181197 err_msg "Morty does not listening on: http://${MORTY_LISTEN}"
182198 fi
@@ -258,6 +274,7 @@ set_service_env_debug() {
258274
259275 # usage: set_service_env_debug [false|true]
260276
277+ # shellcheck disable=SC2034
261278 local SERVICE_ENV_DEBUG="${1:-false}"
262279 if systemd_remove_service "${SERVICE_NAME}" "${SERVICE_SYSTEMD_UNIT}"; then
263280 systemd_install_service "${SERVICE_NAME}" "${SERVICE_SYSTEMD_UNIT}"
@@ -308,9 +325,9 @@ EOF
308325 systemctl --no-pager -l status "${SERVICE_NAME}"
309326 echo
310327
311− # shellcheck disable=SC2059
312328 info_msg "morty URL --> http://${MORTY_LISTEN}"
313329 info_msg "public URL --> ${PUBLIC_URL_MORTY}"
330+ # shellcheck disable=SC2059
314331 printf "// use ${_BCyan}CTRL-C${_creset} to stop monitoring the log"
315332 read -r -s -n1 -t 2
316333 echo