Fixed #64. installation.set_timezone() already excisted since earlier versions of archinstall in the library section. The guided.py example simply never asked for a time-zone. There's still no NTP option, which I'll add in later. Mostly because there's a lot of settings one can do to a time-client configuration, and I'm not sure all users want the default time servers etc.
This commit is contained in:
parent
64653565a4
commit
b67257233f
|
|
@ -1,4 +1,4 @@
|
|||
import os, stat, time, shutil
|
||||
import os, stat, time, shutil, pathlib
|
||||
|
||||
from .exceptions import *
|
||||
from .disk import *
|
||||
|
|
@ -171,7 +171,8 @@ class Installer():
|
|||
def set_timezone(self, zone, *args, **kwargs):
|
||||
if not len(zone): return True
|
||||
|
||||
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} ln -s /usr/share/zoneinfo/{zone} /etc/localtime'))
|
||||
(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
|
||||
|
||||
def activate_ntp(self):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import getpass
|
||||
import getpass, pathlib
|
||||
from .exceptions import *
|
||||
from .profiles import Profile
|
||||
from .locale_helpers import search_keyboard_layout
|
||||
|
|
@ -50,6 +50,11 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan
|
|||
|
||||
return users, super_users
|
||||
|
||||
def ask_for_a_timezone():
|
||||
timezone = input('Enter a valid timezone (Example: Europe/Stockholm): ').strip()
|
||||
if pathlib.Path(timezone).exists():
|
||||
return timezone
|
||||
|
||||
def ask_to_configure_network():
|
||||
# Optionally configure one network interface.
|
||||
#while 1:
|
||||
|
|
|
|||
|
|
@ -190,6 +190,9 @@ def ask_user_questions():
|
|||
if not archinstall.arguments['nic']:
|
||||
archinstall.log(f"No network configuration was selected. Network is going to be unavailable until configured manually!", fg="yellow")
|
||||
|
||||
if not archinstall.arguments.get('timezone', None):
|
||||
archinstall.arguments['timezone'] = archinstall.ask_for_a_timezone()
|
||||
|
||||
|
||||
def perform_installation_steps():
|
||||
global SIG_TRIGGER
|
||||
|
|
@ -323,6 +326,9 @@ def perform_installation(device, boot_partition, language, mirrors):
|
|||
for superuser, user_info in archinstall.arguments.get('superusers', {}).items():
|
||||
installation.user_create(superuser, user_info["!password"], sudo=True)
|
||||
|
||||
if (timezone := archinstall.arguments.get('timezone', None)):
|
||||
installation.set_timezone(timezone)
|
||||
|
||||
if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
|
||||
installation.user_set_pw('root', root_pw)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue