From 37a6018aaeed53ca95d9c7f81981db98aab24eab Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 28 Mar 2021 22:36:47 +0200 Subject: Fixed a path-check issue with Time Zones. --- archinstall/lib/installer.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 2200db8e..ff47be01 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -169,11 +169,19 @@ class Installer(): return True if sys_command(f'/usr/bin/arch-chroot {self.mountpoint} locale-gen').exit_code == 0 else False def set_timezone(self, zone, *args, **kwargs): - if not len(zone): return True + if not zone: return True + if not len(zone): return True # Redundant - (pathlib.Path(self.mountpoint)/"etc"/"localtime").unlink(missing_ok=True) - sys_command(f'/usr/bin/arch-chroot {self.mountpoint} ln -s /usr/share/zoneinfo/{zone} /etc/localtime') - return True + if (pathlib.Path("/usr")/"share"/"zoneinfo"/zone).exists(): + (pathlib.Path(self.mountpoint)/"etc"/"localtime").unlink(missing_ok=True) + sys_command(f'/usr/bin/arch-chroot {self.mountpoint} ln -s /usr/share/zoneinfo/{zone} /etc/localtime') + return True + else: + self.log( + f"Time zone {zone} does not exist, continuing with system default.", + level=LOG_LEVELS.Warning, + fg='red' + ) def activate_ntp(self): self.log(f'Installing and activating NTP.', level=LOG_LEVELS.Info) -- cgit v1.2.3-54-g00ecf