From b483c718dae6506fb526f4f096c8335d403c0a59 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 13:03:42 -0400 Subject: Add a message about specifying a web browser --- examples/guided.py | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index a92343f7..9df8a518 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -181,6 +181,7 @@ def ask_user_questions(): exit(1) # Additional packages (with some light weight error handling for invalid package names) + print("Packages not part of the desktop environment are not installed by default. If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") if not archinstall.arguments.get('packages', None): archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] -- cgit v1.2.3-70-g09d2 From e9a3e8661ea15df1440d88dc97e4d2e353be11ba Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 19:05:52 +0200 Subject: Moved the print logic for browser warning --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 9df8a518..4205518d 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -181,8 +181,8 @@ def ask_user_questions(): exit(1) # Additional packages (with some light weight error handling for invalid package names) - print("Packages not part of the desktop environment are not installed by default. If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") if not archinstall.arguments.get('packages', None): + print("Packages not part of the desktop environment are not installed by default. If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] # Verify packages that were given -- cgit v1.2.3-70-g09d2 From b96ba6e23726dc74536be0cf576ac53b067a097c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 7 Apr 2021 20:28:30 -0400 Subject: Break web browser suggestion into second line to avoid wrapping --- examples/guided.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 4205518d..ed838a29 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -182,7 +182,8 @@ def ask_user_questions(): # 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. If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") + print("Packages not part of the desktop environment are not installed by default.") + print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] # Verify packages that were given -- cgit v1.2.3-70-g09d2 From a16723abdec6442eeb70999c3cb92ab3a2b465e3 Mon Sep 17 00:00:00 2001 From: advaithm Date: Mon, 5 Apr 2021 21:05:15 +0530 Subject: Update guided.py --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index ed838a29..7b4faf35 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,4 +1,4 @@ -import getpass, time, json, sys, signal, os +import getpass, time, json, sys, signal, os, subprocess import archinstall """ -- cgit v1.2.3-70-g09d2 From 44df0f6046ac0d010641801a413e7839ca234e97 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 07:21:11 +0530 Subject: added _post_install hook. --- archinstall/lib/profiles.py | 15 +++++++++++++++ examples/guided.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 4ef6c533..b56304c5 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -177,6 +177,21 @@ class Profile(Script): if hasattr(imported, '_prep_function'): return True return False + def has_post_install(self): + with open(self.path, 'r') as source: + source_data = source.read() + + # Some crude safety checks, make sure the imported profile has + # a __name__ check and if so, check if it's got a _prep_function() + # we can call to ask for more user input. + # + # If the requirements are met, import with .py in the namespace to not + # trigger a traditional: + # if __name__ == 'moduleName' + if '__name__' in source_data and '_post_install' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '_post_install'): + return True class Application(Profile): def __repr__(self, *args, **kwargs): diff --git a/examples/guided.py b/examples/guided.py index 7b4faf35..ed838a29 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,4 +1,4 @@ -import getpass, time, json, sys, signal, os, subprocess +import getpass, time, json, sys, signal, os import archinstall """ -- cgit v1.2.3-70-g09d2 From 4059d62e55042583860d78a91d2f83aec71f5cfb Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 09:12:33 -0400 Subject: Add filtration on top level profile --- archinstall/lib/profiles.py | 30 ++++++++++++++++++++++++++++++ examples/guided.py | 4 +++- 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index b56304c5..1948a819 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -177,6 +177,7 @@ class Profile(Script): if hasattr(imported, '_prep_function'): return True return False + def has_post_install(self): with open(self.path, 'r') as source: source_data = source.read() @@ -193,6 +194,35 @@ class Profile(Script): if hasattr(imported, '_post_install'): return True + def is_top_level_profile(self): + with open(self.path, 'r') as source: + source_data = source.read() + + # TODO: I imagine that there is probably a better way to write this. + return 'top_level_profile = True' in source_data + + @property + def packages(self) -> list: + """ + Returns a list of packages baked into the profile definition. + If no package definition has been done, .packages() will return None. + """ + with open(self.path, 'r') as source: + source_data = source.read() + + # Some crude safety checks, make sure the imported profile has + # a __name__ check before importing. + # + # If the requirements are met, import with .py in the namespace to not + # trigger a traditional: + # if __name__ == 'moduleName' + if '__name__' in source_data and '__packages__' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '__packages__'): + return imported.__packages__ + return None + + class Application(Profile): def __repr__(self, *args, **kwargs): return f'Application({os.path.basename(self.profile)})' diff --git a/examples/guided.py b/examples/guided.py index ed838a29..a28aa50e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,5 +1,7 @@ import getpass, time, json, sys, signal, os import archinstall +from archinstall.lib.hardware import hasUEFI +from archinstall.lib.profiles import Profile """ This signal-handler chain (and global variable) @@ -166,7 +168,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()) + archinstall.arguments['profile'] = archinstall.select_profile(filter(lambda profile: (Profile(None, profile).is_top_level_profile()), archinstall.list_profiles())) else: archinstall.arguments['profile'] = archinstall.list_profiles()[archinstall.arguments['profile']] -- cgit v1.2.3-70-g09d2 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 +++++++++++++++++++-- examples/guided.py | 50 +----------------------- examples/minimal.py | 78 ++++++++++++++++++++++++++----------- 3 files changed, 98 insertions(+), 74 deletions(-) (limited to 'examples/guided.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)): diff --git a/examples/guided.py b/examples/guided.py index a28aa50e..6feebd00 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,30 +1,8 @@ -import getpass, time, json, sys, signal, os +import getpass, time, json, os import archinstall from archinstall.lib.hardware import hasUEFI from archinstall.lib.profiles import Profile -""" -This signal-handler chain (and global variable) -is used to trigger the "Are you sure you want to abort?" question further down. -It might look a bit odd, but have a look at the line: "if SIG_TRIGGER:" -""" -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) - -if archinstall.arguments.get('help'): - print("See `man archinstall` for help.") - exit(0) - def ask_user_questions(): """ First, we'll ask the user for a bunch of user input. @@ -206,8 +184,6 @@ def ask_user_questions(): def perform_installation_steps(): - global SIG_TRIGGER - print() print('This is your chosen configuration:') archinstall.log("-- Guided template chosen (with below config) --", level=archinstall.LOG_LEVELS.Debug) @@ -222,29 +198,7 @@ def perform_installation_steps(): """ print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') - - 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) - - # Put back the default/original signal handler now that we're done catching - # and interrupting SIGINT with "Do you really want to abort". - print() - signal.signal(signal.SIGINT, original_sigint_handler) + archinstall.do_countdown() """ Setup the blockdevice, filesystem (and optionally encryption). diff --git a/examples/minimal.py b/examples/minimal.py index 9124f5bd..b9472ac9 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -1,30 +1,64 @@ import archinstall, getpass -# Unmount and close previous runs -archinstall.sys_command(f'umount -R /mnt', suppress_errors=True) -archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_errors=True) - # Select a harddrive and a disk password -harddrive = archinstall.select_disk(archinstall.all_disks()) -disk_password = getpass.getpass(prompt='Disk password (won\'t echo): ') +archinstall.log(f"Minimal only supports:") +archinstall.log(f" * Being installed to a single disk") + +if archinstall.arguments.get('help', None): + archinstall.log(f" - Optional disk encryption via --!encryption-password=") + archinstall.log(f" - Optional filesystem type via --filesystem=") + archinstall.log(f" - Optional systemd network via --network") + +archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks()) +archinstall.arguments['harddrive'].keep_partitions = False + +def install_on(root, boot): + # We kick off the installer by telling it where the root and boot lives + with archinstall.Installer(root, boot_partition=boot, hostname='minimal-arch') as installation: + # Strap in the base system, add a boot loader and configure + # some other minor details as specified by this profile and user. + if installation.minimal_installation(): + installation.add_bootloader() + + # Optionally enable networking: + if archinstall.arguments.get('network', None): + installation.copy_ISO_network_config(enable_services=True) + + installation.add_additional_packages(['nano', 'wget', 'git']) + installation.install_profile('minimal') + + installation.user_create('devel', 'devel') + installation.user_set_pw('root', 'airoot') + + # Once this is done, we output some useful information to the user + # And the installation is complete. + archinstall.log(f"There are two new accounts in your installation after reboot:") + archinstall.log(f" * root (password: airoot)") + archinstall.log(f" * devel (password: devel)") + +print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') +archinstall.do_countdown() + +# First, we configure the basic filesystem layout +with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: + # We use the entire disk instead of setting up partitions on your own + if archinstall.arguments['harddrive'].keep_partitions is False: + fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) -with archinstall.Filesystem(harddrive, archinstall.GPT) as fs: - # Use the entire disk instead of setting up partitions on your own - fs.use_entire_disk('luks2') + boot = fs.find_partition('/boot') + root = fs.find_partition('/') - if harddrive.partition[1].size == '512M': - raise OSError('Trying to encrypt the boot partition for petes sake..') - harddrive.partition[0].format('fat32') + boot.format('vfat') - with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device: - unlocked_device.format('btrfs') - - with archinstall.Installer(unlocked_device, boot_partition=harddrive.partition[0], hostname='testmachine') as installation: - if installation.minimal_installation(): - installation.add_bootloader() + # We encrypt the root partition if we got a password to do so with, + # Otherwise we just skip straight to formatting and installation + if archinstall.arguments.get('!encryption-password', None): + root.encrypt() - installation.add_additional_packages(['nano', 'wget', 'git']) - installation.install_profile('minimal') + with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: + unlocked_root.format(root.filesystem) - installation.user_create('devel', 'devel') - installation.user_set_pw('root', 'toor') + install_on(unlocked_root) + else: + root.format(root.filesystem) + install_on(root) \ No newline at end of file -- cgit v1.2.3-70-g09d2 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 'examples/guided.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-70-g09d2 From ce044064485027647e123b71522729469261113d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 15:40:48 +0200 Subject: Added some debugging --- examples/guided.py | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 0d8030c7..06f91346 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -247,6 +247,7 @@ def perform_installation_steps(): fs.find_partition('/boot').mount('/mnt/boot') + exit(1) perform_installation('/mnt') -- cgit v1.2.3-70-g09d2 From 0dafeacabd37f77f3ffc6e4a4bf769a7fe3ea2bb Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 15:42:35 +0200 Subject: Removed some debugging --- examples/guided.py | 1 - 1 file changed, 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 06f91346..0d8030c7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -247,7 +247,6 @@ def perform_installation_steps(): fs.find_partition('/boot').mount('/mnt/boot') - exit(1) perform_installation('/mnt') -- cgit v1.2.3-70-g09d2 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 'examples/guided.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-70-g09d2 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 'examples/guided.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-70-g09d2 From 9395d68d5d2d82bf3df66e9450fb51941552bd4e Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Tue, 6 Apr 2021 20:44:44 -0400 Subject: Try removing pipewire.py and calling add additional packages Unfortunately, calling the profile was not working. --- examples/guided.py | 2 +- profiles/applications/pipewire.py | 5 ----- profiles/gnome.py | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 profiles/applications/pipewire.py (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 77b64450..bd4b5a9f 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -285,7 +285,7 @@ def perform_installation(device, boot_partition, language, mirrors): 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') + installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) 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 deleted file mode 100644 index aea5b50d..00000000 --- a/profiles/applications/pipewire.py +++ /dev/null @@ -1,5 +0,0 @@ -import archinstall - -packages = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] - -installation.add_additional_packages(packages) diff --git a/profiles/gnome.py b/profiles/gnome.py index 2e26350a..c75cafee 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -31,7 +31,7 @@ if __name__ == 'gnome': # Install the application gnome from the template under /applications/ gnome = archinstall.Application(installation, 'gnome') gnome.install() - + installation.enable_service('gdm') # Gnome Display Manager # We could also start it via xinitrc since we do have Xorg, # but for gnome that's deprecated and wayland is preferred. -- cgit v1.2.3-70-g09d2 From d252e090a646275b8e0d3b19070577f9884aba58 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Tue, 6 Apr 2021 20:47:30 -0400 Subject: Have pulseaudio installed just in case DEs don't depend on it if pipewire is not requested. --- examples/guided.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index bd4b5a9f..f7078242 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -286,6 +286,9 @@ def perform_installation(device, boot_partition, language, mirrors): if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) + elif archinstall.arguments.get('audio', None) == 'pulseaudio': + print('Installing pulseaudio ...') + installation.add_additional_packages("pulseaudio") if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) -- cgit v1.2.3-70-g09d2 From dbea18dab868dd4e32a2e72628dcb75a159f87a9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 09:28:16 +0200 Subject: Switched from print to installation.log --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index f7078242..490fbe96 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -282,7 +282,7 @@ 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)) + installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) -- cgit v1.2.3-70-g09d2 From 4c92879c1de26b88afcdb1955bd2c9c153d2787a Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 19:51:16 -0400 Subject: Make audio server selection only prompt for desktop profiles --- examples/guided.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 490fbe96..e136437e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -160,9 +160,16 @@ def ask_user_questions(): ) exit(1) - # Ask about audio server selection (this right now just asks for pipewire and defaults to pulseaudio otherwise) + # Ask about audio server selection if one is not already set if not archinstall.arguments.get('audio', None): - archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() + + # only ask for audio server selection on a desktop profile + if str(archinstall.arguments['profile']) == 'Profile(desktop)': + archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() + else: + # packages installed by a profile may depend on audio and something may get installed anyways, not much we can do about that. + # we will not try to remove packages post-installation to not have audio, as that may cause multiple issues + archinstall.arguments['audio'] = 'none' # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): @@ -282,13 +289,14 @@ def perform_installation(device, boot_partition, language, mirrors): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) - if archinstall.arguments.get('audio', None) == 'pipewire': - print('Installing pipewire ...') - installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) - elif archinstall.arguments.get('audio', None) == 'pulseaudio': - print('Installing pulseaudio ...') - installation.add_additional_packages("pulseaudio") + if archinstall.arguments['audio'] != 'none': + installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) + if archinstall.arguments.get('audio', None) == 'pipewire': + print('Installing pipewire ...') + installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) + elif archinstall.arguments.get('audio', None) == 'pulseaudio': + print('Installing pulseaudio ...') + installation.add_additional_packages("pulseaudio") if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) -- cgit v1.2.3-70-g09d2 From cf1fd9e25797a73dd8787d741b1276bd5b86e743 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 08:17:40 +0200 Subject: Safety precaution by using .get instead of ["..."] --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index e136437e..18f2cc64 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -289,7 +289,7 @@ def perform_installation(device, boot_partition, language, mirrors): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - if archinstall.arguments['audio'] != 'none': + if archinstall.arguments.get('audio', None) != None: installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') -- cgit v1.2.3-70-g09d2 From e1e813fc5e0369387f8aae0ca279758fe9ab5c08 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 07:33:17 +0530 Subject: updated guided.py to allow network manager as nic --- examples/guided.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 18f2cc64..93b0f85f 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -282,7 +282,8 @@ 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: + installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface elif archinstall.arguments.get('nic', None): installation.configure_nic(**archinstall.arguments.get('nic', {})) -- cgit v1.2.3-70-g09d2 From 55622fd79d25fdef34d06e0c9d4d6444cece98ad Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 08:54:35 +0530 Subject: install networkmanager, if required --- examples/guided.py | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 93b0f85f..85213960 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -283,6 +283,7 @@ def perform_installation(device, boot_partition, language, mirrors): 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: + installation.add_additional_packages("networkmanager") installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface elif archinstall.arguments.get('nic', None): -- cgit v1.2.3-70-g09d2 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 'examples/guided.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-70-g09d2 From b6ad3dffc9b76675741a63d846135f7a3ff353f3 Mon Sep 17 00:00:00 2001 From: Advaith Madhukar Date: Sun, 4 Apr 2021 14:42:19 +0530 Subject: fixed network manager check --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index e8bc2b53..46f0ba54 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('nic',None) == 'Use NetworkManager to control and manage your internet connection': + elif archinstall.arguments.get('nic',{}).get('NetworkManager',False): installation.add_additional_packages("networkmanager") installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface -- cgit v1.2.3-70-g09d2 From 6a0b839bc8be05bce8630758526ec0bc122e91ce Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 11:59:47 -0400 Subject: pipewire-docs isn't really needed. --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 46f0ba54..c7fecb5e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -295,7 +295,7 @@ def perform_installation(device, boot_partition, language, mirrors): installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') - installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) + installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) elif archinstall.arguments.get('audio', None) == 'pulseaudio': print('Installing pulseaudio ...') installation.add_additional_packages("pulseaudio") -- cgit v1.2.3-70-g09d2 From f57b533275251b8f249a1a396261489e4f0266d8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 20:18:14 +0200 Subject: Added some debug output Adding debug output for additional package selection. --- examples/guided.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index c7fecb5e..60517005 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -177,12 +177,14 @@ def ask_user_questions(): print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] - # Verify packages that were given - try: - archinstall.validate_package_list(archinstall.arguments['packages']) - except archinstall.RequirementError as e: - archinstall.log(e, fg='red') - exit(1) + if len(archinstall.arguments['packages']): + # Verify packages that were given + try: + archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)") + archinstall.validate_package_list(archinstall.arguments['packages']) + except archinstall.RequirementError as e: + archinstall.log(e, fg='red') + exit(1) # Ask or Call the helper function that asks the user to optionally configure a network. if not archinstall.arguments.get('nic', None): -- cgit v1.2.3-70-g09d2 From 9b2f627d9eb024e5068e317c00e7f8d8bb0ffa09 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:41:13 +0200 Subject: Fixing broken logic in guided --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 2028c0c4..ed0a485a 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -37,7 +37,7 @@ def ask_user_questions(): # 1. Check if it has partitions # 3. Check that we support the current partitions # 2. If so, ask if we should keep them or wipe everything - if archinstall.arguments['harddrive'].has_partitions(): + if archinstall.arguments['harddrive'] and archinstall.arguments['harddrive'].has_partitions(): archinstall.log(f"{archinstall.arguments['harddrive']} contains the following partitions:", fg='yellow') # We curate a list pf supported partitions -- cgit v1.2.3-70-g09d2 From 22eb6e023ddf04552777d5c59a1054836964dd42 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:42:28 +0200 Subject: Fixing broken logic in guided --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index ed0a485a..b4b970bb 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -116,7 +116,7 @@ def ask_user_questions(): elif option == 'format-all': archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format() archinstall.arguments['harddrive'].keep_partitions = False - else: + elif archinstall.arguments['harddrive']: # If the drive doesn't have any partitions, safely mark the disk with keep_partitions = False # and ask the user for a root filesystem. archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format() -- cgit v1.2.3-70-g09d2 From 103320b06188565f2166e0330dd3a8bedb9f8572 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:43:17 +0200 Subject: Fixing broken logic in guided --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index b4b970bb..79023012 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -123,7 +123,7 @@ def ask_user_questions(): archinstall.arguments['harddrive'].keep_partitions = False # Get disk encryption password (or skip if blank) - if not archinstall.arguments.get('!encryption-password', None): + if archinstall.arguments['harddrive'] and archinstall.arguments.get('!encryption-password', None) is None: if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')): archinstall.arguments['!encryption-password'] = passwd archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password'] -- cgit v1.2.3-70-g09d2