Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples/swiss.py
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-05-27 05:48:29 +1000
committerGitHub <noreply@github.com>2022-05-26 21:48:29 +0200
commit870da403e79ab50350803b45f200e0b272334989 (patch)
tree9b203a054bd10cbc73a81b4fd5fe24ef8e6f141a /examples/swiss.py
parent353c05318ce80b8eec32031c9e14b8471b458548 (diff)
Rework user management (#1220)
* Rework users * Update user installation * Fix config serialization * Update * Update schemas and documentation * Update * Fix flake8 * Make users mypy compatible * Fix minor copy Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'examples/swiss.py')
-rw-r--r--examples/swiss.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/examples/swiss.py b/examples/swiss.py
index 2f7d90c4..d0f02dc1 100644
--- a/examples/swiss.py
+++ b/examples/swiss.py
@@ -219,7 +219,7 @@ class MyMenu(archinstall.GlobalMenu):
if self._execution_mode in ('full','lineal'):
options_list = ['keyboard-layout', 'mirror-region', 'harddrives', 'disk_layouts',
'!encryption-password','swap', 'bootloader', 'hostname', '!root-password',
- '!superusers', '!users', 'profile', 'audio', 'kernels', 'packages','additional-repositories','nic',
+ '!users', 'profile', 'audio', 'kernels', 'packages','additional-repositories','nic',
'timezone', 'ntp']
if archinstall.arguments.get('advanced',False):
options_list.extend(['sys-language','sys-encoding'])
@@ -229,7 +229,7 @@ class MyMenu(archinstall.GlobalMenu):
mandatory_list = ['harddrives']
elif self._execution_mode == 'only_os':
options_list = ['keyboard-layout', 'mirror-region','bootloader', 'hostname',
- '!root-password', '!superusers', '!users', 'profile', 'audio', 'kernels',
+ '!root-password', '!users', 'profile', 'audio', 'kernels',
'packages', 'additional-repositories', 'nic', 'timezone', 'ntp']
mandatory_list = ['hostname']
if archinstall.arguments.get('advanced',False):
@@ -262,8 +262,12 @@ class MyMenu(archinstall.GlobalMenu):
def check(s):
return self.option(s).has_selection()
+ def has_superuser() -> bool:
+ users = self._menu_options['!users'].current_selection
+ return any([u.sudo for u in users])
+
_, missing = self.mandatory_overview()
- if mode in ('full','only_os') and (not check('!root-password') and not check('!superusers')):
+ if mode in ('full','only_os') and (not check('!root-password') and not has_superuser()):
missing += 1
if mode in ('full', 'only_hd') and check('harddrives'):
if not self.option('harddrives').is_empty() and not check('disk_layouts'):
@@ -420,13 +424,8 @@ def os_setup(installation):
if archinstall.arguments.get('profile', None):
installation.install_profile(archinstall.arguments.get('profile', None))
- if archinstall.arguments.get('!users',{}):
- for user, user_info in archinstall.arguments.get('!users', {}).items():
- installation.user_create(user, user_info["!password"], sudo=False)
-
- if archinstall.arguments.get('!superusers',{}):
- for superuser, user_info in archinstall.arguments.get('!superusers', {}).items():
- installation.user_create(superuser, user_info["!password"], sudo=True)
+ if users := archinstall.arguments.get('!users', None):
+ installation.create_users(users)
if timezone := archinstall.arguments.get('timezone', None):
installation.set_timezone(timezone)