From 27fa5119145ffdc50b7aff400315dc7a82a8cc29 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 19 May 2021 21:30:06 -0400 Subject: Try to use the new systemd-nspawn code paths --- examples/guided.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 65f4c9d9..77f1f4f1 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -4,10 +4,10 @@ import os import time import archinstall -from archinstall.lib.general import SysCommand from archinstall.lib.hardware import has_uefi from archinstall.lib.networking import check_mirror_reachable from archinstall.lib.profiles import Profile +from archinstall.lib.systemd import Boot if archinstall.arguments.get('help'): print("See `man archinstall` for help.") @@ -187,10 +187,7 @@ def ask_user_questions(): if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function(): with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported: if not imported._prep_function(): - archinstall.log( - ' * Profile\'s preparation requirements was not fulfilled.', - fg='red' - ) + archinstall.log(' * Profile\'s preparation requirements was not fulfilled.', fg='red') exit(1) # Ask about audio server selection if one is not already set @@ -381,13 +378,13 @@ def perform_installation(mountpoint): if not imported._post_install(): archinstall.log(' * Profile\'s post configuration requirements was not fulfilled.', fg='red') exit(1) - + # If the user provided custom commands to be run post-installation, execute them now. if len(archinstall.arguments['custom-commands']): - for command in archinstall.arguments['custom-commands']: - archinstall.log(f'Executing custom command "{command}" ...', fg='yellow') - SysCommand(f"arch-chroot /mnt bash -c '{command}'") - + with Boot(archinstall) as session: + for command in archinstall.arguments['custom-commands']: + archinstall.log(f'Executing custom command "{command}" ...', fg='yellow') + session.SysCommand(["bash", "-c"] + command.split(' ')) installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow") if not archinstall.arguments.get('silent'): -- cgit v1.2.3-54-g00ecf