Update entrypoint.sh

This commit is contained in:
Alexandre
2021-11-18 16:24:31 +01:00
committed by GitHub
parent e76238cc5c
commit c1016e3a6e

View File

@@ -1,6 +1,38 @@
#!/bin/bash
echo "Starting scripts :"
echo "Starting..."
###################################
# Export all addon options as env #
###################################
# For all keys in options.json
JSONSOURCE="/data/options.json"
# 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 #
####################
for SCRIPTS in scripts/*; do
[ -e "$SCRIPTS" ] || continue
echo "$SCRIPTS: executing"