Merge pull request #1219 from a-wai/extra-mounts-after-root

mount: Make sure extra mounts are mounted right after /
main
Adriaan de Groot 6 years ago committed by GitHub
commit 8aedd8b175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,17 +37,7 @@ _ = gettext.translation("calamares-python",
def pretty_name():
return _("Mounting partitions.")
def mount_partitions(root_mount_point, partitions):
"""
Pass back mount point and filesystem for each partition.
:param root_mount_point:
:param partitions:
"""
for partition in partitions:
if "mountPoint" not in partition or not partition["mountPoint"]:
continue
def mount_partition(root_mount_point, partition, partitions):
# Create mount point with `+` rather than `os.path.join()` because
# `partition["mountPoint"]` starts with a '/'.
raw_mount_point = partition["mountPoint"]
@ -158,17 +148,21 @@ def run():
if not extra_mounts and not extra_mounts_efi:
libcalamares.utils.warning("No extra mounts defined. Does mount.conf exist?")
# Sort by mount points to ensure / is mounted before the rest
partitions.sort(key=lambda x: x["mountPoint"])
mount_partitions(root_mount_point, partitions)
mount_partitions(root_mount_point, extra_mounts)
all_extra_mounts = extra_mounts
if libcalamares.globalstorage.value("firmwareType") == "efi":
mount_partitions(root_mount_point, extra_mounts_efi)
all_extra_mounts.extend(extra_mounts_efi)
extra_mounts.extend(extra_mounts_efi)
# Add extra mounts to the partitions list and sort by mount points.
# This way, we ensure / is mounted before the rest, and every mount point
# is created on the right partition (e.g. if a partition is to be mounted
# under /tmp, we make sure /tmp is mounted before the partition)
partitions.extend(extra_mounts)
partitions.sort(key=lambda x: x["mountPoint"])
for partition in partitions:
if "mountPoint" not in partition or not partition["mountPoint"]:
continue
mount_partition(root_mount_point, partition, partitions)
libcalamares.globalstorage.insert("rootMountPoint", root_mount_point)
# Remember the extra mounts for the unpackfs module
libcalamares.globalstorage.insert("extraMounts", all_extra_mounts)
libcalamares.globalstorage.insert("extraMounts", extra_mounts)

Loading…
Cancel
Save