Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/custom-command-sample.json37
-rw-r--r--examples/guided.py13
2 files changed, 46 insertions, 4 deletions
diff --git a/examples/custom-command-sample.json b/examples/custom-command-sample.json
new file mode 100644
index 00000000..0ddf62b9
--- /dev/null
+++ b/examples/custom-command-sample.json
@@ -0,0 +1,37 @@
+{
+ "audio": "pipewire",
+ "bootloader": "systemd-bootctl",
+ "custom-commands": [
+ "cd /home/devel; git clone https://aur.archlinux.org/paru.git",
+ "chown -R devel:devel /home/devel/paru",
+ "usermod -aG docker devel"
+ ],
+ "desktop": "gnome",
+ "!encryption-password": "supersecret",
+ "filesystem": "btrfs",
+ "harddrive": {
+ "path": "/dev/nvme0n1"
+ },
+ "hostname": "development-box",
+ "kernels": [
+ "linux"
+ ],
+ "keyboard-language": "us",
+ "mirror-region": {
+ "Worldwide": {
+ "https://mirror.rackspace.com/archlinux/$repo/os/$arch": true
+ }
+ },
+ "nic": {
+ "NetworkManager": true
+ },
+ "packages": ["docker", "git", "wget", "zsh"],
+ "profile": "desktop",
+ "superusers": {
+ "devel": {
+ "!password": "devel"
+ }
+ },
+ "timezone": "US/Eastern",
+ "users": {}
+}
diff --git a/examples/guided.py b/examples/guided.py
index b3e87df7..82ad0443 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -7,6 +7,7 @@ import archinstall
from archinstall.lib.hardware import has_uefi
from archinstall.lib.networking import check_mirror_reachable
from archinstall.lib.profiles import Profile
+from archinstall.lib.systemd import Boot
if archinstall.arguments.get('help'):
print("See `man archinstall` for help.")
@@ -184,10 +185,7 @@ def ask_user_questions():
if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function():
with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported:
if not imported._prep_function():
- archinstall.log(
- ' * Profile\'s preparation requirements was not fulfilled.',
- fg='red'
- )
+ archinstall.log(' * Profile\'s preparation requirements was not fulfilled.', fg='red')
exit(1)
# Ask about audio server selection if one is not already set
@@ -379,6 +377,13 @@ def perform_installation(mountpoint):
archinstall.log(' * Profile\'s post configuration requirements was not fulfilled.', fg='red')
exit(1)
+ # If the user provided custom commands to be run post-installation, execute them now.
+ if len(archinstall.arguments['custom-commands']):
+ with Boot(archinstall) as session:
+ for command in archinstall.arguments['custom-commands']:
+ archinstall.log(f'Executing custom command "{command}" ...', fg='yellow')
+ session.SysCommand(["bash", "-c"] + command.split(' '))
+
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'):
choice = input("Would you like to chroot into the newly created installation and perform post-installation configuration? [Y/n] ")