|
|
|
@ -29,6 +29,24 @@ _ = gettext.translation("calamares-python",
|
|
|
|
|
def pretty_name():
|
|
|
|
|
return _("Mounting partitions.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_btrfs_subvolumes():
|
|
|
|
|
"""
|
|
|
|
|
Gets the job-configuration for btrfs subvolumes, or if there is
|
|
|
|
|
none given, returns a default configuration that matches
|
|
|
|
|
the setup (/ and /home) from before configurability was introduced.
|
|
|
|
|
"""
|
|
|
|
|
btrfs_subvolumes = libcalamares.job.configuration.get("btrfsSubvolumes", None)
|
|
|
|
|
# Warn if there's no configuration at all, and empty configurations are
|
|
|
|
|
# replaced by a simple root-only layout.
|
|
|
|
|
if btrfs_subvolumes is None:
|
|
|
|
|
libcalamares.utils.warning("No configuration for btrfsSubvolumes")
|
|
|
|
|
if not btrfs_subvolumes:
|
|
|
|
|
btrfs_subvolumes = [ dict(mountPoint="/", subvolume="/@") ]
|
|
|
|
|
|
|
|
|
|
return btrfs_subvolumes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def mount_partition(root_mount_point, partition, partitions):
|
|
|
|
|
"""
|
|
|
|
|
Do a single mount of @p partition inside @p root_mount_point.
|
|
|
|
@ -74,13 +92,7 @@ def mount_partition(root_mount_point, partition, partitions):
|
|
|
|
|
# Special handling for btrfs subvolumes. Create the subvolumes listed in mount.conf
|
|
|
|
|
if fstype == "btrfs" and partition["mountPoint"] == '/':
|
|
|
|
|
# Root has been mounted to btrfs volume -> create subvolumes from configuration
|
|
|
|
|
btrfs_subvolumes = libcalamares.job.configuration.get("btrfsSubvolumes", None)
|
|
|
|
|
# Warn if there's no configuration at all, and empty configurations are
|
|
|
|
|
# replaced by a simple root-only layout.
|
|
|
|
|
if btrfs_subvolumes is None:
|
|
|
|
|
libcalamares.utils.warning("No configuration for btrfsSubvolumes")
|
|
|
|
|
if not btrfs_subvolumes:
|
|
|
|
|
btrfs_subvolumes = [ dict(mountPoint="/", subvolume="/@") ]
|
|
|
|
|
btrfs_subvolumes = get_btrfs_subvolumes()
|
|
|
|
|
|
|
|
|
|
subvolume_mountpoints = [d['mountPoint'] for d in btrfs_subvolumes]
|
|
|
|
|
# Check if listed mountpoints besides / are already present and don't create subvolume for those
|
|
|
|
|