From 8a545941d484ea29b6e44b604477473293c79892 Mon Sep 17 00:00:00 2001 From: apt-ghetto Date: Mon, 29 Jul 2019 16:01:30 +0200 Subject: [PATCH 1/2] Remove flake8 errors Remove the flake8 errors. This commit does not change any behaviour. --- src/modules/fstab/main.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py index abbd3d524..f793c9b7f 100644 --- a/src/modules/fstab/main.py +++ b/src/modules/fstab/main.py @@ -162,7 +162,6 @@ class FstabGenerator(object): return None mapper_name = partition["luksMapperName"] - mount_point = partition["mountPoint"] luks_uuid = partition["luksUuid"] if not mapper_name or not luks_uuid: return None @@ -266,12 +265,12 @@ class FstabGenerator(object): self.root_is_ssd = is_ssd if filesystem == "btrfs" and "subvol" in partition: - options="subvol={},".format(partition["subvol"]) + options + options = "subvol={},".format(partition["subvol"]) + options if has_luks: - device="/dev/mapper/" + partition["luksMapperName"] + device = "/dev/mapper/" + partition["luksMapperName"] else: - device="UUID=" + partition["uuid"] + device = "UUID=" + partition["uuid"] return dict(device=device, mount_point=mount_point, @@ -308,13 +307,17 @@ def run(): root_mount_point = global_storage.value("rootMountPoint") if not partitions: - libcalamares.utils.warning("partitions is empty, {!s}".format(partitions)) + libcalamares.utils.warning("partitions is empty, {!s}" + .format(partitions)) return (_("Configuration Error"), - _("No partitions are defined for
{!s}
to use." ).format("fstab")) + _("No partitions are defined for
{!s}
to use.") + .format("fstab")) if not root_mount_point: - libcalamares.utils.warning("rootMountPoint is empty, {!s}".format(root_mount_point)) + libcalamares.utils.warning("rootMountPoint is empty, {!s}" + .format(root_mount_point)) return (_("Configuration Error"), - _("No root mount point is given for
{!s}
to use." ).format("fstab")) + _("No root mount point is given for
{!s}
to use.") + .format("fstab")) mount_options = conf["mountOptions"] ssd_extra_mount_options = conf.get("ssdExtraMountOptions", {}) From 0f5ff9a5174499e42a547a7f7813d508cfbcd05a Mon Sep 17 00:00:00 2001 From: apt-ghetto Date: Mon, 29 Jul 2019 16:06:52 +0200 Subject: [PATCH 2/2] Add possibility to set mount options for the ESP Added new configuration "efiMountOptions" to fstab.conf When generating the fstab entry for the ESP, take the mount options from the new configuration or fall back to "mountOptions". --- src/modules/fstab/fstab.conf | 5 +++++ src/modules/fstab/main.py | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/modules/fstab/fstab.conf b/src/modules/fstab/fstab.conf index 11adff2ed..06a935e3a 100644 --- a/src/modules/fstab/fstab.conf +++ b/src/modules/fstab/fstab.conf @@ -12,6 +12,11 @@ mountOptions: default: defaults,noatime btrfs: defaults,noatime,space_cache,autodefrag +# Mount options to use for the EFI System Partition. If not defined, it +# takes either the value of *vfat*, or if also missing, *default* from +# *mountOptions* +efiMountOptions: umask=0077 + # If a filesystem is on an SSD, add the following options. If a specific # filesystem is listed here, use those options, otherwise no additional # options are set (i.e. there is no *default* like in *mountOptions*). diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py index f793c9b7f..4a696f46b 100644 --- a/src/modules/fstab/main.py +++ b/src/modules/fstab/main.py @@ -246,8 +246,8 @@ class FstabGenerator(object): if not mount_point: mount_point = "swap" - options = self.mount_options.get(filesystem, - self.mount_options["default"]) + options = self.get_mount_options(filesystem, mount_point) + if is_ssd: extra = self.ssd_extra_mount_options.get(filesystem) @@ -295,6 +295,16 @@ class FstabGenerator(object): if partition["mountPoint"]: mkdir_p(self.root_mount_point + partition["mountPoint"]) + def get_mount_options(self, filesystem, mount_point): + efiMountPoint = libcalamares.globalstorage.value("efiSystemPartition") + job_config = libcalamares.job.configuration + + if (mount_point == efiMountPoint and "efiMountOptions" in job_config): + return job_config["efiMountOptions"] + + return self.mount_options.get(filesystem, + self.mount_options["default"]) + def run(): """ Configures fstab.