summaryrefslogtreecommitdiffstats
path: root/source/a/glibc-zoneinfo/doinst.sh
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2018-05-28 19:12:29 +0000
committer Eric Hameleers <alien@slackware.com>2018-05-31 23:39:35 +0200
commit646a5c1cbfd95873950a87b5f75d52073a967023 (patch)
treeb8b8d2ab3b0d432ea69ad1a64d1c789649d65020 /source/a/glibc-zoneinfo/doinst.sh
parentd31c50870d0bee042ce660e445c9294a59a3a65b (diff)
downloadcurrent-20180528191229.tar.gz
current-20180528191229.tar.xz
Mon May 28 19:12:29 UTC 201820180528191229
a/pkgtools-15.0-noarch-13.txz: Rebuilt. installpkg: default line length for --terselength is the number of columns. removepkg: added --terse mode. upgradepkg: default line length for --terselength is the number of columns. upgradepkg: accept -option in addition to --option. ap/vim-8.1.0026-x86_64-1.txz: Upgraded. d/bison-3.0.5-x86_64-1.txz: Upgraded. e/emacs-26.1-x86_64-1.txz: Upgraded. kde/kopete-4.14.3-x86_64-8.txz: Rebuilt. Recompiled against libidn-1.35. n/conntrack-tools-1.4.5-x86_64-1.txz: Upgraded. n/libnetfilter_conntrack-1.0.7-x86_64-1.txz: Upgraded. n/libnftnl-1.1.0-x86_64-1.txz: Upgraded. n/links-2.16-x86_64-2.txz: Rebuilt. Rebuilt to enable X driver for -g mode. n/lynx-2.8.9dev.19-x86_64-1.txz: Upgraded. n/nftables-0.8.5-x86_64-1.txz: Upgraded. n/p11-kit-0.23.11-x86_64-1.txz: Upgraded. n/ulogd-2.0.7-x86_64-1.txz: Upgraded. n/whois-5.3.1-x86_64-1.txz: Upgraded. xap/network-manager-applet-1.8.12-x86_64-1.txz: Upgraded. xap/vim-gvim-8.1.0026-x86_64-1.txz: Upgraded.
Diffstat (limited to 'source/a/glibc-zoneinfo/doinst.sh')
-rw-r--r--source/a/glibc-zoneinfo/doinst.sh56
1 files changed, 49 insertions, 7 deletions
diff --git a/source/a/glibc-zoneinfo/doinst.sh b/source/a/glibc-zoneinfo/doinst.sh
index 816e86e0e..3c86f65e4 100644
--- a/source/a/glibc-zoneinfo/doinst.sh
+++ b/source/a/glibc-zoneinfo/doinst.sh
@@ -1,15 +1,57 @@
-# Fix existing old style /etc/localtime symlink:
-if [ -L etc/localtime -a ! -r etc/localtime-copied-from ]; then
- mv etc/localtime etc/localtime-copied-from
+# In order to properly handle time before /usr is mounted (in
+# the event that /usr is a separate partition, which for a number
+# of reasons isn't really a great idea), the /etc/localtime file
+# should be a copy of the desired zoneinfo file and not a symlink
+# to a file in /usr/share/zoneinfo. But if we find a symlink here
+# we should defer to the admin's wishes and leave it alone.
+#
+# Note that setting the timezone with timeconfig will wipe both
+# /etc/localtime and /etc/localtime-copied from.
+# /etc/localtime-copied-from will be a symlink to a file under
+# /usr/share/zoneinfo, and /etc/localtime will be a copy of that file.
+
+# In a special case, we will handle the removal of the US/Pacific-New
+# timezone. A bit of background information on this:
+#
+# "US/Pacific-New' stands for 'Pacific Presidential Election Time',
+# which was passed by the House in April 1989 but never signed into law.
+# In presidential election years, this rule would have delayed the
+# PDT-to-PST switchover until after the election, to lessen the effect
+# of broadcast news election projections on last-minute west-coast
+# voters. "
+#
+# In nearly all cases, a machine that uses the US/Pacific-New timezone
+# has chosen it by mistake. In 2016, having this as the system timezone
+# actually led to clock errors, and after that it was decided that the
+# timezone (only of historical interest anyway) should be removed from
+# the timezone database.
+#
+# If we see that the machine's localtime-copied-from symlink is pointing
+# to US/Pacific-New, change it to point to US/Pacific instead.
+if [ "$(/bin/ls -l etc/localtime-copied-from | rev | cut -f 1,2 -d / | rev)" = "US/Pacific-New" ]; then
+ ( cd etc ; rm -rf localtime-copied-from )
+ ( cd etc ; ln -sf /usr/share/zoneinfo/US/Pacific localtime-copied-from )
fi
+
+# If we have no /etc/localtime, but we do have a localtime-copied-from
+# symlink to locate what we would want there, then add a copy now:
+if [ ! -r etc/localtime -a -L etc/localtime-copied-from ]; then
+ chroot . /bin/cp etc/localtime-copied-from etc/localtime
+fi
+
# Add the default timezone in /etc, if none exists:
-if [ ! -r etc/localtime ]; then
+if [ ! -r etc/localtime -a ! -L etc/localtime-copied-from ]; then
( cd etc ; rm -rf localtime localtime-copied-from )
( cd etc ; ln -sf /usr/share/zoneinfo/Factory localtime-copied-from )
fi
-# Make sure /etc/localtime is updated:
-chroot . /bin/cp etc/localtime-copied-from etc/localtime
-# Add the default link in /usr/share/zoneinfo:
+
+# Make sure /etc/localtime is updated, unless it is a symlink (in which
+# case leave it alone):
+if [ ! -L etc/localtime ]; then
+ chroot . /bin/cp etc/localtime-copied-from etc/localtime
+fi
+
+# Add a link to the timeconfig script in /usr/share/zoneinfo:
( cd usr/share/zoneinfo ; rm -rf timeconfig )
( cd usr/share/zoneinfo ; ln -sf /usr/sbin/timeconfig timeconfig )
### Make the rest of the symbolic links in the zoneinfo database: