From aee1d903a4496e02a66624e501b87a193bfc0317 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 2 Mar 2025 14:30:53 +0100 Subject: [PATCH] Fix shebang test --- .templates/ha_entrypoint.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.templates/ha_entrypoint.sh b/.templates/ha_entrypoint.sh index 3575265c1..092d6d7a3 100755 --- a/.templates/ha_entrypoint.sh +++ b/.templates/ha_entrypoint.sh @@ -27,8 +27,10 @@ for SCRIPTS in /etc/cont-init.d/*; do # Get current shebang, if not available use another currentshebang="$(sed -n '1{s/^#![[:blank:]]*//p;q}' "$SCRIPTS")" if [ ! -f "${currentshebang%% *}" ]; then - for shebang in "/command/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/bin/bash" "/bin/sh"; do - if [ -f "${shebang%% *}" ] && [[ "${shebang%% *} echo \"yes\"" ]]; then + for shebang in "/command/with-contenv bashio" "/usr/bin/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/usr/bin/bash" "/usr/bin/sh" "/bin/bash" "/bin/sh"; do + command_path="${shebang%% *}" + if [ -x "$command_path" ] && "$command_path" echo "yes" >/dev/null 2>&1; then + echo "Valid shebang: $shebang" break fi done