Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-03-28 22:36:47 +0200
committerAnton Hvornum <anton@hvornum.se>2021-03-28 22:36:47 +0200
commit37a6018aaeed53ca95d9c7f81981db98aab24eab (patch)
treeb9f4fabb8d17cc3318acf039c48010ecef3137f3 /archinstall
parent89a2e1eb2b4f02df2d5ccab4c11f4c9f22dd9b48 (diff)
Fixed a path-check issue with Time Zones.
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/installer.py16
-rw-r--r--archinstall/lib/user_interaction.py8
2 files changed, 19 insertions, 5 deletions
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)
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index e462c370..a79b4847 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -77,8 +77,14 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan
def ask_for_a_timezone():
timezone = input('Enter a valid timezone (Example: Europe/Stockholm): ').strip()
- if pathlib.Path(timezone).exists():
+ if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone).exists():
return timezone
+ else:
+ log(
+ f"Time zone {timezone} does not exist, continuing with system default.",
+ level=LOG_LEVELS.Warning,
+ fg='red'
+ )
def ask_to_configure_network():
# Optionally configure one network interface.