Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-08-31 20:46:38 +0200
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-08-31 20:46:38 +0200
commit35fc1773453de327afcda14ec79c7dc6be20a811 (patch)
treeafd3fda19cfee7bfab0f6da7e2ec458424a1222b /examples
parentbb0ece0ecea21885599fc96b8706f33ab5bf0b74 (diff)
Adding a different text on the user step if root is disabled. Also adding user as sudo if that's the case.
Diffstat (limited to 'examples')
-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)