install: run setup-timezone with "-i" when appropriate

This makes sure that the "/etc/localtime" file being created points to
the tzdata directory (/usr/share/zoneinfo), instead of to the custom
"/etc/zoneinfo" created by alpine to save space. This is relevant
because it otherwise will point to a directory that contains
incomplete tzdata, and can produce unexpected results in some circumnstances.

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
Tested-by: Clayton Craft <clayton@craftyguy.net>
Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230611150743.23310-3-ablocorrea@hotmail.com%3E
This commit is contained in:
Pablo Correa Gómez 2023-06-11 17:07:41 +02:00 committed by Oliver Smith
parent 36d5bcbd3d
commit 7671353158
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 6 additions and 0 deletions

View File

@ -362,6 +362,12 @@ def setup_timezone(args):
version = alpine_conf["version"].split("-r")[0]
setup_tz_cmd = ["setup-timezone"]
# setup-timezone will, by default, copy the timezone to /etc/zoneinfo
# and disregard tzdata, to save space. If we actually have tzdata
# installed, make sure that setup-timezone makes use of it, since
# there's no space to be saved.
if "tzdata" in pmb.chroot.apk.installed(args, suffix):
setup_tz_cmd += ["-i"]
if not pmb.parse.version.check_string(version, ">=3.14.0"):
setup_tz_cmd += ["-z"]
setup_tz_cmd += [args.timezone]