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:
Diffstat (limited to 'examples/guided.py')
-rw-r--r--examples/guided.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/examples/guided.py b/examples/guided.py
index 23785e7d..a600bc6b 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -27,9 +27,17 @@ while (root_pw := getpass.getpass(prompt='Enter root password (leave blank to le
break
users = {}
+new_user_text = 'Any additional users to install (leave blank for no users): '
+if len(root_pw.strip()) == 0:
+ new_user_text = 'Create a super-user with sudo privileges: '
+
while 1:
- new_user = input('Any additional users to install (leave blank for no users): ')
- if not len(new_user.strip()): break
+ new_user = input(new_user_text)
+ if len(new_user.strip()) == 0:
+ if len(root_pw.strip()) == 0:
+ archinstall.log(' * Since root is disabled, you need to create a least one user!', bg='black', fg='red')
+ continue
+ break
new_user_passwd = getpass.getpass(prompt=f'Password for user {new_user}: ')
new_user_passwd_verify = getpass.getpass(prompt=f'Enter password again for verification: ')
if new_user_passwd != new_user_passwd_verify:
@@ -72,7 +80,11 @@ def perform_installation(device, boot_partition):
installation.install_profile(profile)
for user, password in users.items():
- installation.user_create(user, password)
+ sudo = False
+ if len(root_pw.strip()) == 0:
+ sudo = True
+
+ installation.user_create(user, password, sudo=sudo)
if root_pw:
installation.user_set_pw('root', root_pw)