Use {installation.target} in custom commands handler

This commit is contained in:
Dylan Taylor 2021-05-20 17:55:40 -04:00
parent 5652ba20ae
commit e6befe53c7
2 changed files with 5 additions and 5 deletions

View File

@ -368,11 +368,11 @@ def pid_exists(pid: int):
return False
def run_custom_user_commands(commands):
def run_custom_user_commands(commands, installation):
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:
with open(f"{installation.target}/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")
execution_output = SysCommand(f"arch-chroot {installation.target} bash /var/tmp/user-command.{index}.sh")
log(execution_output)
os.unlink(f"/mnt/var/tmp/user-command.{index}.sh")
os.unlink(f"{installation.target}/var/tmp/user-command.{index}.sh")

View File

@ -378,7 +378,7 @@ def perform_installation(mountpoint):
# If the user provided custom commands to be run post-installation, execute them now.
if archinstall.arguments.get('custom-commands', None):
run_custom_user_commands(archinstall.arguments['custom-commands'])
run_custom_user_commands(archinstall.arguments['custom-commands'], installation)
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'):