Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-10-30 17:50:24 +0200
committerAnton Hvornum <anton@hvornum.se>2021-10-30 17:50:24 +0200
commit29a9fbddb27b00c98eae24782c5bec231e862f5c (patch)
tree31fd4fd8b56187ad0896e6a65dc7b65c77113520 /archinstall/lib/disk
parentdbebe8cf37c24e7c3bcb51f056c72b033706c033 (diff)
Failed to create directory structure on subvolume create. Only on subvolume mount. This fixes that.
Diffstat (limited to 'archinstall/lib/disk')
-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