TZ if possible

This commit is contained in:
Alexandre
2021-11-19 11:02:42 +01:00
parent 934460af77
commit 7338380b4e
4 changed files with 8 additions and 8 deletions

View File

@@ -15,13 +15,13 @@ 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})
export ${KEYS}=${VALUE//[\"\']/} export ${KEYS}=${VALUE//[\"\']/} &>/dev/null
done done
################ ################
# Set timezone # # Set timezone #
################ ################
if [ ! -z "TZ" ]; then if [ ! -z "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

View File

@@ -15,13 +15,13 @@ 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})
export ${KEYS}=${VALUE//[\"\']/} export ${KEYS}=${VALUE//[\"\']/} &>/dev/null
done done
################ ################
# Set timezone # # Set timezone #
################ ################
if [ ! -z "TZ" ]; then if [ ! -z "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

View File

@@ -15,13 +15,13 @@ 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})
export ${KEYS}=${VALUE//[\"\']/} export ${KEYS}=${VALUE//[\"\']/} &>/dev/null
done done
################ ################
# Set timezone # # Set timezone #
################ ################
if [ ! -z "TZ" ]; then if [ ! -z "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

View File

@@ -15,13 +15,13 @@ 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})
export ${KEYS}=${VALUE//[\"\']/} export ${KEYS}=${VALUE//[\"\']/} &>/dev/null
done done
################ ################
# Set timezone # # Set timezone #
################ ################
if [ ! -z "TZ" ]; then if [ ! -z "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