From a1eb71ac442d1ea0bbcedd59d73dc2a248fb6914 Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 11 Sep 2017 17:57:38 +0100 Subject: [PATCH 1/2] Added getting current timezone via /etc/localtime The Current version only works on Debain based distros, I've tested my edited version on Centos 7 and Arch Linux works with no issues. --- generate_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_config.sh b/generate_config.sh index 4ef1515f..3cfd982f 100755 --- a/generate_config.sh +++ b/generate_config.sh @@ -16,7 +16,7 @@ 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/timezone ]] && TZ=$(cat /etc/timezone) || [[ -a /etc/localtime ]] && TZ=$(realpath /etc/localtime|sed -n 's|^.*zoneinfo/||p') if [ -z "$TZ" ]; then read -p "Timezone: " -ei "Europe/Berlin" TZ else From 01e1b5bb91b8993f6d817e4ee3030214239499fd Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 11 Sep 2017 18:24:54 +0100 Subject: [PATCH 2/2] Use readlink Instead of realpath --- generate_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_config.sh b/generate_config.sh index 3cfd982f..cbfab969 100755 --- a/generate_config.sh +++ b/generate_config.sh @@ -16,7 +16,7 @@ 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=$(realpath /etc/localtime|sed -n 's|^.*zoneinfo/||p') +[[ -a /etc/timezone ]] && TZ=$(cat /etc/timezone) || [[ -a /etc/localtime ]] && TZ=$(readlink /etc/localtime|sed -n 's|^.*zoneinfo/||p') if [ -z "$TZ" ]; then read -p "Timezone: " -ei "Europe/Berlin" TZ else