mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-19 13:59:15 +02:00
Correct shebang for custom scripts
This commit is contained in:
@@ -44,6 +44,13 @@ fi
|
|||||||
dos2unix "$CONFIGSOURCE" &>/dev/null || true
|
dos2unix "$CONFIGSOURCE" &>/dev/null || true
|
||||||
chmod +x "$CONFIGSOURCE"
|
chmod +x "$CONFIGSOURCE"
|
||||||
|
|
||||||
|
# Get current shebang, if not available use another
|
||||||
|
currentshebang="$(sed -n '1{s/^#![[:blank:]]*//p;q}' "$CONFIGSOURCE")"
|
||||||
|
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%% *}" ]; then break; fi; done
|
||||||
|
sed -i "s|$currentshebang|$shebang|g" "$CONFIGSOURCE"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if there is actual commands
|
# Check if there is actual commands
|
||||||
while IFS= read -r line
|
while IFS= read -r line
|
||||||
do
|
do
|
||||||
|
|||||||
Reference in New Issue
Block a user