From 6568ca1c613ca91b2897ffdf404f75efe6ad1c43 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 18 Nov 2021 16:23:49 +0100 Subject: [PATCH] Update entrypoint.sh --- enedisgateway2mqtt/rootfs/entrypoint.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/enedisgateway2mqtt/rootfs/entrypoint.sh b/enedisgateway2mqtt/rootfs/entrypoint.sh index 8625994ca..dd05edcca 100644 --- a/enedisgateway2mqtt/rootfs/entrypoint.sh +++ b/enedisgateway2mqtt/rootfs/entrypoint.sh @@ -1,5 +1,7 @@ #!/bin/bash +echo "Starting..." + ################################### # Export all addon options as env # ################################### @@ -7,18 +9,30 @@ # For all keys in options.json JSONSOURCE="/data/options.json" -# Export keys as env variables +# Export keys as env variables +echo "All addon options were exported as variables" mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) for KEYS in ${arr[@]}; do # export key export $(echo "${KEYS}=$(jq .$KEYS ${JSONSOURCE})") done +################ +# Set timezone # +################ +if [ ! -z "TZ" ]; then + if [ -f /usr/share/zoneinfo/$TZ ]; then + echo "Timezone set from $(cat /etc/timezone) to $TZ" + ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + else + echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" + fi +fi + #################### # Starting scripts # #################### -echo "Starting scripts :" for SCRIPTS in scripts/*; do [ -e "$SCRIPTS" ] || continue echo "$SCRIPTS: executing"