Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/guided.py38
1 files changed, 36 insertions, 2 deletions
diff --git a/examples/guided.py b/examples/guided.py
index beb577c8..07d8c0af 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -3,6 +3,28 @@ import archinstall
from archinstall.lib.hardware import hasUEFI
from archinstall.lib.profiles import Profile
+"""
+This signal-handler chain (and global variable)
+is used to trigger the "Are you sure you want to abort?" question further down.
+It might look a bit odd, but have a look at the line: "if SIG_TRIGGER:"
+"""
+SIG_TRIGGER = False
+def kill_handler(sig, frame):
+ print()
+ exit(0)
+
+def sig_handler(sig, frame):
+ global SIG_TRIGGER
+ SIG_TRIGGER = True
+ signal.signal(signal.SIGINT, kill_handler)
+
+original_sigint_handler = signal.getsignal(signal.SIGINT)
+signal.signal(signal.SIGINT, sig_handler)
+
+if archinstall.arguments.get('help'):
+ print("See `man archinstall` for help.")
+ exit(0)
+
def ask_user_questions():
"""
First, we'll ask the user for a bunch of user input.
@@ -220,7 +242,11 @@ def perform_installation_steps():
Setup the blockdevice, filesystem (and optionally encryption).
Once that's done, we'll hand over to perform_installation()
"""
- with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs:
+ mode = archinstall.GPT
+ if hasUEFI() is False:
+ mode = archinstall.MBR
+
+ with archinstall.Filesystem(archinstall.arguments['harddrive'], mode) as fs:
# Wipe the entire drive if the disk flag `keep_partitions`is False.
if archinstall.arguments['harddrive'].keep_partitions is False:
fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs'))
@@ -301,6 +327,7 @@ def perform_installation(mountpoint):
installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info)
if archinstall.arguments.get('audio', None) == 'pipewire':
print('Installing pipewire ...')
+
installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"])
elif archinstall.arguments.get('audio', None) == 'pulseaudio':
print('Installing pulseaudio ...')
@@ -323,7 +350,14 @@ def perform_installation(mountpoint):
if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
installation.user_set_pw('root', root_pw)
-
+ if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_post_install():
+ with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported:
+ if not imported._post_install():
+ archinstall.log(
+ ' * Profile\'s post configuration requirements was not fulfilled.',
+ fg='red'
+ )
+ exit(1)
ask_user_questions()
perform_installation_steps()