From 8e7ea34c50e6a0699326897da23fed79f5a0212c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 26 May 2020 23:23:43 +0200 Subject: [PATCH] base: fix setting timezone --- base/rootfs/etc/cont-init.d/01-set-timezone | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/base/rootfs/etc/cont-init.d/01-set-timezone b/base/rootfs/etc/cont-init.d/01-set-timezone index 957a7b6..71e6dec 100644 --- a/base/rootfs/etc/cont-init.d/01-set-timezone +++ b/base/rootfs/etc/cont-init.d/01-set-timezone @@ -1,6 +1,10 @@ -#!/usr/bin/with-contenv sh +#!/usr/bin/with-contenv bash -if [ $TZ ]; then - [ -f /usr/share/zoneinfo/$TZ ] && cp /usr/share/zoneinfo/$TZ /etc/localtime || echo "WARNING: $TZ is not a valid time zone." - [ -f /usr/share/zoneinfo/$TZ ] && echo "$TZ" > /etc/timezone +if [[ ! -z "$TZ" ]]; then + if [[ -f /usr/share/zoneinfo/$TZ ]]; then + ln -sf /usr/share/zoneinfo/$TZ /etc/localtime + echo "$TZ" > /etc/timezone + else + echo "WARNING: $TZ is not a valid time zone." + fi fi