From e717a72a10907a02bc485b763f195cddcc68bbe0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 22:47:13 +0200 Subject: Starting implementing #124. The installer will be detatched from block devices and partitions. Instead it will rely on a given destination to pacstrap to. From there, it should be able to do reverse-lookups on the target and base it's information and choises from there. This removes any form of partitioning logic, hardware logic and other things from the initialization of the installer. These things should be explicitly called from the installers functions instead. Such as .set_hostname() instead of passing it as a initiation variable. --- examples/minimal.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/minimal.py b/examples/minimal.py index 367574b5..afd64a2e 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -12,12 +12,13 @@ if archinstall.arguments.get('help', None): 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: +def install_on(mountpoint): + # We kick off the installer by telling it where the + with archinstall.Installer(mountpoint) 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.set_hostname('minimal-arch') installation.add_bootloader() # Optionally enable networking: @@ -57,8 +58,10 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: unlocked_root.format(root.filesystem) - - install_on(unlocked_root) + unlocked_root.mount('/mnt') else: root.format(root.filesystem) - install_on(root, boot) \ No newline at end of file + root.mount('/mnt') + + boot.mount('/mnt/boot') + install_on('/mnt') \ No newline at end of file -- cgit v1.2.3-70-g09d2 From cea8892c7c7a46548d4d946b3e5ed5142757ea13 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:44:03 +0200 Subject: Setting .encrypted flag in minimal. --- examples/minimal.py | 1 + 1 file changed, 1 insertion(+) (limited to 'examples') diff --git a/examples/minimal.py b/examples/minimal.py index afd64a2e..adb033b6 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -54,6 +54,7 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) # 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.encrypted = True root.encrypt() with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: -- cgit v1.2.3-70-g09d2 From da12f3630575976d43a6c717235bc273c63da7bd Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:59:55 +0200 Subject: Forgot to give a password during encryption. --- examples/minimal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/minimal.py b/examples/minimal.py index adb033b6..d40ce2f8 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -55,7 +55,7 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) # Otherwise we just skip straight to formatting and installation if archinstall.arguments.get('!encryption-password', None): root.encrypted = True - root.encrypt() + root.encrypt(password=archinstall.arguments.get('!encryption-password', None)) with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: unlocked_root.format(root.filesystem) -- cgit v1.2.3-70-g09d2 From 740eccb213c69fb706d10003a1305a93442afb62 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 15:06:34 +0200 Subject: Removed 'getpass' from imports. --- examples/minimal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/minimal.py b/examples/minimal.py index d40ce2f8..90bd9227 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -1,4 +1,4 @@ -import archinstall, getpass +import archinstall # Select a harddrive and a disk password archinstall.log(f"Minimal only supports:") -- 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') 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') 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') 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') 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 5099376dcdf59cbfcd146f3c2fa92872b2b1920c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 21:50:53 +0200 Subject: Attempting to fix auto-detection of encrypted drives. So that #124 can perform reverse detection on partitions and detect encryption. --- archinstall/lib/disk.py | 4 ++++ archinstall/lib/installer.py | 5 +++-- examples/minimal.py | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index f6dc16eb..fe06ac00 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -214,6 +214,10 @@ class Partition(): self._encrypted = value + @property + def parent(self): + return self.real_device + @property def real_device(self): if not self._encrypted: diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 48ef7259..7fd775b1 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -283,8 +283,9 @@ class Installer(): if '/usr/bin/btrfs-progs' not in BINARIES: BINARIES.append('/usr/bin/btrfs') - elif partition.encrypted and 'encrypt' not in HOOKS: - HOOKS.insert(HOOKS.find('filesystems'), 'encrypt') + elif (partition.encrypted or Partition(partition.parent, None).filesystem == 'crypto_LUKS'): + if 'encrypt' not in HOOKS: + HOOKS.insert(HOOKS.find('filesystems'), 'encrypt') self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True diff --git a/examples/minimal.py b/examples/minimal.py index 90bd9227..de896d48 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -1,5 +1,9 @@ import archinstall +# 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 archinstall.log(f"Minimal only supports:") archinstall.log(f" * Being installed to a single disk") -- cgit v1.2.3-70-g09d2 From 97540293b8fd1e867006d52f07b3817bf491c7cf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 22:06:17 +0200 Subject: Removed some debugging auto-unmount --- examples/minimal.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'examples') diff --git a/examples/minimal.py b/examples/minimal.py index de896d48..90bd9227 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -1,9 +1,5 @@ import archinstall -# 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 archinstall.log(f"Minimal only supports:") archinstall.log(f" * Being installed to a single disk") -- cgit v1.2.3-70-g09d2 From 0370c44ed812961460de48d6e8888f8e868cc7fa Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 22:08:33 +0200 Subject: Enabled skipping partitioning in minimal. It now can take /mnt just as guided as it's destination, and skips partitioning all together. Which makes it go straight to installation. --- examples/minimal.py | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'examples') diff --git a/examples/minimal.py b/examples/minimal.py index 90bd9227..98d9a6f0 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -10,7 +10,6 @@ if archinstall.arguments.get('help', None): 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(mountpoint): # We kick off the installer by telling it where the @@ -37,32 +36,36 @@ def install_on(mountpoint): archinstall.log(f" * root (password: airoot)") archinstall.log(f" * devel (password: devel)") -print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') -archinstall.do_countdown() +if archinstall.arguments['harddrive']: + archinstall.arguments['harddrive'].keep_partitions = False + + 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')) + # 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')) - boot = fs.find_partition('/boot') - root = fs.find_partition('/') + boot = fs.find_partition('/boot') + root = fs.find_partition('/') - boot.format('vfat') + boot.format('vfat') - # 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.encrypted = True - root.encrypt(password=archinstall.arguments.get('!encryption-password', None)) + # 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.encrypted = True + root.encrypt(password=archinstall.arguments.get('!encryption-password', None)) - with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: - unlocked_root.format(root.filesystem) - unlocked_root.mount('/mnt') - else: - root.format(root.filesystem) - root.mount('/mnt') + with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: + unlocked_root.format(root.filesystem) + unlocked_root.mount('/mnt') + else: + root.format(root.filesystem) + root.mount('/mnt') - boot.mount('/mnt/boot') - install_on('/mnt') \ No newline at end of file + boot.mount('/mnt/boot') + +install_on('/mnt') \ No newline at end of file -- 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') 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') 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') 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