[mount] Print a warning if mount failure

The return of the call to libcalamares.utils.mount is never tested and
it may fail silently; this causes some mounpoints to be missing.

This adds a warning if mountpoint cannot be mounted.

	chcon: failed to get security context of '/tmp/verity': Operation not supported
	06:44:23 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
	    Running "env" ("mount", "-t", "unformatted", "/dev/sdb2", "/tmp/calamares-root-kv8dqgb5/tmp/verity")
	    ..  Finished. Exit code: 32
	    ..  Target cmd: ("mount", "-t", "unformatted", "/dev/sdb7", "/tmp/calamares-root-kv8dqgb5/tmp/verity") output:
	 mount: /tmp/calamares-root-kv8dqgb5/tmp/verity: unknown filesystem type 'unformatted'.
This commit is contained in:
Gaël PORTAY 2020-10-31 04:44:49 -04:00
parent 1f9f506a16
commit 54fd1f4b26

View File

@ -7,6 +7,7 @@
# SPDX-FileCopyrightText: 2017 Alf Gaida <agaida@siduction.org>
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
# SPDX-FileCopyrightText: 2019 Kevin Kofler <kevin.kofler@chello.at>
# SPDX-FileCopyrightText: 2019-2020 Collabora Ltd
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Calamares is Free Software: see the License-Identifier above.
@ -56,22 +57,16 @@ def mount_partition(root_mount_point, partition, partitions):
if fstype == "fat16" or fstype == "fat32":
fstype = "vfat"
if "luksMapperName" in partition:
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", ""),
)
device = partition["device"]
else:
libcalamares.utils.mount(partition["device"],
mount_point,
fstype,
partition.get("options", ""),
)
if "luksMapperName" in partition:
device = os.path.join("/dev/mapper", partition["luksMapperName"])
if libcalamares.utils.mount(device,
mount_point,
fstype,
partition.get("options", "")) != 0:
libcalamares.utils.warning("Cannot mount {}".format(device))
# If the root partition is btrfs, we create a subvolume "@"
# for the root mount point.
@ -96,37 +91,23 @@ def mount_partition(root_mount_point, partition, partitions):
subprocess.check_call(["umount", "-v", root_mount_point])
device = partition["device"]
if "luksMapperName" in partition:
libcalamares.utils.mount(
"/dev/mapper/{!s}".format(partition["luksMapperName"]),
mount_point,
fstype,
",".join(
["subvol=@", partition.get("options", "")]),
)
if not has_home_mount_point:
libcalamares.utils.mount(
"/dev/mapper/{!s}".format(partition["luksMapperName"]),
root_mount_point + "/home",
fstype,
",".join(
["subvol=@home", partition.get("options", "")]),
)
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", "")]),
)
device = os.path.join("/dev/mapper", partition["luksMapperName"])
if libcalamares.utils.mount(device,
mount_point,
fstype,
",".join(["subvol=@", partition.get("options", "")])) != 0:
libcalamares.utils.warning("Cannot mount {}".format(device))
if not has_home_mount_point:
if libcalamares.utils.mount(device,
root_mount_point + "/home",
fstype,
",".join(["subvol=@home", partition.get("options", "")])) != 0:
libcalamares.utils.warning("Cannot mount {}".format(device))
def run():