Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ssh/rootfs/etc/s6-overlay/s6-rc.d/init-user/run
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,15 @@ fi

# Executes user configured/requested commands on startup
if bashio::config.has_value 'init_commands'; then
while read -r cmd; do
# Use bashio::config to properly iterate over the array, preserving multi-line commands
length=$(bashio::config 'init_commands | length') \
|| bashio::exit.nok 'Failed to get init_commands array length'

for (( i=0; i<length; i++ )); do
cmd=$(bashio::config "init_commands[${i}]") \
|| bashio::exit.nok "Failed to get init command at index ${i}"

eval "${cmd}" \
|| bashio::exit.nok "Failed executing init command: ${cmd}"
done <<< "$(bashio::config 'init_commands')"
done
fi