From 0d8589f1931992642affef669a889d659551a627 Mon Sep 17 00:00:00 2001 From: Olaf Mersmann Date: Sun, 10 Jan 2021 09:24:40 +0100 Subject: [PATCH] shutils/chroot.sh: create symlink for /etc/localtime Currently /etc/localtime is copied from the host to the chroot. Some software expects /etc/localtime to be a symbolic link it can read to determine the name of the time zone, so set up the expected link structure. --- common/xbps-src/shutils/chroot.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh index 8646d758549..73b98bc7200 100644 --- a/common/xbps-src/shutils/chroot.sh +++ b/common/xbps-src/shutils/chroot.sh @@ -106,11 +106,17 @@ chroot_prepare() { msg_error "Bootstrap not installed in $XBPS_MASTERDIR, can't continue.\n" fi - # Create some required files. - if [ -f /etc/localtime ]; then - cp -f /etc/localtime $XBPS_MASTERDIR/etc - elif [ -f /usr/share/zoneinfo/UTC ]; then - cp -f /usr/share/zoneinfo/UTC $XBPS_MASTERDIR/etc/localtime + # Some software expects /etc/localtime to be a symbolic link it can read to + # determine the name of the time zone, so set up the expected link + # structure. + if [ -f /usr/share/zoneinfo/UTC ]; then + tzfile=/usr/share/zoneinfo/UTC + mkdir -p $XBPS_MASTERDIR/usr/share/zoneinfo + cp /usr/share/zoneinfo/UTC $XBPS_MASTERDIR/usr/share/zoneinfo/UTC + ln -sf ../usr/share/zoneinfo/UTC $XBPS_MASTERDIR/etc/localtime + else + # Should never happen. + msg_warn "No local timezone configuration file created." fi for f in dev sys proc host boot; do