Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,15 @@ def check(s: str) -> bool:
item = self._item_group.find_by_key(s)
return item.has_value()

def has_superuser() -> bool:
if auth_config and auth_config.users:
return any([u.sudo for u in auth_config.users])
return False

def has_regular_user() -> bool:
if auth_config and auth_config.users:
return len(auth_config.users) > 0
return False

missing = set()

if (auth_config is None or auth_config.root_enc_password is None) and not has_superuser():
if (auth_config is None or auth_config.root_enc_password is None) and not (auth_config and auth_config.has_superuser()):
missing.add(
tr('Either root-password or at least 1 user with sudo privileges must be specified'),
)

# These greeters only show users with UID >= 1000 and have no manual login by default
if not has_regular_user():
if not (auth_config and auth_config.has_regular_user()):
profile_item: MenuItem = self._item_group.find_by_key('profile_config')
profile_config: ProfileConfiguration | None = profile_item.value

Expand Down
6 changes: 6 additions & 0 deletions archinstall/lib/models/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ def json(self) -> AuthenticationSerialization:
config['u2f_config'] = self.u2f_config.json()

return config

def has_superuser(self) -> bool:
return any(u.sudo for u in self.users)

def has_regular_user(self) -> bool:
return len(self.users) > 0
Loading