base: fix setting timezone

This commit is contained in:
Saúl Ibarra Corretgé 2020-05-26 23:23:43 +02:00
parent 58441ae06c
commit 8e7ea34c50
1 changed files with 8 additions and 4 deletions

View File

@ -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