Merge branch 'archlinux:master' into master

This commit is contained in:
Yash Tripathi 2021-05-23 00:09:32 +05:30
commit 1d984625c8
4 changed files with 20 additions and 3 deletions

View File

@ -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 <path to config file or URL> --vars '<space_seperated KEY=VALUE pairs>'
# archinstall --config <path to config file or URL> [optional: --vars '<space_seperated KEY=VALUE pairs>']
# Help?

View File

@ -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

View File

@ -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}")

View File

@ -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)
@ -234,6 +237,12 @@ def ask_user_questions():
if not archinstall.arguments.get('timezone', None):
archinstall.arguments['timezone'] = archinstall.ask_for_a_timezone()
if archinstall.arguments['timezone']:
if not archinstall.arguments.get('ntp', False):
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 steps might be required in order for NTP to work. For more information, please check the Arch wiki.", fg="yellow")
def perform_installation_steps():
print()
@ -366,6 +375,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)