From dd0cfa990aa98d14a4b5f83d452238a43e8f28af Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 21 May 2021 16:43:43 -0400 Subject: Simplify the commands in the readme Typing 'python -m' is largely unnecessary on the ISO with the package installed. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0aef2097..c9ca63fa 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or use `pip install --upgrade archinstall` to use as a library. Assuming you are on an Arch Linux live-ISO and booted into EFI mode. - # python -m archinstall --script guided + # archinstall ## Running from a declarative configuration file or URL @@ -34,7 +34,7 @@ Prequisites: Assuming you are on a Arch Linux live-ISO and booted into EFI mode. - # python -m archinstall --config --vars '' + # archinstall --config [optional: --vars ''] # Help? -- cgit v1.2.3-70-g09d2 From 439abc44022403a9359faec3b0f6ae58e5029539 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sat, 22 May 2021 18:18:05 +0530 Subject: fixed bootloader flag not being set --- archinstall/lib/installer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 29b3bc1a..1be398e9 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -453,6 +453,7 @@ class Installer: self.pacstrap('efibootmgr') o = b''.join(SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) SysCommand('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg') + self.helper_flags['bootloder'] = True return True else: root_device = subprocess.check_output(f'basename "$(readlink -f /sys/class/block/{root_partition.path.replace("/dev/", "")}/..)"', shell=True).decode().strip() @@ -460,7 +461,7 @@ class Installer: root_device = f"{root_partition.path}" o = b''.join(SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc /dev/{root_device}')) SysCommand('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg') - self.helper_flags['bootloader'] = bootloader + self.helper_flags['bootloader'] = True return True else: raise RequirementError(f"Unknown (or not yet implemented) bootloader requested: {bootloader}") -- cgit v1.2.3-70-g09d2 From f789a96348472ae4bfe6277d107cbc3405eba5b2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 19:35:57 +0200 Subject: Added in a are-we-root check at the top of guided. --- examples/guided.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index f61548e1..c5440efe 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -12,6 +12,9 @@ from archinstall.lib.profiles import Profile if archinstall.arguments.get('help'): print("See `man archinstall` for help.") exit(0) +if os.getuid() != 0: + print("Archinstall requires root privileges to run. See --help for more.") + exit(1) # For support reasons, we'll log the disk layout pre installation to match against post-installation layout archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=logging.DEBUG) -- cgit v1.2.3-70-g09d2 From f2e7b1440a0ad7c04bd7540b13eddd1f1f0069b7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 19:58:40 +0200 Subject: Since SysCommand() wraps SysCommandWorker(), but SysCommand() doesn't use contexts, we have to flush the output manually here to avoid newlines not being before the next output. --- archinstall/lib/general.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 249c7890..3b62c891 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -333,6 +333,10 @@ class SysCommand: while self.session.ended is None: self.session.poll() + if self.peak_output: + sys.stdout.write('\n') + sys.stdout.flush() + except SysCallError: return False -- cgit v1.2.3-70-g09d2 From b45efe0983387b1b00b8ac956bec3fdd1a97d9f0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:04:55 +0200 Subject: Adding a NTP option to syncronize time. --- examples/guided.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index c5440efe..a2790af3 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -237,6 +237,9 @@ def ask_user_questions(): if not archinstall.arguments.get('timezone', None): archinstall.arguments['timezone'] = archinstall.ask_for_a_timezone() + if not archinstall.arguments.get('ntp', False): + archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') + def perform_installation_steps(): print() @@ -369,6 +372,9 @@ def perform_installation(mountpoint): if timezone := archinstall.arguments.get('timezone', None): installation.set_timezone(timezone) + if archinstall.arguments.get('ntp', False): + installation.activate_ntp() + if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw): installation.user_set_pw('root', root_pw) -- cgit v1.2.3-70-g09d2 From e3a629a6ff71a7d8d3d66f66c40229ecd0e7b8e9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:07:15 +0200 Subject: Added a information that ntp might require some additional tinkering to work perfectly. --- examples/guided.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index a2790af3..fc2baec0 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -239,6 +239,8 @@ def ask_user_questions(): if not archinstall.arguments.get('ntp', False): archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') + if archinstall.arguments['ntp']: + archinstall.log("Hardware time and other post configuration might be required for ntp to work. Please see wiki!", fg="yellow") def perform_installation_steps(): -- cgit v1.2.3-70-g09d2 From 1e53f4a65f8eb5f34953006e0cdf5502a89e89c7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:10:30 +0200 Subject: Made NTP question only on timezone for now. --- examples/guided.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index fc2baec0..69561bfe 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -237,10 +237,11 @@ def ask_user_questions(): if not archinstall.arguments.get('timezone', None): archinstall.arguments['timezone'] = archinstall.ask_for_a_timezone() - if not archinstall.arguments.get('ntp', False): - archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') - if archinstall.arguments['ntp']: - archinstall.log("Hardware time and other post configuration might be required for ntp to work. Please see wiki!", fg="yellow") + if archinstall.arguments['timezone']: + if not archinstall.arguments.get('ntp', False): + archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') + if archinstall.arguments['ntp']: + archinstall.log("Hardware time and other post configuration might be required for ntp to work. Please see wiki!", fg="yellow") def perform_installation_steps(): -- cgit v1.2.3-70-g09d2 From d0a37843aa2bf71f1d8eaa6cbd590aaa1a35e0bf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:13:59 +0200 Subject: Rephrased according to @dylan's suggestions. --- examples/guided.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 69561bfe..e60cd0f8 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -239,9 +239,9 @@ def ask_user_questions(): if archinstall.arguments['timezone']: if not archinstall.arguments.get('ntp', False): - archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') + archinstall.arguments['ntp'] = input("Would you like to use automatic time synchronization (NTP) with the default time servers? [Y/n]: ").strip().lower() in ('y', 'yes') if archinstall.arguments['ntp']: - archinstall.log("Hardware time and other post configuration might be required for ntp to work. Please see wiki!", fg="yellow") + archinstall.log("Hardware time and other post-configuration steps might be required in order for NTP to work. For more information, please check the Arch wiki.", fg="yellow") def perform_installation_steps(): -- cgit v1.2.3-70-g09d2