Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/disk/btrfs.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/archinstall/lib/disk/btrfs.py b/archinstall/lib/disk/btrfs.py
index eaa73af8..ff0b7b58 100644
--- a/archinstall/lib/disk/btrfs.py
+++ b/archinstall/lib/disk/btrfs.py
@@ -24,8 +24,8 @@ def mount_subvolume(installation, subvolume_location :Union[pathlib.Path, str],
target = installation_mountpoint / subvolume_location.relative_to(subvolume_location.anchor)
- if not (target).exists():
- (target).mkdir(parents=True)
+ if not target.exists():
+ target.mkdir(parents=True)
if glob.glob(str(target/'*')) and force is False:
raise DiskError(f"Cannot mount subvolume to {target} because it contains data (non-empty folder target)")
@@ -39,13 +39,26 @@ def mount_subvolume(installation, subvolume_location :Union[pathlib.Path, str],
return SysCommand(f"mount {mount_information['source']} {target} -o subvol=@{subvolume_location}").exit_code == 0
-def create_subvolume(installation, location :Union[pathlib.Path, str]) -> bool:
+def create_subvolume(installation, subvolume_location :Union[pathlib.Path, str]) -> bool:
"""
This function uses btrfs to create a subvolume.
@installation: archinstall.Installer instance
- @location: a localized string or path inside the installation / or /boot for instance without specifying /mnt/boot
+ @subvolume_location: a localized string or path inside the installation / or /boot for instance without specifying /mnt/boot
"""
- log(f"Creating a subvolume on {installation.target}/{str(location)}", level=logging.INFO)
- if (cmd := SysCommand(f"btrfs subvolume create {installation.target}/{str(location)}")).exit_code != 0:
- raise DiskError(f"Could not create a subvolume at {installation.target}/{str(location)}: {cmd}") \ No newline at end of file
+
+ installation_mountpoint = installation.target
+ if type(installation_mountpoint) == str:
+ installation_mountpoint = pathlib.Path(installation_mountpoint)
+ # Set up the required physical structure
+ if type(subvolume_location) == str:
+ subvolume_location = pathlib.Path(subvolume_location)
+
+ target = installation_mountpoint / subvolume_location.relative_to(subvolume_location.anchor)
+
+ if not target.exists():
+ target.mkdir(parents=True)
+
+ log(f"Creating a subvolume on {target}", level=logging.INFO)
+ if (cmd := SysCommand(f"btrfs subvolume create {target}")).exit_code != 0:
+ raise DiskError(f"Could not create a subvolume at {target}: {cmd}") \ No newline at end of file