From 2893a63ea06738e058f875782f4c42934a210b4a Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 13 Sep 2017 16:59:59 +0100 Subject: [PATCH] Rewrite the if so it works correctly My last edit of this file caused issue even if /etc/timezone existed it wouldn't use the timezone value of it, the only file i would try to get the timezone out of is /etc/localtime. --- generate_config.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/generate_config.sh b/generate_config.sh index cbfab969..2d03891e 100755 --- a/generate_config.sh +++ b/generate_config.sh @@ -16,7 +16,12 @@ if [ -z "$MAILCOW_HOSTNAME" ]; then read -p "Hostname (FQDN): " -ei "mx.example.org" MAILCOW_HOSTNAME fi -[[ -a /etc/timezone ]] && TZ=$(cat /etc/timezone) || [[ -a /etc/localtime ]] && TZ=$(readlink /etc/localtime|sed -n 's|^.*zoneinfo/||p') +if [[ -a /etc/timezone ]]; then + TZ=$(cat /etc/timezone) +elif [[ -a /etc/localtime ]]; then + TZ=$(readlink /etc/localtime|sed -n 's|^.*zoneinfo/||p') +fi + if [ -z "$TZ" ]; then read -p "Timezone: " -ei "Europe/Berlin" TZ else