From 683ca69b7d5f311e73b0323b04228f74debc7306 Mon Sep 17 00:00:00 2001 From: Yannick Schinko Date: Mon, 10 Feb 2020 10:26:28 +0100 Subject: [PATCH] Fix checking the boolean flag ``[[ $flag ]]`` checks if the variable is not empty. Not if it's true or false. Which means it will always succeed, because both possible values (``true`` and ``false``) are not empty. An alternative would be ``[[ "$flag" = "true" ]]``. Fixes some points mentioned in #489. Doesn't address changing `pip` to `pip3` (or maybe even ``python3 -m pip``) or the missing detection of the version number. --- mopidy_iris/system.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mopidy_iris/system.sh b/mopidy_iris/system.sh index 8cab6273..d7a69c66 100755 --- a/mopidy_iris/system.sh +++ b/mopidy_iris/system.sh @@ -7,7 +7,7 @@ else fi if [[ $1 = "upgrade" ]]; then - if [[ $IS_CONTAINER ]]; then + if $IS_CONTAINER; then echo "cd /iris && git checkout master && git pull origin master" UPGRADE="$(cd /iris && git checkout master && git pull origin master)" else @@ -17,7 +17,7 @@ if [[ $1 = "upgrade" ]]; then echo -e "${UPGRADE}" elif [[ $1 = "restart" ]]; then - if [[ $IS_CONTAINER ]]; then + if $IS_CONTAINER; then echo -e "Cannot restart Mopidy when running in a Docker container" exit 1 else @@ -26,8 +26,7 @@ elif [[ $1 = "restart" ]]; then fi elif [[ $1 = "local_scan" ]]; then - - if [[ $IS_CONTAINER ]]; then + if $IS_CONTAINER; then SCAN="$(mopidy --config /config/mopidy.conf local scan)" else SCAN="$(sudo mopidyctl local scan)" @@ -38,7 +37,6 @@ elif [[ $1 = "check" ]]; then echo -e "Access permitted" elif [[ $1 = "test" ]]; then - sleep 3 TEST=$(echo "Hello, this is your bash speaking. I was sleeping for 3 seconds. Is running a container: $IS_CONTAINER") @@ -49,4 +47,4 @@ else exit 1 fi -exit 0 \ No newline at end of file +exit 0