diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:53:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:53:46 +0000 |
commit | 3cae781eef548a700dbfc995625e56db4cf96acc (patch) | |
tree | 25fb958b46b0712cc4050cdf1fb26824f3400afd /debian/tzdata.postinst | |
parent | Adding upstream version 2024a. (diff) | |
download | tzdata-3cae781eef548a700dbfc995625e56db4cf96acc.tar.xz tzdata-3cae781eef548a700dbfc995625e56db4cf96acc.zip |
Adding debian version 2024a-1.debian/2024a-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tzdata.postinst')
-rw-r--r-- | debian/tzdata.postinst | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/tzdata.postinst b/debian/tzdata.postinst new file mode 100644 index 0000000..239377b --- /dev/null +++ b/debian/tzdata.postinst @@ -0,0 +1,55 @@ +#! /bin/sh +set -e + +LC_ALL=C +LANG=C +unset TZ +umask 022 + +get_timezone() { + if ! [ -L "$DPKG_ROOT/etc/localtime" ] ; then + return + fi + timezone="$(readlink "$DPKG_ROOT/etc/localtime")" + timezone="$(cd "$DPKG_ROOT/etc" && realpath -m -s "$timezone")" + echo "${timezone#/usr/share/zoneinfo/}" +} + +. /usr/share/debconf/confmodule +db_version 2.0 + +if [ "$1" = configure ]; then + # Get the values from debconf + AREA=Etc + ZONE=UTC + db_get tzdata/Areas && AREA="$RET" + db_get "tzdata/Zones/$AREA" && ZONE="$RET" + TIMEZONE="$AREA/$ZONE" + db_stop + + # Update the time zone + if test "$(get_timezone)" != "$TIMEZONE"; then + ln -nsf "/usr/share/zoneinfo/$TIMEZONE" "$DPKG_ROOT/etc/localtime.dpkg-new" && \ + mv -f "$DPKG_ROOT/etc/localtime.dpkg-new" "$DPKG_ROOT/etc/localtime" + which restorecon >/dev/null 2>&1 && restorecon "$DPKG_ROOT/etc/localtime" + fi + echo "$TIMEZONE" > "$DPKG_ROOT/etc/timezone" + which restorecon >/dev/null 2>&1 && restorecon "$DPKG_ROOT/etc/timezone" + + echo + echo "Current default time zone: '$TIMEZONE'" + + # Show the new setting to the user + UTdate=$(LC_ALL=C TZ=UTC0 date) + TZdate=$(unset TZ ; LANG=C date -d "$UTdate") + echo "Local time is now: $TZdate." + echo "Universal Time is now: $UTdate." + if [ -z "$DEBCONF_RECONFIGURE" ] ; then + echo "Run 'dpkg-reconfigure tzdata' if you wish to change it." + fi + echo +fi + +#DEBHELPER# + +exit 0 |