mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-08 08:35:57 +02:00
Update 99-run.sh
This commit is contained in:
@@ -48,22 +48,31 @@ cd /data || true
|
|||||||
|
|
||||||
# Fetch commands
|
# Fetch commands
|
||||||
CMD_ARGUMENTS="$(bashio::config "CMD_ARGUMENTS")"
|
CMD_ARGUMENTS="$(bashio::config "CMD_ARGUMENTS")"
|
||||||
CURRENTIFS="$IFS"
|
|
||||||
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
|
# Add docker-entrypoint command
|
||||||
# Print each value of the array by using the loop
|
# Print each value of the array by using the loop
|
||||||
for val in "${strarr[@]}";
|
for val in "${strarr[@]}";
|
||||||
do
|
do
|
||||||
|
#Removes whitespaces
|
||||||
|
val="$(trim $val)"
|
||||||
echo " "
|
echo " "
|
||||||
bashio::log.info "Starting the app with arguments $val"
|
bashio::log.info "Starting the app with arguments $val"
|
||||||
echo " "
|
echo " "
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
docker-entrypoint.sh "$val" || true
|
docker-entrypoint.sh "$val"
|
||||||
done
|
done
|
||||||
|
|
||||||
IFS="$CURRENTIFS"
|
|
||||||
|
|
||||||
bashio::log.info "All actions concluded, addon will stop"
|
bashio::log.info "All actions concluded, addon will stop"
|
||||||
bashio::addon.stop
|
bashio::addon.stop
|
||||||
|
|||||||
Reference in New Issue
Block a user