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:
Diffstat (limited to 'examples/swiss.py')
-rw-r--r--examples/swiss.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/examples/swiss.py b/examples/swiss.py
index baf7b618..d0f02dc1 100644
--- a/examples/swiss.py
+++ b/examples/swiss.py
@@ -20,7 +20,7 @@ import pathlib
from typing import TYPE_CHECKING, Any
import archinstall
-from archinstall import ConfigurationOutput, NetworkConfigurationHandler
+from archinstall import ConfigurationOutput, NetworkConfigurationHandler, Menu
if TYPE_CHECKING:
_: Any
@@ -38,8 +38,8 @@ TODO exec con return parameter
"""
def select_activate_NTP():
prompt = "Would you like to use automatic time synchronization (NTP) with the default time servers? [Y/n]: "
- choice = archinstall.Menu(prompt, ['yes', 'no'], default_option='yes').run()
- if choice == 'yes':
+ choice = Menu(prompt, Menu.yes_no(), default_option=Menu.yes()).run()
+ if choice == Menu.yes():
return True
else:
return False
@@ -160,8 +160,8 @@ class SetupMenu(archinstall.GeneralMenu):
def _setup_selection_menu_options(self):
self.set_option('archinstall-language',
archinstall.Selector(
- _('Select Archinstall language'),
- lambda x: self._select_archinstall_language('English'),
+ _('Archinstall language'),
+ lambda x: self._select_archinstall_language(x),
default='English',
enabled=True))
self.set_option('ntp',
@@ -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)
@@ -480,8 +479,8 @@ def perform_installation(mountpoint, mode):
installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow")
if not archinstall.arguments.get('silent'):
prompt = 'Would you like to chroot into the newly created installation and perform post-installation configuration?'
- choice = archinstall.Menu(prompt, ['yes', 'no'], default_option='yes').run()
- if choice == 'yes':
+ choice = Menu(prompt, Menu.yes_no(), default_option=Menu.yes()).run()
+ if choice == Menu.yes():
try:
installation.drop_to_shell()
except: