fix custom-commands issue #2025 (#2026)

This commit is contained in:
Stephen Houser 2023-09-14 07:41:48 -04:00 committed by GitHub
parent 4e243fa868
commit 31bd5e80e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -460,10 +460,12 @@ def _pid_exists(pid: int) -> 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 = installation.target / script_path
chroot_path = f"{installation.target}/{script_path}"
info(f'Executing custom command "{command}" ...')
chroot_path.write_text(command)
with open(chroot_path, "w") as user_script:
user_script.write(command)
SysCommand(f"arch-chroot {installation.target} bash {script_path}")
os.unlink(chroot_path)