From 32b91a4538ff84c7129481565cc8f6636458b322 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 4 Jun 2023 08:16:28 +0200 Subject: [PATCH] Update 99-run.sh --- .../rootfs/etc/cont-init.d/99-run.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh b/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh index ee1598089..cc2617740 100755 --- a/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh +++ b/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh @@ -48,22 +48,31 @@ cd /data || true # Fetch commands CMD_ARGUMENTS="$(bashio::config "CMD_ARGUMENTS")" -CURRENTIFS="$IFS" IFS=';' -read -a strarr <<< "$CMD_ARGUMENTS" +read -ar strarr <<< "$CMD_ARGUMENTS" + +# Sanitizes commands +trim() { + local var="$*" + # remove leading whitespace characters + var="${var#"${var%%[![:space:]]*}"}" + # remove trailing whitespace characters + var="${var%"${var##*[![:space:]]}"}" + printf '%s' "$var" +} # Add docker-entrypoint command # Print each value of the array by using the loop for val in "${strarr[@]}"; do + #Removes whitespaces + val="$(trim $val)" echo " " bashio::log.info "Starting the app with arguments $val" echo " " # shellcheck disable=SC2086 - docker-entrypoint.sh "$val" || true + docker-entrypoint.sh "$val" done -IFS="$CURRENTIFS" - bashio::log.info "All actions concluded, addon will stop" bashio::addon.stop