Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2021-05-24 12:29:43 +0200
committerAnton Hvornum <anton.feeds@gmail.com>2021-05-24 12:29:43 +0200
commit515cd4daf01d1239843530093bdae876f4d7f841 (patch)
tree9f040d14dfb591bc8e6405afce6baaba3aa8ea20 /archinstall
parentf9ec8f2a2791b68f26bc858ccd6dea88720ae7c2 (diff)
parent7daaf1143fca2723bfb63ab4e3030485446da1c0 (diff)
Merged in latest changes from master
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/__init__.py27
-rw-r--r--archinstall/lib/general.py4
-rw-r--r--archinstall/lib/installer.py7
-rw-r--r--archinstall/lib/user_interaction.py19
4 files changed, 26 insertions, 31 deletions
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index ee4748f6..b914c7ec 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -23,7 +23,7 @@ from .lib.user_interaction import *
parser = ArgumentParser()
-__version__ = "2.2.0.dev1"
+__version__ = "2.2.0.RC1"
def initialize_arguments():
@@ -32,16 +32,7 @@ def initialize_arguments():
parser.add_argument("--silent", action="store_true",
help="Warning!!! No prompts, ignored if config is not passed")
parser.add_argument("--script", default="guided", nargs="?", help="Script to run for installation", type=str)
- parser.add_argument("--vars",
- metavar="KEY=VALUE",
- nargs='?',
- help="Set a number of key-value pairs "
- "(do not put spaces before or after the = sign). "
- "If a value contains spaces, you should define "
- "it with double quotes: "
- 'foo="this is a sentence". Note that '
- "values are always treated as strings.")
- args = parser.parse_args()
+ args, unknowns = parser.parse_known_args()
if args.config is not None:
try:
# First, let's check if this is a URL scheme instead of a filename
@@ -57,13 +48,13 @@ def initialize_arguments():
print(e)
# Installation can't be silent if config is not passed
config["silent"] = args.silent
- if args.vars is not None:
- try:
- for var in args.vars.split(' '):
- key, val = var.split("=")
- config[key] = val
- except Exception as e:
- print(e)
+ for arg in unknowns:
+ if '--' == arg[:2]:
+ if '=' in arg:
+ key, val = [x.strip() for x in arg[2:].split('=', 1)]
+ else:
+ key, val = arg[2:], True
+ config[key] = val
config["script"] = args.script
return config
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index 249c7890..3b62c891 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -333,6 +333,10 @@ class SysCommand:
while self.session.ended is None:
self.session.poll()
+ if self.peak_output:
+ sys.stdout.write('\n')
+ sys.stdout.flush()
+
except SysCallError:
return False
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 29b3bc1a..0044532f 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -1,6 +1,6 @@
from .disk import *
from .hardware import *
-from .locale_helpers import verify_x11_keyboard_layout
+from .locale_helpers import verify_keyboard_layout, verify_x11_keyboard_layout
from .mirrors import *
from .storage import storage
from .user_interaction import *
@@ -453,6 +453,7 @@ class Installer:
self.pacstrap('efibootmgr')
o = b''.join(SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB'))
SysCommand('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg')
+ self.helper_flags['bootloader'] = True
return True
else:
root_device = subprocess.check_output(f'basename "$(readlink -f /sys/class/block/{root_partition.path.replace("/dev/", "")}/..)"', shell=True).decode().strip()
@@ -460,7 +461,7 @@ class Installer:
root_device = f"{root_partition.path}"
o = b''.join(SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc /dev/{root_device}'))
SysCommand('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg')
- self.helper_flags['bootloader'] = bootloader
+ self.helper_flags['bootloader'] = True
return True
else:
raise RequirementError(f"Unknown (or not yet implemented) bootloader requested: {bootloader}")
@@ -546,6 +547,8 @@ class Installer:
self.log(f"Invalid x11-keyboard language specified: {language}", fg="red", level=logging.ERROR)
return False
+ from .systemd import Boot
+
with Boot(self) as session:
session.SysCommand(["localectl", "set-x11-keymap", '""'])
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index d3548e6b..a6b34f67 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -17,7 +17,7 @@ from .hardware import AVAILABLE_GFX_DRIVERS, has_uefi
from .locale_helpers import list_keyboard_languages, verify_keyboard_layout, search_keyboard_layout
from .networking import list_interfaces
from .output import log
-from .profiles import Profile
+from .profiles import Profile, list_profiles
# TODO: Some inconsistencies between the selection processes.
@@ -843,28 +843,25 @@ def select_disk(dict_o_disks):
raise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')
-def select_profile(options):
+def select_profile():
"""
- Asks the user to select a profile from the `options` dictionary parameter.
- Usually this is combined with :ref:`archinstall.list_profiles`.
-
- :param options: A `dict` where keys are the profile name, value should be a dict containing profile information.
- :type options: dict
+ Asks the user to select a profile from the available profiles.
:return: The name/dictionary key of the selected profile
:rtype: str
"""
- profiles = sorted(list(options))
+ shown_profiles = sorted(list(list_profiles(filter_top_level_profiles=True)))
+ actual_profiles_raw = shown_profiles + sorted([profile for profile in list_profiles() if profile not in shown_profiles])
- if len(profiles) >= 1:
- for index, profile in enumerate(profiles):
+ if len(shown_profiles) >= 1:
+ for index, profile in enumerate(shown_profiles):
print(f"{index}: {profile}")
print(' -- The above list is a set of pre-programmed profiles. --')
print(' -- They might make it easier to install things like desktop environments. --')
print(' -- (Leave blank and hit enter to skip this step and continue) --')
- selected_profile = generic_select(profiles, 'Enter a pre-programmed profile name if you want to install one: ', options_output=False)
+ selected_profile = generic_select(actual_profiles_raw, 'Enter a pre-programmed profile name if you want to install one: ', options_output=False)
if selected_profile:
return Profile(None, selected_profile)
else: