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.
This commit is contained in:
Olaf Mersmann 2021-01-10 09:24:40 +01:00 committed by Érico Nogueira Rolim
parent f60b617c3a
commit 0d8589f193
1 changed files with 11 additions and 5 deletions

View File

@ -106,11 +106,17 @@ chroot_prepare() {
msg_error "Bootstrap not installed in $XBPS_MASTERDIR, can't continue.\n" msg_error "Bootstrap not installed in $XBPS_MASTERDIR, can't continue.\n"
fi fi
# Create some required files. # Some software expects /etc/localtime to be a symbolic link it can read to
if [ -f /etc/localtime ]; then # determine the name of the time zone, so set up the expected link
cp -f /etc/localtime $XBPS_MASTERDIR/etc # structure.
elif [ -f /usr/share/zoneinfo/UTC ]; then if [ -f /usr/share/zoneinfo/UTC ]; then
cp -f /usr/share/zoneinfo/UTC $XBPS_MASTERDIR/etc/localtime 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 fi
for f in dev sys proc host boot; do for f in dev sys proc host boot; do