From 3eede4fdddffb2484f2387f3c6547f0a22d0f80c Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 25 Jul 2018 18:34:28 +0200 Subject: [PATCH] Ensure /etc/timezone also includes the TIMEZONE setting Quoting from the bug report: | The timezone is currently setup in chroot-script:timezone(), but | that function only sets up /etc/localtime but not /etc/timezone. | The problem is that you end up with one set to Europe/Vienna and | the other set to Etc/UTC. | | This can greatly confuse the system, due to some libraries/tools | parsing the former, and other the latter. | | So that function should probably also update /etc/timezone, with | the TIMEZONE value. So write the $TIMEZONE setting to /etc/timezone. Closes: #904607 Thanks: Guillem Jover --- chroot-script | 8 ++++++-- config | 2 +- travis/goss.yaml | 8 ++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/chroot-script b/chroot-script index 766a59d..4a20fa7 100755 --- a/chroot-script +++ b/chroot-script @@ -465,8 +465,12 @@ default_locales() { # adjust timezone {{{ timezone() { if [ -n "$TIMEZONE" ] ; then - echo "Adjusting /etc/localtime" - ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime + echo "Adjusting /etc/localtime" + ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime + + echo "Setting /etc/timezone to $TIMEZONE" + printf '%s\n' "$TIMEZONE" > /etc/timezone + fi } # }}} diff --git a/config b/config index c4d3b8e..6638a44 100644 --- a/config +++ b/config @@ -187,7 +187,7 @@ # Default: 'en_US:en' # DEFAULT_LANGUAGE='en_US:en' -# Use /usr/share/zoneinfo/$TIMEZONE for /etc/localtime. +# Use /usr/share/zoneinfo/$TIMEZONE for /etc/localtime + set /etc/timezone. # Default: 'Europe/Vienna' # TIMEZONE='Europe/Vienna' diff --git a/travis/goss.yaml b/travis/goss.yaml index a504d1f..97b75d8 100644 --- a/travis/goss.yaml +++ b/travis/goss.yaml @@ -1,3 +1,11 @@ process: sshd: running: true +file: + /etc/timezone: + exists: true + contains: ["Europe/Vienna"] + /etc/localtime: + filetype: symlink + exists: true + linked-to: /usr/share/zoneinfo/Europe/Vienna -- 2.1.4