From 4d3595ecfc2f58176f81fa1f78ab214fb61aaafe Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Thu, 20 May 2021 18:11:22 +0530 Subject: changed "desktop" to "profile" while loading config --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index b3e87df7..f53078db 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -408,6 +408,6 @@ else: # Temporarily disabling keep_partitions if config file is loaded archinstall.arguments['harddrive'].keep_partitions = False # Temporary workaround to make Desktop Environments work - archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('desktop', None)) + archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)) perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 33f1957e4d10d212c87f0500107d426ff871131a Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Fri, 21 May 2021 01:58:32 +0530 Subject: fallback added for when profile is null/empty --- examples/guided.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index f53078db..c18e5039 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -408,6 +408,9 @@ else: # Temporarily disabling keep_partitions if config file is loaded archinstall.arguments['harddrive'].keep_partitions = False # Temporary workaround to make Desktop Environments work - archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)) + if archinstall.arguments.get('profile', None) is not None: + archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)) + else: + archinstall.arguments['profile'] = None perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 23d223b15cacd5139150162a4328022ef12f6469 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Fri, 21 May 2021 04:00:09 +0530 Subject: fixed creating profile object if profile is passed in vars --- examples/guided.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index c18e5039..3a2bc1c0 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -179,6 +179,8 @@ def ask_user_questions(): # Ask for archinstall-specific profiles (such as desktop environments etc) if not archinstall.arguments.get('profile', None): archinstall.arguments['profile'] = archinstall.select_profile(archinstall.list_profiles(filter_top_level_profiles=True)) + else: + archinstall.arguments['profile'] = Profile(installer=None, path=archinstall.arguments['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(): -- cgit v1.2.3-70-g09d2 From ebf59809432ac205d7b77b44dbcf611d98078a0c Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Fri, 21 May 2021 06:29:10 -0400 Subject: Add ability to provide an array of services to enable in config file --- examples/custom-command-sample.json | 1 + examples/guided.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/examples/custom-command-sample.json b/examples/custom-command-sample.json index 0518d3db..5e7a70e3 100644 --- a/examples/custom-command-sample.json +++ b/examples/custom-command-sample.json @@ -26,6 +26,7 @@ }, "packages": ["docker", "git", "wget", "zsh"], "profile": "gnome", + "services": ["docker"], "superusers": { "devel": { "!password": "devel" diff --git a/examples/guided.py b/examples/guided.py index d23c483e..f61548e1 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -379,6 +379,11 @@ def perform_installation(mountpoint): archinstall.log(' * Profile\'s post configuration requirements was not fulfilled.', fg='red') exit(1) + # If the user provided a list of services to be enabled, pass the list to the enable_service function. + # Note that while it's called enable_service, it can actually take a list of services and iterate it. + if archinstall.arguments.get('services', None): + installation.enable_service(*archinstall.arguments['services']) + # 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) -- cgit v1.2.3-70-g09d2 From dd0cfa990aa98d14a4b5f83d452238a43e8f28af Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 21 May 2021 16:43:43 -0400 Subject: Simplify the commands in the readme Typing 'python -m' is largely unnecessary on the ISO with the package installed. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0aef2097..c9ca63fa 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or use `pip install --upgrade archinstall` to use as a library. Assuming you are on an Arch Linux live-ISO and booted into EFI mode. - # python -m archinstall --script guided + # archinstall ## Running from a declarative configuration file or URL @@ -34,7 +34,7 @@ Prequisites: Assuming you are on a Arch Linux live-ISO and booted into EFI mode. - # python -m archinstall --config --vars '' + # archinstall --config [optional: --vars ''] # Help? -- cgit v1.2.3-70-g09d2 From 2ab415a9e873f2cd81e225b2d875ed6782a00d32 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sat, 22 May 2021 01:43:03 +0530 Subject: added description for installing from config --- docs/installing/guided.rst | 108 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 6 deletions(-) diff --git a/docs/installing/guided.rst b/docs/installing/guided.rst index 88b4e480..e442d927 100644 --- a/docs/installing/guided.rst +++ b/docs/installing/guided.rst @@ -26,17 +26,113 @@ Running the guided installation To install archinstall and subsequently the guided installer, simply do the following: -.. code::bash - # pacman -S python-archinstall +.. code-block:: sh + + pacman -S python-archinstall And to run it, execute archinstall as a Python module: -.. code::bash - # python -m archinstall guided +.. code-block:: sh -| The guided parameter is optional as it's the default behavior. + python -m archinstall --script guided + +| The ``--script guided`` argument is optional as it's the default behavior. | But this will start the process of guiding you through a installation of a quite minimal Arch Linux experience. +Installing directly from a config file +-------------------------------------- + +.. note:: + Edit the following json according to your needs, + save this as a json file, and provide the local or remote path (URL) + +.. code-block:: json + + { + "audio": "pipewire", + "bootloader": "systemd-bootctl", + "custom-commands": [ + "cd /home/devel; git clone https://aur.archlinux.org/paru.git", + "chown -R devel:devel /home/devel/paru", + "usermod -aG docker devel" + ], + "!encryption-password": "supersecret", + "filesystem": "btrfs", + "harddrive": { + "path": "/dev/nvme0n1" + }, + "hostname": "development-box", + "kernels": [ + "linux" + ], + "keyboard-language": "us", + "mirror-region": { + "Worldwide": { + "https://mirror.rackspace.com/archlinux/$repo/os/$arch": true + } + }, + "nic": { + "NetworkManager": true + }, + "packages": ["docker", "git", "wget", "zsh"], + "profile": "gnome", + "services": ["docker"], + "superusers": { + "devel": { + "!password": "devel" + } + }, + "timezone": "US/Eastern", + "users": {} + } + +To run it, execute archinstall as a Python module: + +.. code-block:: sh + + python -m archinstall --config + ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| Key | Values/Description | Description | Required | +| | | | | ++======================+========================================================+============================================================================+===============================================+ +| audio | pipewire/pulseaudio | Audioserver to be installed | No | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| bootloader | systemd-bootctl/grub-install | Bootloader to be installed | Yes | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| custom-commands | [ , , ...] | Custom commands to be run post install | No | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| !encryption-password | any | Password to encrypt disk, not encrypted if password not provided | No | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| filesystem | ext4 / btrfs / fat32 etc. | Filesystem for root and home partitions | Yes | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| harddrive | { "path": } | Path of device to be used | Yes | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| hostname | any | Hostname of machine after installation | Yes | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| kernels | [ "kernel1", "kernel2"] | List of kernels to install eg: linux, linux-lts, linux-zen etc | Atleast 1 | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| keyboard-language | 2 letter code for your keyboard language | eg: us, de etc | Yes | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| mirror-region | {"": { "Mirror Name": True/False}, ..} | List of regions and mirrors to use | Yes | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| nic | nic to use, Use value NetworkManager for installing it | | Yes | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| packages | [ "package1", "package2", ..] | List of packages to install post-installation | No | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| profile | Name of profile to install | profiles are present in profiles/, use the name of a profile to install it | No | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| !root-password | any | The root account password | No | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| services | [ "service1", "service2", ..] | Services to enable post-installation | No | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| superusers | { "": { "!password": ""}, ..} | List of superuser credentials, see config for reference | Yes, if root account password is not provided | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| timezone | Timezone to configure in installation | Timezone eg: UTC, Asia/Kolkata etc. | Yes | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ +| users | { "": { "!password": ""}, ..} | List of regular user credentials, see config for reference | Yes, can be {} | ++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+ + Description individual steps ============================ @@ -173,4 +269,4 @@ After which you can press :code:`Enter` can be pressed in order to start the for Post installation ----------------- -Once the installation is complete, green text should appear saying that it's safe to `reboot`, which is also the command you use to reboot. +Once the installation is complete, green text should appear saying that it's safe to `reboot`, which is also the command you use to reboot. \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 439abc44022403a9359faec3b0f6ae58e5029539 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sat, 22 May 2021 18:18:05 +0530 Subject: fixed bootloader flag not being set --- archinstall/lib/installer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 29b3bc1a..1be398e9 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -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['bootloder'] = 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}") -- cgit v1.2.3-70-g09d2 From f789a96348472ae4bfe6277d107cbc3405eba5b2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 19:35:57 +0200 Subject: Added in a are-we-root check at the top of guided. --- examples/guided.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index f61548e1..c5440efe 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -12,6 +12,9 @@ from archinstall.lib.profiles import Profile if archinstall.arguments.get('help'): print("See `man archinstall` for help.") exit(0) +if os.getuid() != 0: + print("Archinstall requires root privileges to run. See --help for more.") + exit(1) # For support reasons, we'll log the disk layout pre installation to match against post-installation layout archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=logging.DEBUG) -- cgit v1.2.3-70-g09d2 From f2e7b1440a0ad7c04bd7540b13eddd1f1f0069b7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 19:58:40 +0200 Subject: Since SysCommand() wraps SysCommandWorker(), but SysCommand() doesn't use contexts, we have to flush the output manually here to avoid newlines not being before the next output. --- archinstall/lib/general.py | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.3-70-g09d2 From b45efe0983387b1b00b8ac956bec3fdd1a97d9f0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:04:55 +0200 Subject: Adding a NTP option to syncronize time. --- examples/guided.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index c5440efe..a2790af3 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -237,6 +237,9 @@ def ask_user_questions(): if not archinstall.arguments.get('timezone', None): archinstall.arguments['timezone'] = archinstall.ask_for_a_timezone() + if not archinstall.arguments.get('ntp', False): + archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') + def perform_installation_steps(): print() @@ -369,6 +372,9 @@ def perform_installation(mountpoint): if timezone := archinstall.arguments.get('timezone', None): installation.set_timezone(timezone) + if archinstall.arguments.get('ntp', False): + installation.activate_ntp() + if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw): installation.user_set_pw('root', root_pw) -- cgit v1.2.3-70-g09d2 From e3a629a6ff71a7d8d3d66f66c40229ecd0e7b8e9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:07:15 +0200 Subject: Added a information that ntp might require some additional tinkering to work perfectly. --- examples/guided.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index a2790af3..fc2baec0 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -239,6 +239,8 @@ def ask_user_questions(): if not archinstall.arguments.get('ntp', False): archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') + if archinstall.arguments['ntp']: + archinstall.log("Hardware time and other post configuration might be required for ntp to work. Please see wiki!", fg="yellow") def perform_installation_steps(): -- cgit v1.2.3-70-g09d2 From 1e53f4a65f8eb5f34953006e0cdf5502a89e89c7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:10:30 +0200 Subject: Made NTP question only on timezone for now. --- examples/guided.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index fc2baec0..69561bfe 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -237,10 +237,11 @@ def ask_user_questions(): if not archinstall.arguments.get('timezone', None): archinstall.arguments['timezone'] = archinstall.ask_for_a_timezone() - if not archinstall.arguments.get('ntp', False): - archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') - if archinstall.arguments['ntp']: - archinstall.log("Hardware time and other post configuration might be required for ntp to work. Please see wiki!", fg="yellow") + if archinstall.arguments['timezone']: + if not archinstall.arguments.get('ntp', False): + archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') + if archinstall.arguments['ntp']: + archinstall.log("Hardware time and other post configuration might be required for ntp to work. Please see wiki!", fg="yellow") def perform_installation_steps(): -- cgit v1.2.3-70-g09d2 From d0a37843aa2bf71f1d8eaa6cbd590aaa1a35e0bf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:13:59 +0200 Subject: Rephrased according to @dylan's suggestions. --- examples/guided.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 69561bfe..e60cd0f8 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -239,9 +239,9 @@ def ask_user_questions(): if archinstall.arguments['timezone']: if not archinstall.arguments.get('ntp', False): - archinstall.arguments['ntp'] = input("Would you like to use automatic time syncronization (ntp) with default time servers? N/y: ").strip().lower() in ('y', 'yes') + archinstall.arguments['ntp'] = input("Would you like to use automatic time synchronization (NTP) with the default time servers? [Y/n]: ").strip().lower() in ('y', 'yes') if archinstall.arguments['ntp']: - archinstall.log("Hardware time and other post configuration might be required for ntp to work. Please see wiki!", fg="yellow") + archinstall.log("Hardware time and other post-configuration steps might be required in order for NTP to work. For more information, please check the Arch wiki.", fg="yellow") def perform_installation_steps(): -- cgit v1.2.3-70-g09d2 From d7e23c847f4901b039b5a78c92e63ffa20b31268 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:40:20 +0200 Subject: Added in the option to select system locale if --advance is given to guided, as it does potentially cause issues in the installation if not configured properly --- examples/guided.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index e60cd0f8..122f0804 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -51,6 +51,17 @@ def ask_user_questions(): selected_region = archinstall.arguments['mirror-region'] archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]} + if not archinstall.arguments.get('sys-language', None) and archinstall.arguments.get('advanced', False): + archinstall.arguments['sys-language'] = input("Enter a valid locale (language) for your OS, (Default: en_US): ").strip() + archinstall.arguments['sys-encoding'] = input("Enter a valid system default encoding for your OS, (Default: utf-8): ").strip() + + if not archinstall.arguments['sys-language']: + archinstall.arguments['sys-language'] = 'en_US' + if not archinstall.arguments['sys-encoding']: + archinstall.arguments['sys-encoding'] = 'utf-8' + + archinstall.log("Keep in mind that if you want multiple locales, post configuration is required.", fg="yellow") + # Ask which harddrive/block-device we will install to if archinstall.arguments.get('harddrive', None): archinstall.arguments['harddrive'] = archinstall.BlockDevice(archinstall.arguments['harddrive']) @@ -328,6 +339,7 @@ def perform_installation(mountpoint): if archinstall.arguments.get('mirror-region', None): archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium if installation.minimal_installation(): + installation.set_locale(archinstall.arguments['sys-language'], archinstall.arguments['sys-encoding'].upper()) 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 -- cgit v1.2.3-70-g09d2 From 1552cc82773b28b91a90f5023565538a2eb965bd Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:50:02 +0200 Subject: Re-worked the select_profile() user interaction. It no longer takes options as a parameter, instead it sources the profiles available, prints a curated list but allows for any input that is a valid profile. --- archinstall/lib/user_interaction.py | 14 ++++++-------- examples/guided.py | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 50c62aa9..503e9a03 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -563,28 +563,26 @@ 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 - :return: The name/dictionary key of the selected profile :rtype: str """ - profiles = sorted(list(options)) + shown_profiles = sorted(list(archinstall.list_profiles(filter_top_level_profiles=True))) + actual_profiles_raw = shown_profiles + sorted([profile for profile in archinstall.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: diff --git a/examples/guided.py b/examples/guided.py index 122f0804..7d033eaf 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -193,7 +193,7 @@ def ask_user_questions(): # Ask for archinstall-specific profiles (such as desktop environments etc) if not archinstall.arguments.get('profile', None): - archinstall.arguments['profile'] = archinstall.select_profile(archinstall.list_profiles(filter_top_level_profiles=True)) + archinstall.arguments['profile'] = archinstall.select_profile() else: archinstall.arguments['profile'] = Profile(installer=None, path=archinstall.arguments['profile']) -- cgit v1.2.3-70-g09d2 From 662ffb05b2dcb0e5a3f134c05a2cea17ea6e8062 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:51:59 +0200 Subject: Fixes docstrings. --- archinstall/lib/user_interaction.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 503e9a03..59768334 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -565,8 +565,7 @@ def select_disk(dict_o_disks): def select_profile(): """ - Asks the user to select a profile from the `options` dictionary parameter. - Usually this is combined with :ref:`archinstall.list_profiles`. + Asks the user to select a profile from the available profiles. :return: The name/dictionary key of the selected profile :rtype: str -- cgit v1.2.3-70-g09d2 From 1bc218b2e1b4844750dc5573a5db1034c51841c5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 20:57:36 +0200 Subject: Forgot an important import. --- archinstall/lib/user_interaction.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 59768334..0a4cd0f9 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. @@ -570,8 +570,8 @@ def select_profile(): :return: The name/dictionary key of the selected profile :rtype: str """ - shown_profiles = sorted(list(archinstall.list_profiles(filter_top_level_profiles=True))) - actual_profiles_raw = shown_profiles + sorted([profile for profile in archinstall.list_profiles() if profile not in shown_profiles]) + 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(shown_profiles) >= 1: for index, profile in enumerate(shown_profiles): -- cgit v1.2.3-70-g09d2 From a9efdac61581844e53c80d214ba88b370c2d7ee6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 21:00:11 +0200 Subject: Fix issue from language selection. --- examples/guided.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 7d033eaf..a25f1b3b 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -54,13 +54,13 @@ def ask_user_questions(): if not archinstall.arguments.get('sys-language', None) and archinstall.arguments.get('advanced', False): archinstall.arguments['sys-language'] = input("Enter a valid locale (language) for your OS, (Default: en_US): ").strip() archinstall.arguments['sys-encoding'] = input("Enter a valid system default encoding for your OS, (Default: utf-8): ").strip() + archinstall.log("Keep in mind that if you want multiple locales, post configuration is required.", fg="yellow") - if not archinstall.arguments['sys-language']: - archinstall.arguments['sys-language'] = 'en_US' - if not archinstall.arguments['sys-encoding']: - archinstall.arguments['sys-encoding'] = 'utf-8' + if not archinstall.arguments['sys-language']: + archinstall.arguments['sys-language'] = 'en_US' + if not archinstall.arguments['sys-encoding']: + archinstall.arguments['sys-encoding'] = 'utf-8' - archinstall.log("Keep in mind that if you want multiple locales, post configuration is required.", fg="yellow") # Ask which harddrive/block-device we will install to if archinstall.arguments.get('harddrive', None): -- cgit v1.2.3-70-g09d2 From 9ce4370fc72463685e25cabfd3340c92dad276a7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 22 May 2021 21:00:59 +0200 Subject: Fix issue from language selection. --- examples/guided.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index a25f1b3b..cbf30eb3 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -56,9 +56,9 @@ def ask_user_questions(): archinstall.arguments['sys-encoding'] = input("Enter a valid system default encoding for your OS, (Default: utf-8): ").strip() archinstall.log("Keep in mind that if you want multiple locales, post configuration is required.", fg="yellow") - if not archinstall.arguments['sys-language']: + if not archinstall.arguments.get('sys-language', None): archinstall.arguments['sys-language'] = 'en_US' - if not archinstall.arguments['sys-encoding']: + if not archinstall.arguments.get('sys-encoding', None): archinstall.arguments['sys-encoding'] = 'utf-8' -- cgit v1.2.3-70-g09d2 From 35578a0d3a2993ff0451e65b35049285e14f88a3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 22 May 2021 17:02:12 -0400 Subject: Proposal: use iso-build for releases --- .github/workflows/iso-build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/iso-build.yaml b/.github/workflows/iso-build.yaml index 106bac4a..d603cdcb 100644 --- a/.github/workflows/iso-build.yaml +++ b/.github/workflows/iso-build.yaml @@ -15,6 +15,9 @@ on: - '**.md' - 'LICENSE' - 'PKGBUILD' + release: + types: + - created jobs: build: -- cgit v1.2.3-70-g09d2 From 48f1e624279e5a0cb1914663d3d3e88982cbf751 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 11:03:16 +0530 Subject: bringing back the old method for parsing extra args as config values --- archinstall/__init__.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/archinstall/__init__.py b/archinstall/__init__.py index ee4748f6..e5fbd95f 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -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,14 +48,15 @@ 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 + print(config) return config -- cgit v1.2.3-70-g09d2 From 9be8a3a998ed671749665dae3fc432305ababc64 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 11:52:21 +0530 Subject: updated mirror-region config key to use value directly --- examples/guided.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index cbf30eb3..c6f40ac7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -445,5 +445,7 @@ else: archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)) else: archinstall.arguments['profile'] = None + if archinstall.arguments.get('mirror-region', None) is not None: + archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[archinstall.arguments.get('mirror-region', None)]} perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 194d45ad2dd9ae0bc051204810cfc5c38a22d33d Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 11:52:52 +0530 Subject: removed debug code --- archinstall/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/archinstall/__init__.py b/archinstall/__init__.py index e5fbd95f..efd3e964 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -56,7 +56,6 @@ def initialize_arguments(): key, val = arg[2:], True config[key] = val config["script"] = args.script - print(config) return config -- cgit v1.2.3-70-g09d2 From 87955e0ba659c46a42d7a48955054b47874b38e2 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 11:56:19 +0530 Subject: fixed pulling mirror-region from config --- examples/guided.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index c6f40ac7..31d11396 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -446,6 +446,7 @@ else: else: archinstall.arguments['profile'] = None if archinstall.arguments.get('mirror-region', None) is not None: - archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[archinstall.arguments.get('mirror-region', None)]} + selected_region = archinstall.arguments.get('mirror-region', None) + archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]} perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 1d04acb603e46f7dcd52b5ecd6686265bbdc3059 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 13:33:48 +0530 Subject: added pulling sys-language and sys-encoding from config --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 31d11396..c3e5848b 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -448,5 +448,7 @@ else: if archinstall.arguments.get('mirror-region', None) is not None: selected_region = archinstall.arguments.get('mirror-region', None) archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]} - + archinstall.arguments['sys-language'] = archinstall.arguments.get('sys-language', 'en_US') + archinstall.arguments['sys-encoding'] = archinstall.arguments.get('sys-encoding', 'utf-8') + perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 9fa9520ac9a172a7d8fed934874019eb94169134 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 23 May 2021 10:32:40 +0200 Subject: Version bump for tagging. --- archinstall/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/__init__.py b/archinstall/__init__.py index ee4748f6..00de0334 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(): -- cgit v1.2.3-70-g09d2 From 43792cd7f39524f97df05e84132d99b132817f70 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 23 May 2021 11:37:51 +0200 Subject: Spelling error --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 1be398e9..b459e990 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -453,7 +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['bootloder'] = True + 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() -- cgit v1.2.3-70-g09d2 From 1c9adbbedfcbd821fc4f4a74f1e63699ac33d6f5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 23 May 2021 11:41:55 +0200 Subject: Made sure NTP matches the default value when 'skipped'. --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index c3e5848b..73fded4e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -250,7 +250,7 @@ def ask_user_questions(): if archinstall.arguments['timezone']: if not archinstall.arguments.get('ntp', False): - archinstall.arguments['ntp'] = input("Would you like to use automatic time synchronization (NTP) with the default time servers? [Y/n]: ").strip().lower() in ('y', 'yes') + archinstall.arguments['ntp'] = input("Would you like to use automatic time synchronization (NTP) with the default time servers? [Y/n]: ").strip().lower() in ('y', 'yes', '') if archinstall.arguments['ntp']: archinstall.log("Hardware time and other post-configuration steps might be required in order for NTP to work. For more information, please check the Arch wiki.", fg="yellow") -- cgit v1.2.3-70-g09d2 From 7daaf1143fca2723bfb63ab4e3030485446da1c0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 23 May 2021 14:18:49 +0200 Subject: Fixes #489 --- archinstall/lib/installer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index b459e990..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 * @@ -547,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", '""']) -- cgit v1.2.3-70-g09d2