index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | archinstall/lib/general.py | 10 | ||||
-rw-r--r-- | examples/guided.py | 13 |
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 81793cb8..19b7b31c 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -366,3 +366,13 @@ def pid_exists(pid: int): return any(subprocess.check_output(['/usr/bin/ps', '--no-headers', '-o', 'pid', '-p', str(pid)]).strip()) except subprocess.CalledProcessError: return False + + +def run_custom_user_commands(commands): + for index, command in enumerate(commands): + log(f'Executing custom command "{command}" ...', fg='yellow') + with open(f"/mnt/var/tmp/user-command.{index}.sh", "w") as temp_script: + temp_script.write(command) + execution_output = SysCommand(f"arch-chroot /mnt bash /var/tmp/user-command.{index}.sh") + log(execution_output) + os.unlink(f"/mnt/var/tmp/user-command.{index}.sh") diff --git a/examples/guided.py b/examples/guided.py index 7c93ac16..fc24ad7e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -4,10 +4,9 @@ import os import time import archinstall -from archinstall.lib.general import SysCommand +from archinstall.lib.general import run_custom_user_commands from archinstall.lib.hardware import has_uefi from archinstall.lib.networking import check_mirror_reachable -from archinstall.lib.profiles import Profile if archinstall.arguments.get('help'): print("See `man archinstall` for help.") @@ -378,14 +377,8 @@ def perform_installation(mountpoint): exit(1) # If the user provided custom commands to be run post-installation, execute them now. - if len(archinstall.arguments['custom-commands']): - for index, command in enumerate(archinstall.arguments['custom-commands']): - archinstall.log(f'Executing custom command "{command}" ...', fg='yellow') - with open(f"/mnt/var/tmp/user-command.{index}.sh", "w") as temp_script: - temp_script.write(command) - execution_output = SysCommand(f"arch-chroot /mnt bash /var/tmp/user-command.{index}.sh") - archinstall.log(execution_output) - os.unlink(f"/mnt/var/tmp/user-command.{index}.sh") + if archinstall.arguments.get('custom-commands', None): + run_custom_user_commands(archinstall.arguments['custom-commands']) 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'): |