From b5245b31fec9c19a16a8b00233afb1cfee1499fa Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 21:14:19 +0200 Subject: I simplified the countdown, by moving it into it's own function instead of wrapped inside guided.. This can now be used by others for a simple countdown. I also re-worked the minimal.py example to work with the new internal partitioning logic API as well as support some flags from archinstall.arguments to minimize user input requirements to just one single question. This one question will most likely go away too, but stays for simplicity right now. --- archinstall/lib/user_interaction.py | 44 +++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 3830962c..33abbefb 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -1,4 +1,5 @@ import getpass, pathlib, os, shutil, re +import sys, time, signal from .exceptions import * from .profiles import Profile from .locale_helpers import search_keyboard_layout @@ -19,14 +20,49 @@ def get_longest_option(options): return max([len(x) for x in options]) def check_for_correct_username(username): - if re.match(r'^[a-z_][a-z0-9_-]*\$?$', username) and len(username) <= 32: - return True - log( + if re.match(r'^[a-z_][a-z0-9_-]*\$?$', username) and len(username) <= 32: + return True + log( "The username you entered is invalid. Try again", level=LOG_LEVELS.Warning, fg='red' ) - return False + return False + +def do_countdown(): + SIG_TRIGGER = False + def kill_handler(sig, frame): + print() + exit(0) + + def sig_handler(sig, frame): + global SIG_TRIGGER + SIG_TRIGGER = True + signal.signal(signal.SIGINT, kill_handler) + + original_sigint_handler = signal.getsignal(signal.SIGINT) + signal.signal(signal.SIGINT, sig_handler) + + for i in range(5, 0, -1): + print(f"{i}", end='') + + for x in range(4): + sys.stdout.flush() + time.sleep(0.25) + print(".", end='') + + if SIG_TRIGGER: + abort = input('\nDo you really want to abort (y/n)? ') + if abort.strip() != 'n': + exit(0) + + if SIG_TRIGGER is False: + sys.stdin.read() + SIG_TRIGGER = False + signal.signal(signal.SIGINT, sig_handler) + print() + signal.signal(signal.SIGINT, original_sigint_handler) + return True def get_password(prompt="Enter a password: "): while (passwd := getpass.getpass(prompt)): -- cgit v1.2.3-54-g00ecf From acc2dac6527b5f7553a7066f80cc0680d328d31e Mon Sep 17 00:00:00 2001 From: Insanemal Date: Fri, 9 Apr 2021 13:44:51 +1000 Subject: Off by one in generic_selection out of bounds check Out of bounds check in generic_selection is using >= on list. Lists are zero based. If you put in a value that equals the number of items in the list you get an out of bounds error. Removed the equals part of the test as last item in list/dictionary items is len(list)-1 not len(list) --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 3830962c..f8585595 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -184,7 +184,7 @@ def generic_select(options, input_text="Select one of the above by index or abso return None elif selected_option.isdigit(): selected_option = int(selected_option) - if selected_option >= len(options): + if selected_option > len(options): raise RequirementError(f'Selected option "{selected_option}" is out of range') selected_option = options[selected_option] elif selected_option in options: -- cgit v1.2.3-54-g00ecf From f298b9e39387cae7a77a0677b1d1e4478bfdc8d0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 15:27:22 +0200 Subject: Added a 'use /mnt' option to the formatted #124. This has not yet been tested, but the logic should work according to the new API layout for Installation(). --- archinstall/lib/user_interaction.py | 1 + examples/guided.py | 109 +++++++++++++++++++----------------- 2 files changed, 58 insertions(+), 52 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 1f5924e4..949689c7 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -179,6 +179,7 @@ def ask_to_configure_network(): def ask_for_disk_layout(): options = { 'keep-existing' : 'Keep existing partition layout and select which ones to use where.', + 'use-mnt' : 'Use whatever is mounted under /mnt and don\'t format anything', 'format-all' : 'Format entire drive and setup a basic partition scheme.', 'abort' : 'Abort the installation.' } diff --git a/examples/guided.py b/examples/guided.py index 6feebd00..0d8030c7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -53,6 +53,9 @@ def ask_user_questions(): if (option := archinstall.ask_for_disk_layout()) == 'abort': archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.") exit(1) + elif option == 'use-mnt': + archinstall.arguments['harddrive'] = None + archinstall.arguments['target-mount'] = '/mnt' elif option == 'keep-existing': archinstall.arguments['harddrive'].keep_partitions = True @@ -197,62 +200,63 @@ def perform_installation_steps(): We mention the drive one last time, and count from 5 to 0. """ - print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') - archinstall.do_countdown() - - """ - Setup the blockdevice, filesystem (and optionally encryption). - Once that's done, we'll hand over to perform_installation() - """ - with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: - # Wipe the entire drive if the disk flag `keep_partitions`is False. - if archinstall.arguments['harddrive'].keep_partitions is False: - fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) - - # Check if encryption is desired and mark the root partition as encrypted. - if archinstall.arguments.get('!encryption-password', None): - root_partition = fs.find_partition('/') - root_partition.encrypted = True - - # After the disk is ready, iterate the partitions and check - # which ones are safe to format, and format those. - for partition in archinstall.arguments['harddrive']: - if partition.safe_to_format(): - # Partition might be marked as encrypted due to the filesystem type crypt_LUKS - # But we might have omitted the encryption password question to skip encryption. - # In which case partition.encrypted will be true, but passwd will be false. - if partition.encrypted and (passwd := archinstall.arguments.get('!encryption-password', None)): - partition.encrypt(password=passwd) + if archinstall.arguments.get('harddrive', None): + print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') + archinstall.do_countdown() + + """ + Setup the blockdevice, filesystem (and optionally encryption). + Once that's done, we'll hand over to perform_installation() + """ + with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: + # Wipe the entire drive if the disk flag `keep_partitions`is False. + if archinstall.arguments['harddrive'].keep_partitions is False: + fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) + + # Check if encryption is desired and mark the root partition as encrypted. + if archinstall.arguments.get('!encryption-password', None): + root_partition = fs.find_partition('/') + root_partition.encrypted = True + + # After the disk is ready, iterate the partitions and check + # which ones are safe to format, and format those. + for partition in archinstall.arguments['harddrive']: + if partition.safe_to_format(): + # Partition might be marked as encrypted due to the filesystem type crypt_LUKS + # But we might have omitted the encryption password question to skip encryption. + # In which case partition.encrypted will be true, but passwd will be false. + if partition.encrypted and (passwd := archinstall.arguments.get('!encryption-password', None)): + partition.encrypt(password=passwd) + else: + partition.format() else: - partition.format() + archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug) + + fs.find_partition('/boot').format('vfat') + + if archinstall.arguments.get('!encryption-password', None): + # First encrypt and unlock, then format the desired partition inside the encrypted part. + # archinstall.luks2() encrypts the partition when entering the with context manager, and + # unlocks the drive so that it can be used as a normal block-device within archinstall. + with archinstall.luks2(fs.find_partition('/'), 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device: + unlocked_device.format(fs.find_partition('/').filesystem) + unlocked_device.mount('/mnt') else: - archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug) - - if archinstall.arguments.get('!encryption-password', None): - # First encrypt and unlock, then format the desired partition inside the encrypted part. - # archinstall.luks2() encrypts the partition when entering the with context manager, and - # unlocks the drive so that it can be used as a normal block-device within archinstall. - with archinstall.luks2(fs.find_partition('/'), 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device: - unlocked_device.format(fs.find_partition('/').filesystem) - - perform_installation(device=unlocked_device, - boot_partition=fs.find_partition('/boot'), - language=archinstall.arguments['keyboard-language'], - mirrors=archinstall.arguments['mirror-region']) - else: - perform_installation(device=fs.find_partition('/'), - boot_partition=fs.find_partition('/boot'), - language=archinstall.arguments['keyboard-language'], - mirrors=archinstall.arguments['mirror-region']) - - -def perform_installation(device, boot_partition, language, mirrors): + fs.find_partition('/').format(fs.find_partition('/').filesystem) + fs.find_partition('/').mount('/mnt') + + fs.find_partition('/boot').mount('/mnt/boot') + + perform_installation('/mnt') + + +def perform_installation(mountpoint): """ Performs the installation steps on a block device. Only requirement is that the block devices are formatted and setup prior to entering this function. """ - with archinstall.Installer(device, boot_partition=boot_partition, hostname=archinstall.arguments.get('hostname', 'Archinstall')) as installation: + with archinstall.Installer(mountpoint) as installation: ## if len(mirrors): # Certain services might be running that affects the system during installation. # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist @@ -261,10 +265,11 @@ def perform_installation(device, boot_partition, language, mirrors): while 'dead' not in (status := archinstall.service_state('reflector')): time.sleep(1) - archinstall.use_mirrors(mirrors) # Set the mirrors for the live medium + archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium if installation.minimal_installation(): - installation.set_mirrors(mirrors) # Set the mirrors in the installation medium - installation.set_keyboard_language(language) + installation.set_hostname(archinstall.arguments['hostname']) + installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium + installation.set_keyboard_language(archinstall.arguments['keyboard-language']) installation.add_bootloader() # If user selected to copy the current ISO network configuration -- cgit v1.2.3-54-g00ecf From bd134c5db0f9fb93b51e00b3a2df992715d28d81 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 17:33:44 +0200 Subject: Moved the 'use /mnt' logic to during disk selection. --- archinstall/lib/user_interaction.py | 7 ++++--- examples/guided.py | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 949689c7..cb0fb012 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -179,7 +179,6 @@ def ask_to_configure_network(): def ask_for_disk_layout(): options = { 'keep-existing' : 'Keep existing partition layout and select which ones to use where.', - 'use-mnt' : 'Use whatever is mounted under /mnt and don\'t format anything', 'format-all' : 'Format entire drive and setup a basic partition scheme.', 'abort' : 'Abort the installation.' } @@ -246,8 +245,10 @@ def select_disk(dict_o_disks): if len(drives) >= 1: for index, drive in enumerate(drives): print(f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})") - drive = input('Select one of the above disks (by number or full path): ') - if drive.isdigit(): + drive = input('Select one of the above disks (by number or full path) or write /mnt to skip partitioning: ') + if drive.strip() == '/mnt': + return None + elif drive.isdigit(): drive = int(drive) if drive >= len(drives): raise DiskError(f'Selected option "{drive}" is out of range') diff --git a/examples/guided.py b/examples/guided.py index 0d8030c7..2028c0c4 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -30,6 +30,8 @@ def ask_user_questions(): archinstall.arguments['harddrive'] = archinstall.BlockDevice(archinstall.arguments['harddrive']) else: archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks()) + if archinstall.arguments['harddrive'] is None: + archinstall.arguments['target-mount'] = '/mnt' # Perform a quick sanity check on the selected harddrive. # 1. Check if it has partitions @@ -53,9 +55,6 @@ def ask_user_questions(): if (option := archinstall.ask_for_disk_layout()) == 'abort': archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.") exit(1) - elif option == 'use-mnt': - archinstall.arguments['harddrive'] = None - archinstall.arguments['target-mount'] = '/mnt' elif option == 'keep-existing': archinstall.arguments['harddrive'].keep_partitions = True -- cgit v1.2.3-54-g00ecf From b803c281ea98f71842c7598e428832eaf4a24584 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 18:04:03 -0400 Subject: Move choice into guided installation instead of DEs Arch wiki says packages should enable the user services automatically --- archinstall/lib/user_interaction.py | 8 ++++++++ examples/guided.py | 10 +++++++++- profiles/applications/pipewire.py | 4 ++-- profiles/awesome.py | 6 ------ profiles/cinnamon.py | 6 ------ profiles/gnome.py | 6 ------ profiles/kde.py | 6 ------ profiles/xfce4.py | 6 ------ 8 files changed, 19 insertions(+), 33 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 1f5924e4..8062f6e3 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -139,6 +139,14 @@ def ask_for_a_timezone(): level=LOG_LEVELS.Warning, fg='red' ) + +def ask_for_audio_selection(): + audio = "pulseaudio" # Default for most desktop environments + pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + if pipewire_choice == "y": + audio = "pipewire" + + return audio def ask_to_configure_network(): # Optionally configure one network interface. diff --git a/examples/guided.py b/examples/guided.py index 6feebd00..77b64450 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -160,6 +160,10 @@ def ask_user_questions(): ) exit(1) + # Ask about audio server selection (this right now just asks for pipewire and defaults to pulseaudio otherwise) + if not archinstall.arguments.get('audio', None): + archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() + # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): print("Packages not part of the desktop environment are not installed by default.") @@ -278,7 +282,11 @@ def perform_installation(device, boot_partition, language, mirrors): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - + print('This audio server will be used: ' + archinstall.arguments.get('audio', None)) + if archinstall.arguments.get('audio', None) == 'pipewire': + print('Installing pipewire ...') + installation.install_profile('pipewire') + if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) diff --git a/profiles/applications/pipewire.py b/profiles/applications/pipewire.py index 2d9f6a6c..aea5b50d 100644 --- a/profiles/applications/pipewire.py +++ b/profiles/applications/pipewire.py @@ -1,5 +1,5 @@ import archinstall -__packages__ = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] +packages = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] -installation.add_additional_packages(__packages__) +installation.add_additional_packages(packages) diff --git a/profiles/awesome.py b/profiles/awesome.py index 0bcdfc59..0b00a424 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -29,12 +29,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py") # or through conventional import awesome if __name__ == 'awesome': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install the application awesome from the template under /applications/ awesome = archinstall.Application(installation, 'awesome') awesome.install() diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index 0c4f13d1..91a59811 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -24,12 +24,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") # or through conventional import cinnamon if __name__ == 'cinnamon': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/gnome.py b/profiles/gnome.py index 018ea821..2e26350a 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -25,12 +25,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("gnome", "/somewhere/gnome.py") # or through conventional import gnome if __name__ == 'gnome': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/kde.py b/profiles/kde.py index a472394a..6654dfa7 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -34,12 +34,6 @@ def _post_install(*args, **kwargs): # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde if __name__ == 'kde': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/xfce4.py b/profiles/xfce4.py index ae318317..fee8c37a 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -25,12 +25,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") # or through conventional import xfce4 if __name__ == 'xfce4': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') -- cgit v1.2.3-54-g00ecf From 9312076cfe552922aeed68f6c83e4a92775683a2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 09:29:50 +0200 Subject: Change phrasing to indicate pulseaudio as default --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 8062f6e3..96a76e9e 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -142,7 +142,7 @@ def ask_for_a_timezone(): def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() if pipewire_choice == "y": audio = "pipewire" -- cgit v1.2.3-54-g00ecf From 45c321e327270f010daa42ad247c4c5ca67c1f16 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 21:31:28 -0400 Subject: Assume yes is the user's intention if empty response for pipewire prompt --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 96a76e9e..f1899a05 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -143,7 +143,7 @@ def ask_for_a_timezone(): def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() - if pipewire_choice == "y": + if pipewire_choice in ("y", ""): audio = "pipewire" return audio -- cgit v1.2.3-54-g00ecf From cab53ef8f611dbee33e946bed4ca2fb1e7ebe285 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 07:24:52 +0530 Subject: networkmanager support --- archinstall/lib/user_interaction.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index f1899a05..5538272f 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -152,7 +152,7 @@ def ask_to_configure_network(): # Optionally configure one network interface. #while 1: # {MAC: Ifname} - interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation', **list_interfaces()} + interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage you internet conntetion', **list_interfaces()} nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': @@ -176,9 +176,9 @@ def ask_to_configure_network(): if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()): dns = dns_input.split(' ') - return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} + return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns}s else: - return {'nic': nic} + return {'nic': nic,'NetworkManager':True} elif nic: return nic -- cgit v1.2.3-54-g00ecf From 75a36e2fdc96e0e4e0a758f360f00456b49d37a8 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:03:49 +0530 Subject: fixed typo --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 5538272f..62b0a3eb 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -176,7 +176,7 @@ def ask_to_configure_network(): if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()): dns = dns_input.split(' ') - return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns}s + return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} else: return {'nic': nic,'NetworkManager':True} elif nic: -- cgit v1.2.3-54-g00ecf From 46c43b25a6e1dcf6a633744c06738f8efd542ed8 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:08:17 +0530 Subject: moved around the if block --- archinstall/lib/user_interaction.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 62b0a3eb..c140b6fa 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -156,6 +156,8 @@ def ask_to_configure_network(): nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': + if nic == 'Use NetworkManager to control and manage you internet conntetion': + return {'nic': nic,'NetworkManager':True} mode = generic_select(['DHCP (auto detect)', 'IP (static)'], f"Select which mode to configure for {nic}: ") if mode == 'IP (static)': while 1: @@ -178,7 +180,7 @@ def ask_to_configure_network(): return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} else: - return {'nic': nic,'NetworkManager':True} + return {'nic': nic} elif nic: return nic -- cgit v1.2.3-54-g00ecf From dd61830d2b6379ff772ab6099560d4e012864b9f Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:26:28 +0530 Subject: fixed some typos and changed up how we detect if we have to enable/install network manager --- archinstall/lib/user_interaction.py | 4 ++-- examples/guided.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index c140b6fa..b9bfe89c 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -152,11 +152,11 @@ def ask_to_configure_network(): # Optionally configure one network interface. #while 1: # {MAC: Ifname} - interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage you internet conntetion', **list_interfaces()} + interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage your internet connection', **list_interfaces()} nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': - if nic == 'Use NetworkManager to control and manage you internet conntetion': + if nic == 'Use NetworkManager to control and manage your internet connection': return {'nic': nic,'NetworkManager':True} mode = generic_select(['DHCP (auto detect)', 'IP (static)'], f"Select which mode to configure for {nic}: ") if mode == 'IP (static)': diff --git a/examples/guided.py b/examples/guided.py index 85213960..e8bc2b53 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -282,7 +282,7 @@ def perform_installation(device, boot_partition, language, mirrors): # Perform a copy of the config if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation': installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium. - elif archinstall.arguments.get('NetworkManager',None) == True: + elif archinstall.arguments.get('nic',None) == 'Use NetworkManager to control and manage your internet connection': installation.add_additional_packages("networkmanager") installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface -- cgit v1.2.3-54-g00ecf