Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-03-16 11:46:57 +0100
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-03-16 11:46:57 +0100
commitb5a970223093a201d9271dea49fa1cb35131b17f (patch)
treeef3f69622f54952f54d6b7ca8ef7088417f20caf /archinstall.py
parentf800d44b2dbe78fb3bfcd1d593aeff7c5df51819 (diff)
New function: prerequisit_check(). Moved the exit-if-not-uefi logic into a function instead of hard-crashing whoever imports the library. This way tho, it's up to the user to run the check. TODO: Add a warning message if the function isn't run beforehand.
Diffstat (limited to 'archinstall.py')
-rw-r--r--archinstall.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/archinstall.py b/archinstall.py
index 994ecfe0..2fcaac55 100644
--- a/archinstall.py
+++ b/archinstall.py
@@ -13,10 +13,6 @@ from string import ascii_uppercase, ascii_lowercase, digits
from hashlib import sha512
from threading import Thread, enumerate as tenum
-if not os.path.isdir('/sys/firmware/efi'):
- print('[E] This script only supports UEFI-booted machines.')
- exit(1)
-
if os.path.isfile('./SAFETY_LOCK'):
SAFETY_LOCK = True
else:
@@ -1219,7 +1215,18 @@ def create_user(username, password='', groups=[]):
o = (f'/usr/bin/arch-chroot /mnt gpasswd -a {username} {group}')
return True
+def prerequisit_check():
+ if not os.path.isdir('/sys/firmware/efi'):
+ return False, 'Archinstall only supports UEFI-booted machines.'
+
+ return True
+
if __name__ == '__main__':
+
+ if not (prereq := prerequisit_check()) is True:
+ print(f'[E] {prereq[1]}')
+ exit(1)
+
## Setup some defaults
# (in case no command-line parameters or netdeploy-params were given)
args = setup_args_defaults(args)