From 2fbb16e29884fdba9a42c3db1dc4cdd32c4146e8 Mon Sep 17 00:00:00 2001 From: SuperITMan Date: Sun, 14 Aug 2016 03:29:43 +0200 Subject: [PATCH] Correction in docker-entrypoint.sh Container didn't work if timezone was not linked --- docker-entrypoint.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 444521b..7097dc1 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,13 +1,15 @@ #!/bin/bash function setTimeZone { - CLIENT_TIMEZONE=$(cat /etc/timezone) - HOST_TIMEZONE=$(cat /etc/timezone.host) + if [ -f "/etc/timezone.host" ]; then + CLIENT_TIMEZONE=$(cat /etc/timezone) + HOST_TIMEZONE=$(cat /etc/timezone.host) - if [ "${CLIENT_TIMEZONE}" != "${HOST_TIMEZONE}" ]; then - echo "Reconfigure timezone to "${HOST_TIMEZONE} - echo ${HOST_TIMEZONE} > /etc/timezone - dpkg-reconfigure -f noninteractive tzdata + if [ "${CLIENT_TIMEZONE}" != "${HOST_TIMEZONE}" ]; then + echo "Reconfigure timezone to "${HOST_TIMEZONE} + echo ${HOST_TIMEZONE} > /etc/timezone + dpkg-reconfigure -f noninteractive tzdata + fi fi }