From 3e4d022d0425e4f7647573c97f105aa5208e5537 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 30 Mar 2020 11:03:46 +0200 Subject: [PATCH] [fix] make test.sh: fix various shellcheck error messages Signed-off-by: Markus Heiser --- Makefile | 1 + utils/lib.sh | 1 + utils/lxc-searx.env | 9 ++++++--- utils/lxc.sh | 5 +++-- utils/morty.sh | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 60d31690c..8fa8e4f85 100644 --- a/Makefile +++ b/Makefile @@ -219,6 +219,7 @@ test.pylint: pyenvinstall # ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported! test.sh: + shellcheck -x -s bash utils/brand.env shellcheck -x utils/lib.sh shellcheck -x utils/filtron.sh shellcheck -x utils/searx.sh diff --git a/utils/lib.sh b/utils/lib.sh index 632d47b5b..76173d8a9 100755 --- a/utils/lib.sh +++ b/utils/lib.sh @@ -1079,6 +1079,7 @@ in_container() { LXC_ENV_FOLDER= if in_container; then + # shellcheck disable=SC2034 LXC_ENV_FOLDER="lxc/$(hostname)/" fi diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index 123108bf7..a5de6c3de 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -32,11 +32,13 @@ lxc_set_suite_env() { export MORTY_LISTEN="0.0.0.0:3000" } -lxc_suite_install_info="suite includes searx, morty & filtron" +# shellcheck disable=SC2034 +LXC_SUITE_INSTALL_INFO="suite includes searx, morty & filtron" lxc_suite_install() { ( lxc_set_suite_env - export FORCE_TIMEOUT=0 + FORCE_TIMEOUT=0 + export FORCE_TIMEOUT "${LXC_REPO_ROOT}/utils/searx.sh" install all "${LXC_REPO_ROOT}/utils/morty.sh" install all "${LXC_REPO_ROOT}/utils/filtron.sh" install all @@ -50,7 +52,8 @@ lxc_suite_install() { lxc_suite_prepare_buildhost() { ( lxc_set_suite_env - export FORCE_TIMEOUT=0 + FORCE_TIMEOUT=0 + export FORCE_TIMEOUT # "${LXC_REPO_ROOT}/utils/searx.sh* install packages "${LXC_REPO_ROOT}/utils/searx.sh" install buildhost rst_title "buildhost installation finished ($(hostname))" part diff --git a/utils/lxc.sh b/utils/lxc.sh index 6070735ea..b03ce2af8 100755 --- a/utils/lxc.sh +++ b/utils/lxc.sh @@ -104,7 +104,7 @@ cmd -- run command '...' in all containers of the LXC suite :: run command '...' in container install - :suite: install LXC suite; ${lxc_suite_install_info} + :suite: install LXC suite; ${LXC_SUITE_INSTALL_INFO} :base: prepare LXC; install basic packages :buildhost: prepare LXC; install buildhost packages @@ -241,13 +241,14 @@ main() { sudo_or_exit case $2 in suite|base|buildhost) - lxc_exec "${LXC_REPO_ROOT}/utils/lxc.sh" __install $2 + lxc_exec "${LXC_REPO_ROOT}/utils/lxc.sh" __install "$2" ;; *) usage "$_usage"; exit 42 ;; esac ;; __install) # wrapped install commands, called once in each container + # shellcheck disable=SC2119 case $2 in suite) lxc_suite_install ;; base) FORCE_TIMEOUT=0 lxc_install_base_packages ;; diff --git a/utils/morty.sh b/utils/morty.sh index a20cde36c..e6e14be8a 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -16,7 +16,7 @@ in_container && lxc_set_suite_env PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}" PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty}" -PUBLIC_URL_MORTY="$(echo $PUBLIC_URL | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}" +PUBLIC_URL_MORTY="$(echo "$PUBLIC_URL" | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}" MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}" # shellcheck disable=SC2034