Refactor run_custom_user_commands (#4668)
This commit is contained in:
parent
c1dcce8c2c
commit
fe16238983
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue