mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-02 11:55:36 -04:00
Merge pull request #1560 from gportay/partition-mount-make-mountPoint-and-filesystem-optionals
[partition,mount] Make mountPoint and filesystem optionals
This commit is contained in:
commit
2516f18d1b
4 changed files with 36 additions and 51 deletions
|
@ -7,6 +7,7 @@
|
||||||
# SPDX-FileCopyrightText: 2017 Alf Gaida <agaida@siduction.org>
|
# SPDX-FileCopyrightText: 2017 Alf Gaida <agaida@siduction.org>
|
||||||
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
||||||
# SPDX-FileCopyrightText: 2019 Kevin Kofler <kevin.kofler@chello.at>
|
# SPDX-FileCopyrightText: 2019 Kevin Kofler <kevin.kofler@chello.at>
|
||||||
|
# SPDX-FileCopyrightText: 2019-2020 Collabora Ltd
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
#
|
#
|
||||||
# Calamares is Free Software: see the License-Identifier above.
|
# Calamares is Free Software: see the License-Identifier above.
|
||||||
|
@ -38,6 +39,9 @@ def mount_partition(root_mount_point, partition, partitions):
|
||||||
# Create mount point with `+` rather than `os.path.join()` because
|
# Create mount point with `+` rather than `os.path.join()` because
|
||||||
# `partition["mountPoint"]` starts with a '/'.
|
# `partition["mountPoint"]` starts with a '/'.
|
||||||
raw_mount_point = partition["mountPoint"]
|
raw_mount_point = partition["mountPoint"]
|
||||||
|
if not raw_mount_point:
|
||||||
|
return
|
||||||
|
|
||||||
mount_point = root_mount_point + raw_mount_point
|
mount_point = root_mount_point + raw_mount_point
|
||||||
|
|
||||||
# Ensure that the created directory has the correct SELinux context on
|
# Ensure that the created directory has the correct SELinux context on
|
||||||
|
@ -52,26 +56,22 @@ def mount_partition(root_mount_point, partition, partitions):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
fstype = partition.get("fs", "").lower()
|
fstype = partition.get("fs", "").lower()
|
||||||
|
if not fstype or fstype == "unformatted":
|
||||||
|
return
|
||||||
|
|
||||||
if fstype == "fat16" or fstype == "fat32":
|
if fstype == "fat16" or fstype == "fat32":
|
||||||
fstype = "vfat"
|
fstype = "vfat"
|
||||||
|
|
||||||
if "luksMapperName" in partition:
|
device = partition["device"]
|
||||||
libcalamares.utils.debug(
|
|
||||||
"about to mount {!s}".format(partition["luksMapperName"]))
|
|
||||||
libcalamares.utils.mount(
|
|
||||||
"/dev/mapper/{!s}".format(partition["luksMapperName"]),
|
|
||||||
mount_point,
|
|
||||||
fstype,
|
|
||||||
partition.get("options", ""),
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
if "luksMapperName" in partition:
|
||||||
libcalamares.utils.mount(partition["device"],
|
device = os.path.join("/dev/mapper", partition["luksMapperName"])
|
||||||
mount_point,
|
|
||||||
fstype,
|
if libcalamares.utils.mount(device,
|
||||||
partition.get("options", ""),
|
mount_point,
|
||||||
)
|
fstype,
|
||||||
|
partition.get("options", "")) != 0:
|
||||||
|
libcalamares.utils.warning("Cannot mount {}".format(device))
|
||||||
|
|
||||||
# If the root partition is btrfs, we create a subvolume "@"
|
# If the root partition is btrfs, we create a subvolume "@"
|
||||||
# for the root mount point.
|
# for the root mount point.
|
||||||
|
@ -96,37 +96,23 @@ def mount_partition(root_mount_point, partition, partitions):
|
||||||
|
|
||||||
subprocess.check_call(["umount", "-v", root_mount_point])
|
subprocess.check_call(["umount", "-v", root_mount_point])
|
||||||
|
|
||||||
|
device = partition["device"]
|
||||||
|
|
||||||
if "luksMapperName" in partition:
|
if "luksMapperName" in partition:
|
||||||
libcalamares.utils.mount(
|
device = os.path.join("/dev/mapper", partition["luksMapperName"])
|
||||||
"/dev/mapper/{!s}".format(partition["luksMapperName"]),
|
|
||||||
mount_point,
|
if libcalamares.utils.mount(device,
|
||||||
fstype,
|
mount_point,
|
||||||
",".join(
|
fstype,
|
||||||
["subvol=@", partition.get("options", "")]),
|
",".join(["subvol=@", partition.get("options", "")])) != 0:
|
||||||
)
|
libcalamares.utils.warning("Cannot mount {}".format(device))
|
||||||
if not has_home_mount_point:
|
|
||||||
libcalamares.utils.mount(
|
if not has_home_mount_point:
|
||||||
"/dev/mapper/{!s}".format(partition["luksMapperName"]),
|
if libcalamares.utils.mount(device,
|
||||||
root_mount_point + "/home",
|
root_mount_point + "/home",
|
||||||
fstype,
|
fstype,
|
||||||
",".join(
|
",".join(["subvol=@home", partition.get("options", "")])) != 0:
|
||||||
["subvol=@home", partition.get("options", "")]),
|
libcalamares.utils.warning("Cannot mount {}".format(device))
|
||||||
)
|
|
||||||
else:
|
|
||||||
libcalamares.utils.mount(
|
|
||||||
partition["device"],
|
|
||||||
mount_point,
|
|
||||||
fstype,
|
|
||||||
",".join(["subvol=@", partition.get("options", "")]),
|
|
||||||
)
|
|
||||||
if not has_home_mount_point:
|
|
||||||
libcalamares.utils.mount(
|
|
||||||
partition["device"],
|
|
||||||
root_mount_point + "/home",
|
|
||||||
fstype,
|
|
||||||
",".join(
|
|
||||||
["subvol=@home", partition.get("options", "")]),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|
|
@ -103,8 +103,7 @@ PartitionLayout::init( FileSystem::Type defaultFsType, const QVariantList& confi
|
||||||
{
|
{
|
||||||
QVariantMap pentry = r.toMap();
|
QVariantMap pentry = r.toMap();
|
||||||
|
|
||||||
if ( !pentry.contains( "name" ) || !pentry.contains( "mountPoint" ) || !pentry.contains( "filesystem" )
|
if ( !pentry.contains( "name" ) || !pentry.contains( "size" ) )
|
||||||
|| !pentry.contains( "size" ) )
|
|
||||||
{
|
{
|
||||||
cError() << "Partition layout entry #" << config.indexOf( r )
|
cError() << "Partition layout entry #" << config.indexOf( r )
|
||||||
<< "lacks mandatory attributes, switching to default layout.";
|
<< "lacks mandatory attributes, switching to default layout.";
|
||||||
|
@ -117,7 +116,7 @@ PartitionLayout::init( FileSystem::Type defaultFsType, const QVariantList& confi
|
||||||
CalamaresUtils::getString( pentry, "type" ),
|
CalamaresUtils::getString( pentry, "type" ),
|
||||||
CalamaresUtils::getUnsignedInteger( pentry, "attributes", 0 ),
|
CalamaresUtils::getUnsignedInteger( pentry, "attributes", 0 ),
|
||||||
CalamaresUtils::getString( pentry, "mountPoint" ),
|
CalamaresUtils::getString( pentry, "mountPoint" ),
|
||||||
CalamaresUtils::getString( pentry, "filesystem" ),
|
CalamaresUtils::getString( pentry, "filesystem", "unformatted" ),
|
||||||
CalamaresUtils::getSubMap( pentry, "features", ok ),
|
CalamaresUtils::getSubMap( pentry, "features", ok ),
|
||||||
CalamaresUtils::getString( pentry, "size", QStringLiteral( "0" ) ),
|
CalamaresUtils::getString( pentry, "size", QStringLiteral( "0" ) ),
|
||||||
CalamaresUtils::getString( pentry, "minSize", QStringLiteral( "0" ) ),
|
CalamaresUtils::getString( pentry, "minSize", QStringLiteral( "0" ) ),
|
||||||
|
|
|
@ -153,7 +153,7 @@ FillGlobalStorageJob::prettyDescription() const
|
||||||
QString path = partitionMap.value( "device" ).toString();
|
QString path = partitionMap.value( "device" ).toString();
|
||||||
QString mountPoint = partitionMap.value( "mountPoint" ).toString();
|
QString mountPoint = partitionMap.value( "mountPoint" ).toString();
|
||||||
QString fsType = partitionMap.value( "fs" ).toString();
|
QString fsType = partitionMap.value( "fs" ).toString();
|
||||||
if ( mountPoint.isEmpty() || fsType.isEmpty() )
|
if ( mountPoint.isEmpty() || fsType.isEmpty() || fsType == QString( "unformatted" ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,8 +207,8 @@ defaultFileSystemType: "ext4"
|
||||||
# - uuid: partition uuid (optional parameter; gpt only; requires KPMCore >= 4.2.0)
|
# - uuid: partition uuid (optional parameter; gpt only; requires KPMCore >= 4.2.0)
|
||||||
# - type: partition type (optional parameter; gpt only; requires KPMCore >= 4.2.0)
|
# - type: partition type (optional parameter; gpt only; requires KPMCore >= 4.2.0)
|
||||||
# - attributes: partition attributes (optional parameter; gpt only; requires KPMCore >= 4.2.0)
|
# - attributes: partition attributes (optional parameter; gpt only; requires KPMCore >= 4.2.0)
|
||||||
# - filesystem: filesystem type
|
# - filesystem: filesystem type (optional parameter; fs not created if "unformatted" or unset)
|
||||||
# - mountPoint: partition mount point
|
# - mountPoint: partition mount point (optional parameter; not mounted if unset)
|
||||||
# - size: partition size in bytes (append 'K', 'M' or 'G' for KiB, MiB or GiB)
|
# - size: partition size in bytes (append 'K', 'M' or 'G' for KiB, MiB or GiB)
|
||||||
# or
|
# or
|
||||||
# % of the available drive space if a '%' is appended to the value
|
# % of the available drive space if a '%' is appended to the value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue