]> git.pld-linux.org Git - packages/tzdata.git/blob - timezone.sh
tabs
[packages/tzdata.git] / timezone.sh
1 #!/bin/sh
2
3 if [ -x /usr/bin/timedatectl ] && \
4         [ -z "$ZONE_INFO_DIR" -o "$ZONE_INFO_DIR" = "/usr/share/zoneinfo" ] && \
5         [ -z "$ZONE_INFO_SCHEME" -o "$ZONE_INFO_SCHEME" = "posix" ] ; then
6         exec /usr/bin/timedatectl set-timezone "$TIMEZONE"
7 fi
8
9 ZONE_FILE="$ZONE_INFO_DIR"
10
11 if [ -n "$ZONE_INFO_SCHEME" -a "$ZONE_INFO_SCHEME" != "posix" ]; then
12         ZONE_FILE="$ZONE_FILE/$ZONE_INFO_SCHEME"
13 fi
14
15 ZONE_FILE="$ZONE_FILE/$TIMEZONE"
16
17 [ -L /etc/localtime ] && [ "$(resolvesymlink /etc/localtime)" = "$ZONE_FILE" ] && exit 0
18 [ -f "$ZONE_FILE" ] || exit 2
19
20 rm -f /etc/localtime
21
22 cp -af "$ZONE_FILE" /etc/localtime
23 RETVAL=$?
24 restorecon /etc/localtime >/dev/null 2>&1
25 exit $RETVAL
This page took 0.15011 seconds and 3 git commands to generate.