Refactor run_custom_user_commands (#4668)

This commit is contained in:
codefiles 2026-07-25 01:33:22 -04:00 committed by GitHub
parent c1dcce8c2c
commit fe16238983
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -2131,13 +2131,12 @@ def accessibility_tools_in_use() -> bool:
def run_custom_user_commands(commands: list[str], installation: Installer) -> None:
for index, command in enumerate(commands):
script_path = f'/var/tmp/user-command.{index}.sh'
chroot_path = f'{installation.target}/{script_path}'
script_path = LPath(f'/var/tmp/user-command.{index}.sh')
chroot_path = installation.target / script_path.relative_to_root()
info(f'Executing custom command "{command}" ...')
with open(chroot_path, 'w') as user_script:
user_script.write(command)
chroot_path.write_text(command)
SysCommand(f'arch-chroot -S {installation.target} bash {script_path}')
os.unlink(chroot_path)
chroot_path.unlink()