feat: fix FDE on UEFI systems

This commit is contained in:
Rudra Saraswat 2024-06-08 19:34:48 +00:00
parent 296d8886c5
commit 29cfb63d20

View file

@ -115,9 +115,6 @@ def format_and_mount(config, mountpoint, filesystem, blockdevice):
if mountpoint == 'System': if mountpoint == 'System':
mountpoint = '/mnt/' mountpoint = '/mnt/'
elif mountpoint == 'Boot': elif mountpoint == 'Boot':
if efi:
mountpoint = '/mnt/boot/efi/'
else:
mountpoint = '/mnt/boot/' mountpoint = '/mnt/boot/'
elif mountpoint == 'User': elif mountpoint == 'User':
mountpoint = '/mnt/home/' mountpoint = '/mnt/home/'
@ -158,11 +155,11 @@ def inst_partition(config):
exec(['parted', '-s', device, 'mklabel', 'msdos']) exec(['parted', '-s', device, 'mklabel', 'msdos'])
# Create boot partition # Create boot partition
exec(['parted', '-s', device, 'mkpart', exec(['parted', '-s', device, 'mkpart',
'primary', 'ext4', '1MIB', '600MIB']) 'primary', 'ext4', '1MIB', '1400MIB'])
# Create root partition # Create root partition
exec(['parted', '-s', device, 'mkpart', exec(['parted', '-s', device, 'mkpart',
'primary', 'ext4', '700MB', '100%']) 'primary', 'ext4', '1500MB', '100%'])
global orig_main_partition global orig_main_partition
@ -182,10 +179,6 @@ def inst_partition(config):
exec(['mkfs.ext4', '-F', root_partition]) exec(['mkfs.ext4', '-F', root_partition])
# Mount partitions # Mount partitions
mount(root_partition, '/mnt') mount(root_partition, '/mnt')
if efi:
mkdir('/mnt/boot/efi')
mount(f'{device}p1', '/mnt/boot/efi')
else:
mkdir('/mnt/boot') mkdir('/mnt/boot')
mount(f'{device}p1', '/mnt/boot') mount(f'{device}p1', '/mnt/boot')
else: else:
@ -204,10 +197,6 @@ def inst_partition(config):
exec(['mkfs.ext4', '-F', root_partition]) exec(['mkfs.ext4', '-F', root_partition])
# Mount partitions # Mount partitions
mount(root_partition, '/mnt') mount(root_partition, '/mnt')
if efi:
mkdir('/mnt/boot/efi')
mount(f'{device}1', '/mnt/boot/efi')
else:
mkdir('/mnt/boot') mkdir('/mnt/boot')
mount(f'{device}1', '/mnt/boot') mount(f'{device}1', '/mnt/boot')
else: else:
@ -222,7 +211,7 @@ def inst_partition(config):
print( print(
"Invalid manual partitioning configuration. There must be a 'System' partition.") "Invalid manual partitioning configuration. There must be a 'System' partition.")
sys.exit(1) sys.exit(1)
if '/mnt/boot/' not in mountpoints and '/mnt/boot/efi/' not in mountpoints: if '/mnt/boot/' not in mountpoints:
print() print()
print( print(
"Invalid manual partitioning configuration. There must be a 'Boot' partition.") "Invalid manual partitioning configuration. There must be a 'Boot' partition.")
@ -293,9 +282,9 @@ def inst_bootloader(config):
exec_chroot( exec_chroot(
['bash', '-c', 'echo -e \'\\nGRUB_TIMEOUT=3\' >> /etc/default/grub']) ['bash', '-c', 'echo -e \'\\nGRUB_TIMEOUT=3\' >> /etc/default/grub'])
if config['bootloader']['type'] == 'grub-efi': if config['bootloader']['type'] == 'grub-efi':
exec_chroot(['grub-install', '--target=x86_64-efi', f'--efi-directory={config["bootloader"]["location"]}', exec_chroot(['grub-install', '--target=x86_64-efi', f'--efi-directory=/boot',
'--bootloader-id=blend', '--removable']) '--bootloader-id=blend', '--removable'])
exec_chroot(['grub-install', '--target=x86_64-efi', f'--efi-directory={config["bootloader"]["location"]}', exec_chroot(['grub-install', '--target=x86_64-efi', f'--efi-directory=/boot',
'--bootloader-id=blend']) '--bootloader-id=blend'])
else: else:
exec_chroot(['grub-install', '--target=i386-pc', exec_chroot(['grub-install', '--target=i386-pc',