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@hvornum.se>2021-11-05 16:56:56 +0100
committerAnton Hvornum <anton@hvornum.se>2021-11-05 16:56:56 +0100
commit2f677e2e8672a242822ac7a9dc2970011317f223 (patch)
tree9c8b539f99a25c3dcf9096ad9f8ff15482a4f413 /examples
parentaa1afdbeb05f4bc762befebfa49464cc5c56922e (diff)
parent31a7a85e04e05f46208b026881ced5d9db190fe5 (diff)
Merge branch 'master' of github.com:archlinux/archinstall into torxed-fix-682
Diffstat (limited to 'examples')
-rw-r--r--examples/guided.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/examples/guided.py b/examples/guided.py
index 60539a0b..45395add 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -5,10 +5,6 @@ import pathlib
import time
import archinstall
-from archinstall.lib.general import run_custom_user_commands
-from archinstall.lib.hardware import *
-from archinstall.lib.networking import check_mirror_reachable
-from archinstall.lib.profiles import Profile, is_desktop_profile
if archinstall.arguments.get('help'):
print("See `man archinstall` for help.")
@@ -51,7 +47,7 @@ def load_config():
if archinstall.arguments.get('sys-encoding', None) is not None:
archinstall.arguments['sys-encoding'] = archinstall.arguments.get('sys-encoding', 'utf-8')
if archinstall.arguments.get('gfx_driver', None) is not None:
- archinstall.storage['gfx_driver_packages'] = AVAILABLE_GFX_DRIVERS.get(archinstall.arguments.get('gfx_driver', None), None)
+ archinstall.storage['gfx_driver_packages'] = archinstall.hardware.AVAILABLE_GFX_DRIVERS.get(archinstall.arguments.get('gfx_driver', None), None)
if archinstall.arguments.get('servers', None) is not None:
archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None)
if archinstall.arguments.get('disk_layouts', None) is not None:
@@ -81,13 +77,11 @@ def ask_user_questions():
except archinstall.RequirementError as err:
archinstall.log(err, fg="red")
-
# Before continuing, set the preferred keyboard layout/language in the current terminal.
# This will just help the user with the next following questions.
if len(archinstall.arguments['keyboard-layout']):
archinstall.set_keyboard_language(archinstall.arguments['keyboard-layout'])
-
# Set which region to download packages from during the installation
if not archinstall.arguments.get('mirror-region', None):
while True:
@@ -132,30 +126,25 @@ def ask_user_questions():
if not archinstall.arguments.get("bootloader", None):
archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader()
-
# Get the hostname for the machine
if not archinstall.arguments.get('hostname', None):
archinstall.arguments['hostname'] = input('Desired hostname for the installation: ').strip(' ')
-
# Ask for a root password (optional, but triggers requirement for super-user if skipped)
if not archinstall.arguments.get('!root-password', None):
archinstall.arguments['!root-password'] = archinstall.get_password(prompt='Enter root password (leave blank to disable disabled & create superuser): ')
-
# Ask for additional users (super-user if root pw was not set)
if not archinstall.arguments.get('!root-password', None) and not archinstall.arguments.get('superusers', None):
archinstall.arguments['superusers'] = archinstall.ask_for_superuser_account('Create a required super-user with sudo privileges: ', forced=True)
- users, superusers = archinstall.ask_for_additional_users('Enter a username to create a additional user (leave blank to skip & continue): ')
+ users, superusers = archinstall.ask_for_additional_users('Enter a username to create an additional user (leave blank to skip & continue): ')
archinstall.arguments['users'] = users
archinstall.arguments['superusers'] = {**archinstall.arguments['superusers'], **superusers}
-
# Ask for archinstall-specific profiles (such as desktop environments etc)
if not archinstall.arguments.get('profile', None):
archinstall.arguments['profile'] = archinstall.select_profile()
-
# Check the potentially selected profiles preparations to get early checks if some additional questions are needed.
if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function():
with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported:
@@ -163,19 +152,16 @@ def ask_user_questions():
archinstall.log(' * Profile\'s preparation requirements was not fulfilled.', fg='red')
exit(1)
-
# Ask about audio server selection if one is not already set
if not archinstall.arguments.get('audio', None):
# The argument to ask_for_audio_selection lets the library know if it's a desktop profile
- archinstall.arguments['audio'] = archinstall.ask_for_audio_selection(is_desktop_profile(archinstall.arguments['profile']))
-
+ archinstall.arguments['audio'] = archinstall.ask_for_audio_selection(archinstall.profiles.is_desktop_profile(archinstall.arguments['profile']))
# Ask for preferred kernel:
if not archinstall.arguments.get("kernels", None):
kernels = ["linux", "linux-lts", "linux-zen", "linux-hardened"]
archinstall.arguments['kernels'] = archinstall.select_kernel(kernels)
-
# Additional packages (with some light weight error handling for invalid package names)
print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.")
print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.")
@@ -246,7 +232,7 @@ def perform_filesystem_operations():
Once that's done, we'll hand over to perform_installation()
"""
mode = archinstall.GPT
- if has_uefi() is False:
+ if archinstall.has_uefi() is False:
mode = archinstall.MBR
for drive in archinstall.arguments['harddrives']:
@@ -279,7 +265,7 @@ def perform_installation(mountpoint):
installation.set_hostname(archinstall.arguments['hostname'])
if archinstall.arguments['mirror-region'].get("mirrors", None) is not None:
installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium
- if archinstall.arguments["bootloader"] == "grub-install" and has_uefi():
+ if archinstall.arguments["bootloader"] == "grub-install" and archinstall.has_uefi():
installation.add_additional_packages("grub")
installation.add_bootloader(archinstall.arguments["bootloader"])
@@ -346,7 +332,7 @@ def perform_installation(mountpoint):
# If the user provided custom commands to be run post-installation, execute them now.
if archinstall.arguments.get('custom-commands', None):
- run_custom_user_commands(archinstall.arguments['custom-commands'], installation)
+ archinstall.run_custom_user_commands(archinstall.arguments['custom-commands'], installation)
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'):
@@ -361,7 +347,7 @@ def perform_installation(mountpoint):
archinstall.log(f"Disk states after installing: {archinstall.disk_layouts()}", level=logging.DEBUG)
-if not check_mirror_reachable():
+if not archinstall.check_mirror_reachable():
log_file = os.path.join(archinstall.storage.get('LOG_PATH', None), archinstall.storage.get('LOG_FILE', None))
archinstall.log(f"Arch Linux mirrors are not reachable. Please check your internet connection and the log file '{log_file}'.", level=logging.INFO, fg="red")
exit(1)