Browse Source

[fix] make test.sh: fix various shellcheck error messages

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Markus Heiser 5 years ago
parent
commit
3e4d022d04
5 changed files with 12 additions and 6 deletions
  1. 1 0
      Makefile
  2. 1 0
      utils/lib.sh
  3. 6 3
      utils/lxc-searx.env
  4. 3 2
      utils/lxc.sh
  5. 1 1
      utils/morty.sh

+ 1 - 0
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

+ 1 - 0
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
 

+ 6 - 3
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

+ 3 - 2
utils/lxc.sh

@@ -104,7 +104,7 @@ cmd
   --             run command '...' in all containers of the LXC suite
   :<name>:       run command '...' in container <name>
 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 ;;

+ 1 - 1
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