Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
F #165: Support timedatectl in TIMEZONE context
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlastimil Holer committed Sep 12, 2019
1 parent 41ea670 commit 4e6abbb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/etc/one-context.d/loc-09-timezone
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #

if [ -z "$TIMEZONE" ]; then
if [ -z "${TIMEZONE}" ]; then
exit 0
fi

if [ -f "/usr/share/zoneinfo/$TIMEZONE" ]; then
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
if ! timedatectl set-timezone "${TIMEZONE}" 2>/dev/null; then
if [ -f "/usr/share/zoneinfo/${TIMEZONE}" ]; then
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
else
echo "ERROR: Invalid timezone '${TIMEZONE}'" >&2
exit 1
fi
fi

0 comments on commit 4e6abbb

Please sign in to comment.