From 7f9b7991e902489efb3501a98a7d6998ca15a0a5 Mon Sep 17 00:00:00 2001 From: Werner Llácer Date: Fri, 31 Dec 2021 13:47:41 +0100 Subject: Btrfs2 (#787) * All the changes needed to make btrfs subvolumes work. It boils down to two points; the handling of the addressing of subvolumes re. physical partitions, and the small changes at the bootloader level * We added a new script only_hd for testing purposes. It only handles hadrd drive management * restoring an escape hatch during subvolume processing * hipercommented manage_btrfs_subvolumes * Ready to be able to select and process options in subvolume mounting * Separte nodatacow processing * Solving a flake8 complain * Use of bind names @ get_filesystem_type * compress mount option bypass * Preparations for encryption handling * Compatibility to master version re. encrypted btrfs volumes * Now we can create subvolumes and mountpoints inside an encrypted btrfs partition * changes for entries file generation with systemd-bootctl * flake8 corrections plus some comments Co-authored-by: Anton Hvornum --- archinstall/lib/disk/filesystem.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'archinstall/lib/disk/filesystem.py') diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py index 72be7e70..51ef949b 100644 --- a/archinstall/lib/disk/filesystem.py +++ b/archinstall/lib/disk/filesystem.py @@ -37,10 +37,10 @@ class Filesystem: for i in range(storage['DISK_RETRY_ATTEMPTS']): self.partprobe() time.sleep(5) - + # TODO: Convert to blkid (or something similar, but blkid doesn't support traversing to list sub-PARTUUIDs based on blockdevice path?) output = json.loads(SysCommand(f"lsblk --json -o+PARTUUID {self.blockdevice.device}").decode('UTF-8')) - + for device in output['blockdevices']: for index, partition in enumerate(device['children']): if (partuuid := partition.get('partuuid', None)) and partuuid.lower() == uuid: @@ -93,8 +93,12 @@ class Filesystem: storage['arguments']['!encryption-password'] = get_password(f"Enter a encryption password for {partition['device_instance']}") partition['!password'] = storage['arguments']['!encryption-password'] - - loopdev = f"{storage.get('ENC_IDENTIFIER', 'ai')}{pathlib.Path(partition['mountpoint']).name}loop" + # to be able to generate an unique name in case the partition will not be mounted + if partition.get('mountpoint',None): + ppath = partition['mountpoint'] + else: + ppath = partition['device_instance'].path + loopdev = f"{storage.get('ENC_IDENTIFIER', 'ai')}{pathlib.Path(ppath).name}loop" partition['device_instance'].encrypt(password=partition['!password']) @@ -207,9 +211,9 @@ class Filesystem: SysCommand(f'bash -c "umount {device}?"') except: pass - + self.partprobe() worked = self.raw_parted(f'{device} mklabel {disk_label}').exit_code == 0 self.partprobe() - + return worked -- cgit v1.2.3-54-g00ecf