summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-03-07 05:57:49 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-03-07 05:57:49 +0100
commit41f3e900795200fc5f653f21018f6806af9cc12c (patch)
tree9ae1a18fe3c3bd3e6ecd64ed6db102d15f8973b5
parent481e89d5dea5f9f19f1095a1a79ac2f6c8935fc4 (diff)
downloaddocker-41f3e900795200fc5f653f21018f6806af9cc12c.tar.gz
Add a function to set the system timezone (and treat php.ini while you're at it)
-rw-r--r--00-base/functions.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/00-base/functions.sh b/00-base/functions.sh
index 8523da7..ea910f3 100644
--- a/00-base/functions.sh
+++ b/00-base/functions.sh
@@ -22,6 +22,27 @@ function check_vars() {
return ${retval}
}
+function configure_timezone() {
+ if [ -f "/usr/share/zoneinfo/$1" ]; then
+ timezone=$1
+ else
+ echo "WARNING: Invalid timezone $1, using UTC"
+ timezone="UTC"
+ fi
+
+ ln -vf \
+ /usr/share/zoneinfo/${timezone} \
+ /etc/localtime
+
+ if [ -f "/etc/php.ini" ]; then
+ sed -i -r \
+ -e '/^date.timezone/d' \
+ -e '/^;date.timezone/d' \
+ -e "s|\[Date\]|[Date]\ndate.timezone = ${timezone}|g" \
+ /etc/php.ini
+ fi
+}
+
function domain_to_root_dn() {
echo "dc=$(echo $1 | sed -e 's/\./,dc=/g')"
}