Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorDylan Taylor <dylan@dylanmtaylor.com>2021-05-20 16:51:05 -0400
committerDylan Taylor <dylan@dylanmtaylor.com>2021-05-20 17:12:41 -0400
commit5652ba20aebf11fa482c74cd85468bd092bc8213 (patch)
tree0881832ff4354d918b43c3de81275183c0f41651 /archinstall/lib
parent11c963232203d463c4fc6f9ec23f60d3b034572b (diff)
Extract custom-commands function into general.py
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/general.py10
1 files changed, 10 insertions, 0 deletions
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")