Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-04-28 07:10:39 +0000
committerGitHub <noreply@github.com>2021-04-28 07:10:39 +0000
commit58d933e150999aea0625623027935ca0c89558b5 (patch)
treeb6ee236ce7b100d693dca3a0a1c3ecc23a18bef3
parent932517e20d92a1e69c258aa58f387246248eaff7 (diff)
parent66197f08de883bcedcb1b596e4591db82290c322 (diff)
Merge pull request #367 from SecondThundeR/kernel-select
Slightly update kernel selection
-rw-r--r--archinstall/lib/user_interaction.py23
-rw-r--r--examples/guided.py11
2 files changed, 26 insertions, 8 deletions
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index cd848136..d08d7e25 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -506,3 +506,26 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
return selected_driver
raise RequirementError("Selecting drivers require a least one profile to be given as an option.")
+
+def select_kernel(options):
+ """
+ Asks the user to select a kernel for system.
+
+ :param options: A `list` with kernel options
+ :type options: list
+
+ :return: The string as a selected kernel
+ :rtype: string
+ """
+
+ DEFAULT_KERNEL = "linux"
+
+ kernels = sorted(list(options))
+
+ if kernels:
+ selected_kernels = generic_select(kernels, f"Choose which kernel to use (leave blank for default: {DEFAULT_KERNEL}): ")
+ if not selected_kernels:
+ return DEFAULT_KERNEL
+ return selected_kernels
+
+ raise RequirementError("Selecting kernels require a least one kernel to be given as an option.")
diff --git a/examples/guided.py b/examples/guided.py
index 1ff84907..2b8a06f5 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -2,7 +2,6 @@ import getpass, time, json, os, logging
import archinstall
from archinstall.lib.hardware import hasUEFI
from archinstall.lib.profiles import Profile
-from archinstall.lib.user_interaction import generic_select
if archinstall.arguments.get('help'):
print("See `man archinstall` for help.")
@@ -195,14 +194,10 @@ def ask_user_questions():
# we will not try to remove packages post-installation to not have audio, as that may cause multiple issues
archinstall.arguments['audio'] = None
- # Ask what kernel user wants:
+ # Ask for preferred kernel:
if not archinstall.arguments.get("kernels", None):
- archinstall.log(f"Here you can choose which kernel to use, leave blank for default which is 'linux'.")
-
- if (kernel := generic_select(["linux", "linux-lts", "linux-zen", "continue"], "choose a kernel:")):
- archinstall.arguments['kernels'] = kernel
- else:
- archinstall.arguments['kernels'] = 'linux'
+ 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.")