Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples/guided.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-04-08 21:14:19 +0200
committerAnton Hvornum <anton@hvornum.se>2021-04-08 21:14:19 +0200
commitb5245b31fec9c19a16a8b00233afb1cfee1499fa (patch)
tree7d01f4721f6b8473c0f72c8dd725e7724c594c20 /examples/guided.py
parentae2da06075763d388c303e8cd7914694454aa8fb (diff)
I simplified the countdown, by moving it into it's own function instead of wrapped inside guided.. This can now be used by others for a simple countdown. I also re-worked the minimal.py example to work with the new internal partitioning logic API as well as support some flags from archinstall.arguments to minimize user input requirements to just one single question. This one question will most likely go away too, but stays for simplicity right now.
Diffstat (limited to 'examples/guided.py')
-rw-r--r--examples/guided.py50
1 files changed, 2 insertions, 48 deletions
diff --git a/examples/guided.py b/examples/guided.py
index a28aa50e..6feebd00 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -1,30 +1,8 @@
-import getpass, time, json, sys, signal, os
+import getpass, time, json, os
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.
@@ -206,8 +184,6 @@ def ask_user_questions():
def perform_installation_steps():
- global SIG_TRIGGER
-
print()
print('This is your chosen configuration:')
archinstall.log("-- Guided template chosen (with below config) --", level=archinstall.LOG_LEVELS.Debug)
@@ -222,29 +198,7 @@ def perform_installation_steps():
"""
print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='')
-
- for i in range(5, 0, -1):
- print(f"{i}", end='')
-
- for x in range(4):
- sys.stdout.flush()
- time.sleep(0.25)
- print(".", end='')
-
- if SIG_TRIGGER:
- abort = input('\nDo you really want to abort (y/n)? ')
- if abort.strip() != 'n':
- exit(0)
-
- if SIG_TRIGGER is False:
- sys.stdin.read()
- SIG_TRIGGER = False
- signal.signal(signal.SIGINT, sig_handler)
-
- # Put back the default/original signal handler now that we're done catching
- # and interrupting SIGINT with "Do you really want to abort".
- print()
- signal.signal(signal.SIGINT, original_sigint_handler)
+ archinstall.do_countdown()
"""
Setup the blockdevice, filesystem (and optionally encryption).