index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2021-10-30 17:55:16 +0200 |
---|---|---|
committer | Anton Hvornum <anton@hvornum.se> | 2021-10-30 17:55:16 +0200 |
commit | 522ca2e41c566b73b9dde291252b047842c718a1 (patch) | |
tree | f5d6906aabcb14adadf3b2e8ea99d87fc7b42d03 | |
parent | 29a9fbddb27b00c98eae24782c5bec231e862f5c (diff) |
-rw-r--r-- | archinstall/lib/disk/btrfs.py | 13 |
diff --git a/archinstall/lib/disk/btrfs.py b/archinstall/lib/disk/btrfs.py index ff0b7b58..6fafab34 100644 --- a/archinstall/lib/disk/btrfs.py +++ b/archinstall/lib/disk/btrfs.py @@ -56,8 +56,17 @@ def create_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) + # Difference from mount_subvolume: + # We only check if the parent exists, since we'll run in to "target path already exists" otherwise + if not target.parent.exists(): + target.parent.mkdir(parents=True) + + if glob.glob(str(target/'*')) and force is False: + raise DiskError(f"Cannot create subvolume at {target} because it contains data (non-empty folder target)") + + # Remove the target if it exists + if target.exists(): + target.rmdir() log(f"Creating a subvolume on {target}", level=logging.INFO) if (cmd := SysCommand(f"btrfs subvolume create {target}")).exit_code != 0: |