mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-30 12:24:04 +02:00
SC2068
This commit is contained in:
@@ -11,7 +11,7 @@ JSONSOURCE="/data/options.json"
|
|||||||
# Export keys as env variables
|
# Export keys as env variables
|
||||||
# echo "All addon options were exported as variables"
|
# echo "All addon options were exported as variables"
|
||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
for KEYS in ${arr[@]}; do
|
for KEYS in "${arr[@]}"; do
|
||||||
# export key
|
# export key
|
||||||
VALUE=$(jq ."$KEYS" ${JSONSOURCE})
|
VALUE=$(jq ."$KEYS" ${JSONSOURCE})
|
||||||
line="${KEYS}=${VALUE//[\"\']/}"
|
line="${KEYS}=${VALUE//[\"\']/}"
|
||||||
@@ -26,7 +26,7 @@ done
|
|||||||
################
|
################
|
||||||
# Set timezone #
|
# Set timezone #
|
||||||
################
|
################
|
||||||
if [ -n "TZ" ] && [ -f /etc/localtime ]; then
|
if [ -n "$TZ" ] && [ -f /etc/localtime ]; then
|
||||||
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
|
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
|
||||||
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
||||||
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
|
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ if [ -f ${JSONTOCHECK} ]; then
|
|||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
|
|
||||||
# Check if all keys are still there, or add them
|
# Check if all keys are still there, or add them
|
||||||
for KEYS in ${arr[@]}; do
|
for KEYS in "${arr[@]}"; do
|
||||||
# Check if key exists
|
# Check if key exists
|
||||||
KEYSTHERE=$(jq "has(\"${KEYS}\")" ${JSONTOCHECK})
|
KEYSTHERE=$(jq "has(\"${KEYS}\")" ${JSONTOCHECK})
|
||||||
if [ $KEYSTHERE != "true" ]; then
|
if [ $KEYSTHERE != "true" ]; then
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ if [ -f ${JSONTOCHECK} ]; then
|
|||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
|
|
||||||
# Check if all keys are still there, or add them
|
# Check if all keys are still there, or add them
|
||||||
for KEYS in ${arr[@]}; do
|
for KEYS in "${arr[@]}"; do
|
||||||
# Check if key exists
|
# Check if key exists
|
||||||
KEYSTHERE=$(jq "has(\"${KEYS}\")" ${JSONTOCHECK})
|
KEYSTHERE=$(jq "has(\"${KEYS}\")" ${JSONTOCHECK})
|
||||||
if [ $KEYSTHERE != "true" ]; then
|
if [ $KEYSTHERE != "true" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user