Merge PR #714 - Fix empty drives causing issues
* Removed the GPT vs MBR lookup on __enter__ * Removed redundant `boot_partition` lookup during GRUB configuration
This commit is contained in:
commit
c16872531e
|
|
@ -20,12 +20,6 @@ class Filesystem:
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
|
|
||||||
def __enter__(self, *args, **kwargs):
|
def __enter__(self, *args, **kwargs):
|
||||||
# TODO: partition_table_type is hardcoded to GPT at the moment. This has to be changed.
|
|
||||||
if self.mode == self.blockdevice.partition_table_type:
|
|
||||||
log(f'Kept partition format {self.mode} for {self.blockdevice}', level=logging.DEBUG)
|
|
||||||
else:
|
|
||||||
raise DiskError(f'The selected partition table format {self.mode} does not match that of {self.blockdevice}.')
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import shlex
|
||||||
import pathlib
|
import pathlib
|
||||||
import subprocess
|
import subprocess
|
||||||
import glob
|
import glob
|
||||||
from .disk import get_partitions_in_use, Partition, find_partition_by_mountpoint
|
from .disk import get_partitions_in_use, Partition
|
||||||
from .general import SysCommand
|
from .general import SysCommand
|
||||||
from .hardware import has_uefi, is_vm, cpu_vendor
|
from .hardware import has_uefi, is_vm, cpu_vendor
|
||||||
from .locale_helpers import verify_keyboard_layout, verify_x11_keyboard_layout
|
from .locale_helpers import verify_keyboard_layout, verify_x11_keyboard_layout
|
||||||
|
|
@ -174,6 +174,7 @@ class Installer:
|
||||||
mountpoints[partition['mountpoint']] = partition
|
mountpoints[partition['mountpoint']] = partition
|
||||||
|
|
||||||
for mountpoint in sorted(mountpoints.keys()):
|
for mountpoint in sorted(mountpoints.keys()):
|
||||||
|
log(f"Mounting {mountpoint} to {self.target}{mountpoint}", level=logging.INFO)
|
||||||
if mountpoints[mountpoint]['encrypted']:
|
if mountpoints[mountpoint]['encrypted']:
|
||||||
loopdev = storage.get('ENC_IDENTIFIER', 'ai') + 'loop'
|
loopdev = storage.get('ENC_IDENTIFIER', 'ai') + 'loop'
|
||||||
if not (password := mountpoints[mountpoint].get('!password', None)):
|
if not (password := mountpoints[mountpoint].get('!password', None)):
|
||||||
|
|
@ -186,8 +187,10 @@ class Installer:
|
||||||
mountpoints[mountpoint]['device_instance'].mount(f"{self.target}{mountpoint}")
|
mountpoints[mountpoint]['device_instance'].mount(f"{self.target}{mountpoint}")
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if not get_mount_info(f"{self.target}{mountpoint}", traverse=False):
|
try:
|
||||||
raise DiskError(f"Target {self.target}{mountpoint} never got mounted properly.")
|
get_mount_info(f"{self.target}{mountpoint}", traverse=False)
|
||||||
|
except DiskError:
|
||||||
|
raise DiskError(f"Target {self.target}{mountpoint} never got mounted properly (unable to get mount information using findmnt).")
|
||||||
|
|
||||||
if (subvolumes := mountpoints[mountpoint].get('btrfs', {}).get('subvolumes', {})):
|
if (subvolumes := mountpoints[mountpoint].get('btrfs', {}).get('subvolumes', {})):
|
||||||
for name, location in subvolumes.items():
|
for name, location in subvolumes.items():
|
||||||
|
|
@ -619,7 +622,6 @@ class Installer:
|
||||||
self.helper_flags['bootloader'] = True
|
self.helper_flags['bootloader'] = True
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
boot_partition = find_partition_by_mountpoint(self.partitions, relative_mountpoint=f"/boot")
|
|
||||||
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc --recheck {boot_partition.path}')
|
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc --recheck {boot_partition.path}')
|
||||||
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-mkconfig -o /boot/grub/grub.cfg')
|
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-mkconfig -o /boot/grub/grub.cfg')
|
||||||
self.helper_flags['bootloader'] = True
|
self.helper_flags['bootloader'] = True
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue