From 9b57f402da97aada820054a168c144e17fd6d767 Mon Sep 17 00:00:00 2001 From: Shrinivas Vishnu Kumbhar Date: Thu, 23 Sep 2021 11:07:43 +0200 Subject: [PATCH 01/32] [keyboard] Use US-English for India --- src/modules/keyboard/Config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp index f1b6efeba..720588810 100644 --- a/src/modules/keyboard/Config.cpp +++ b/src/modules/keyboard/Config.cpp @@ -472,7 +472,7 @@ Config::guessLocaleKeyboardLayout() { "el_GR", "gr" }, /* Greek in Greece */ { "ig_NG", "igbo_NG" }, /* Igbo in Nigeria */ { "ha_NG", "hausa_NG" }, /* Hausa */ - { "en_IN", "eng_in" }, /* India, English with Rupee */ + { "en_IN", "us" }, /* India, US English keyboards are common in India */ } ); // Try to preselect a layout, depending on language and locale From 528a8153072dfb7892089abdb8206779ec5cfc34 Mon Sep 17 00:00:00 2001 From: Shrinivas Vishnu Kumbhar Date: Thu, 23 Sep 2021 11:08:11 +0200 Subject: [PATCH 02/32] [locale] Default to English in India --- CHANGES | 3 +++ src/modules/locale/LocaleConfiguration.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES b/CHANGES index 1bdb681f0..a5a1b1fe1 100644 --- a/CHANGES +++ b/CHANGES @@ -10,12 +10,15 @@ website will have to do for older versions. # 3.2.44 (unreleased) # This release contains contributions from (alphabetically by first name): + - Shrinivas Vishnu Kumbhar (new contributor, welcome!) - whorfin (new contributor, welcome!) ## Core ## - No core changes yet ## Modules ## + - Both *locale* and *keyboard* have received some tweaks for configurations + in India; unless the user selects otherwise, English is preferred. - The *luksbootkeyfile* module was reported to be too quick to declare a timeout when applying the keyfile. The timeout has been increased to one minute. (Thanks whorfin) diff --git a/src/modules/locale/LocaleConfiguration.cpp b/src/modules/locale/LocaleConfiguration.cpp index c208dc02d..b7b895290 100644 --- a/src/modules/locale/LocaleConfiguration.cpp +++ b/src/modules/locale/LocaleConfiguration.cpp @@ -201,6 +201,10 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale, // but nearly all its native speakers also speak English, // and migrants are likely to use English. { "IE", "en" }, + // India has many languages even though Hindi is known as + // national language but English is used in all computer + // and mobile devices. + { "IN", "en" }, { "IT", "it" }, { "MA", "ar" }, { "MK", "mk" }, From 3f890dfb8e51f9f4e9dea55b426c8b574156452f Mon Sep 17 00:00:00 2001 From: librewish Date: Fri, 24 Sep 2021 12:24:58 +0530 Subject: [PATCH 03/32] [fstab] Improve btrfs mount options --- src/modules/fstab/fstab.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/fstab/fstab.conf b/src/modules/fstab/fstab.conf index 21f6ffce3..fdf0d41ec 100644 --- a/src/modules/fstab/fstab.conf +++ b/src/modules/fstab/fstab.conf @@ -13,7 +13,7 @@ # options from this mapping. mountOptions: default: defaults,noatime - btrfs: defaults,noatime,space_cache,autodefrag + btrfs: defaults,noatime,space_cache,autodefrag,compress=zstd # Mount options to use for the EFI System Partition. If not defined, the # *mountOptions* for *vfat* are used, or if that is not set either, @@ -38,10 +38,10 @@ efiMountOptions: umask=0077 # swap: discard # btrfs: discard,compress=lzo # -# The standard configuration applies only lzo compression to btrfs +# The standard configuration applies asynchronous discard support and ssd optimizations to btrfs # and does nothing for other filesystems. ssdExtraMountOptions: - btrfs: compress=lzo + btrfs: discard=async,ssd # Additional options added to each line in /etc/crypttab crypttabOptions: luks From e5e9e14a9f053de20eed42c3baf74c823526bfd5 Mon Sep 17 00:00:00 2001 From: librewish Date: Fri, 24 Sep 2021 12:30:42 +0530 Subject: [PATCH 04/32] [initcpiocfg] add consolefont to hooks --- src/modules/initcpiocfg/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 903ef635f..ba43984d2 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -144,7 +144,7 @@ def find_initcpio_features(partitions, root_mount_point): :return 3-tuple of lists """ - hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard", "keymap"] + hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard", "keymap", "consolefont"] modules = [] files = [] From 678e6f6d7444d116e3224fdaa4c63ee2f7ab81f4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 24 Sep 2021 12:15:16 +0200 Subject: [PATCH 05/32] [networkcfg] Be more forgiving when getting the live username - This function is intended to do whatever it takes to get the live username. --- src/modules/networkcfg/main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/modules/networkcfg/main.py b/src/modules/networkcfg/main.py index 35bf67d63..75b5a3abe 100644 --- a/src/modules/networkcfg/main.py +++ b/src/modules/networkcfg/main.py @@ -29,6 +29,34 @@ def pretty_name(): return _("Saving network configuration.") +def live_user(): + """ + Gets the "live user" login. This might be "live", or "nitrux", + or something similar: it is the login name used *right now*, + and network configurations saved for that user, should be applied + also for the installed user (which probably has a different name). + """ + # getlogin() is a thin-wrapper, and depends on getlogin(3), + # which reads utmp -- and utmp isn't always set up right. + try: + return os.getlogin() + except OSError: + pass + # getpass will return the **current** user, which is generally root. + # That isn't very useful, because the network settings have been + # made outside of Calamares-running-as-root, as a different user. + # + # If Calamares is running as non-root, though, this is fine. + import getpass + name = getpass.getuser() + if name != "root": + return name + + # TODO: other mechanisms, e.g. guessing that "live" is the name + # TODO: support a what-is-the-live-user setting + return None + + def run(): """ Setup network configuration From bf60d0576b5796f4646ea817253ecf5b38bf5819 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 24 Sep 2021 12:25:33 +0200 Subject: [PATCH 06/32] [networkcfg] Refactor username-replacement Read, then write, the NM file. Add a note about how we might handle this better. Rename live_user() function to give it a verb (and avoid UnboundLocal when using a variable of the same name). --- src/modules/networkcfg/main.py | 43 ++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/modules/networkcfg/main.py b/src/modules/networkcfg/main.py index 75b5a3abe..f2970af24 100644 --- a/src/modules/networkcfg/main.py +++ b/src/modules/networkcfg/main.py @@ -29,7 +29,7 @@ def pretty_name(): return _("Saving network configuration.") -def live_user(): +def get_live_user(): """ Gets the "live user" login. This might be "live", or "nitrux", or something similar: it is the login name used *right now*, @@ -57,13 +57,41 @@ def live_user(): return None +def replace_username(nm_config_filename, live_user, target_user): + """ + If @p live_user isn't None, then go through the given + file and replace @p live_user by the @p target_user. + + Reads the file, then (re-)writes it with new permissions lives. + """ + # FIXME: Perhaps if live_user is None, we should just replace **all** + # permissions lines? After all, this is supposed to be a live + # system so **whatever** NM networks are configured, should be + # available to the new user. + if live_user is None: + return + if not os.path.exists(nm_config_filename): + return + + with open(target_network, "r") as network_conf: + text = network_conf.readlines() + + live_permissions = 'permissions=user:{}:;'.format(live_user) + target_permissions = 'permissions=user:{}:;\n'.format(user) + with open(target_network, "w") as network_conf: + for line in text: + if live_permissions in line: + line = target_permissions + network_conf.write(line) + + def run(): """ Setup network configuration """ root_mount_point = libcalamares.globalstorage.value("rootMountPoint") user = libcalamares.globalstorage.value("username") - live_user = os.getlogin() + live_user = get_live_user() if root_mount_point is None: libcalamares.utils.warning("rootMountPoint is empty, {!s}".format(root_mount_point)) @@ -91,16 +119,7 @@ def run(): try: shutil.copy(source_network, target_network, follow_symlinks=False) - if live_user in open(target_network).read(): - text = [] - with open(target_network, "r") as network_conf: - text = network_conf.readlines() - with open(target_network, "w") as network_conf: - for line in text: - if 'permissions=user:{}:;'.format(live_user) in line: - line = 'permissions=user:{}:;\n'.format(user) - network_conf.write(line) - network_conf.close() + replace_username(target_network, live_user, user) except FileNotFoundError: libcalamares.utils.debug( "Can't copy network configuration files in " From 13d69cb81352e60dc5b4ad34ec99c93f68b5870f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 24 Sep 2021 12:30:11 +0200 Subject: [PATCH 07/32] [networkcfg] Don't mindlessly PEP8 --- src/modules/networkcfg/main.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/modules/networkcfg/main.py b/src/modules/networkcfg/main.py index f2970af24..6dab71fd9 100644 --- a/src/modules/networkcfg/main.py +++ b/src/modules/networkcfg/main.py @@ -98,10 +98,9 @@ def run(): return (_("Configuration Error"), _("No root mount point is given for
{!s}
to use." ).format("networkcfg")) - source_nm = "/etc/NetworkManager/system-connections/" - target_nm = os.path.join( - root_mount_point, "etc/NetworkManager/system-connections/" - ) + nm_connections = "etc/NetworkManager/system-connections/" + source_nm = "/" + nm_connections + target_nm = os.path.join(root_mount_point, nm_connections) # Sanity checks. We don't want to do anything if a network # configuration already exists on the target @@ -122,8 +121,7 @@ def run(): replace_username(target_network, live_user, user) except FileNotFoundError: libcalamares.utils.debug( - "Can't copy network configuration files in " - + "{}".format(source_network) + "Can't copy network configuration files in {}".format(source_network) ) except FileExistsError: pass From ce5d42ce0f1b352f5f7a1215ad82cbf1370f73aa Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 24 Sep 2021 12:33:00 +0200 Subject: [PATCH 08/32] [networkcfg] Refactor getting source-and-target paths of a file --- src/modules/networkcfg/main.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/modules/networkcfg/main.py b/src/modules/networkcfg/main.py index 6dab71fd9..4dc6cbbf7 100644 --- a/src/modules/networkcfg/main.py +++ b/src/modules/networkcfg/main.py @@ -85,6 +85,13 @@ def replace_username(nm_config_filename, live_user, target_user): network_conf.write(line) +def path_pair(root_mount_point, relative_path): + """ + Returns /relative_path and the relative path in the target system. + """ + return ("/" + relative_path, os.path.join(root_mount_point, relative_path)) + + def run(): """ Setup network configuration @@ -98,9 +105,7 @@ def run(): return (_("Configuration Error"), _("No root mount point is given for
{!s}
to use." ).format("networkcfg")) - nm_connections = "etc/NetworkManager/system-connections/" - source_nm = "/" + nm_connections - target_nm = os.path.join(root_mount_point, nm_connections) + source_nm, target_nm = path_pair(root_mount_point, "etc/NetworkManager/system-connections/") # Sanity checks. We don't want to do anything if a network # configuration already exists on the target @@ -127,8 +132,7 @@ def run(): pass # We need to overwrite the default resolv.conf in the chroot. - source_resolv = "/etc/resolv.conf" - target_resolv = os.path.join(root_mount_point, "etc/resolv.conf") + source_resolv, target_resolv = path_pair(root_mount_point, "etc/resolv.conf") if source_resolv != target_resolv and os.path.exists(source_resolv): try: os.remove(target_resolv) From 0403749bf105020f273aff1fe4d4faa091b407c5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 24 Sep 2021 12:40:38 +0200 Subject: [PATCH 09/32] Changes: pre-release housekeeping --- CHANGES | 10 ++++++++-- CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index a5a1b1fe1..c91e99299 100644 --- a/CHANGES +++ b/CHANGES @@ -7,21 +7,27 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. -# 3.2.44 (unreleased) # +# 3.2.44 (2021-09-24) # This release contains contributions from (alphabetically by first name): + - Anke Boersma - Shrinivas Vishnu Kumbhar (new contributor, welcome!) - whorfin (new contributor, welcome!) ## Core ## - - No core changes yet + - "Log spam" has been reduced a little in the partitioning module. ## Modules ## + - *initcpiocfg* has had a number of internal code-fixes, and now adds + the `consolefont` hook by default as well. (Thanks Shrinivas) - Both *locale* and *keyboard* have received some tweaks for configurations in India; unless the user selects otherwise, English is preferred. - The *luksbootkeyfile* module was reported to be too quick to declare a timeout when applying the keyfile. The timeout has been increased to one minute. (Thanks whorfin) + - *networkcfg* tries harder to find the live-user login for re-working + networking settings. This fixes a regression on FerenOS, where the + installer was crashing because it could not find the live-user login. # 3.2.43 (2021-09-17) # diff --git a/CMakeLists.txt b/CMakeLists.txt index 807cdfabf..b391cfeb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ project( CALAMARES LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development ### OPTIONS # From 0a0f3dd2b6291989c7b7fe74dfab3a0b913c0a43 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 24 Sep 2021 13:48:27 +0200 Subject: [PATCH 10/32] Changes: hot-fix release --- CHANGES | 9 +++++++++ CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c91e99299..97f8bd4c7 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,15 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. +# 3.2.44.1 (2021-09-24) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + +This is a hotfix for a typo -- not a syntax error -- that affects the +*initcpiocfg* module. Reported and fixed by Anke. + + # 3.2.44 (2021-09-24) # This release contains contributions from (alphabetically by first name): diff --git a/CMakeLists.txt b/CMakeLists.txt index b391cfeb2..01ae160d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ # TODO:3.3: Require CMake 3.12 cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) project( CALAMARES - VERSION 3.2.44 + VERSION 3.2.44.1 LANGUAGES C CXX ) From 723da94e755509687fc168639d4c0afdf621b14a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 24 Sep 2021 13:48:35 +0200 Subject: [PATCH 11/32] i18n: source texts --- lang/calamares_en.ts | 50 ++++++------ lang/python.pot | 189 +++++++++++++++++++------------------------ 2 files changed, 108 insertions(+), 131 deletions(-) diff --git a/lang/calamares_en.ts b/lang/calamares_en.ts index 884498c2c..5575b6964 100644 --- a/lang/calamares_en.ts +++ b/lang/calamares_en.ts @@ -171,7 +171,7 @@ Calamares::JobThread - + Done Done @@ -320,17 +320,17 @@ &Close - + Install Log Paste URL Install Log Paste URL - + The upload was unsuccessful. No web-paste was done. The upload was unsuccessful. No web-paste was done. - + Install log posted to %1 @@ -1926,35 +1926,35 @@ The installer will quit and all changes will be lost. LuksBootKeyFileJob - + Configuring LUKS key file. Configuring LUKS key file. - - + + No partitions are defined. No partitions are defined. - - - + + + Encrypted rootfs setup error Encrypted rootfs setup error - + Root partition %1 is LUKS but no passphrase has been set. Root partition %1 is LUKS but no passphrase has been set. - + Could not create LUKS key file for root partition %1. Could not create LUKS key file for root partition %1. - + Could not configure LUKS key file on partition %1. Could not configure LUKS key file on partition %1. @@ -2929,14 +2929,14 @@ The installer will quit and all changes will be lost. ProcessResult - + There was no output from the command. There was no output from the command. - + Output: @@ -2945,52 +2945,52 @@ Output: - + External command crashed. External command crashed. - + Command <i>%1</i> crashed. Command <i>%1</i> crashed. - + External command failed to start. External command failed to start. - + Command <i>%1</i> failed to start. Command <i>%1</i> failed to start. - + Internal error when starting command. Internal error when starting command. - + Bad parameters for process job call. Bad parameters for process job call. - + External command failed to finish. External command failed to finish. - + Command <i>%1</i> failed to finish in %2 seconds. Command <i>%1</i> failed to finish in %2 seconds. - + External command finished with errors. External command finished with errors. - + Command <i>%1</i> finished with exit code %2. Command <i>%1</i> finished with exit code %2. diff --git a/lang/python.pot b/lang/python.pot index 335a89206..9520a6d6b 100644 --- a/lang/python.pot +++ b/lang/python.pot @@ -2,32 +2,32 @@ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. -# +# #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-08 13:31+0200\n" +"POT-Creation-Date: 2021-09-22 11:02+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: \n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" #: src/modules/grubcfg/main.py:28 msgid "Configure GRUB." -msgstr "Configure GRUB." +msgstr "" #: src/modules/mount/main.py:30 msgid "Mounting partitions." -msgstr "Mounting partitions." +msgstr "" -#: src/modules/mount/main.py:144 src/modules/initcpiocfg/main.py:197 -#: src/modules/initcpiocfg/main.py:201 +#: src/modules/mount/main.py:144 src/modules/initcpiocfg/main.py:227 +#: src/modules/initcpiocfg/main.py:231 #: src/modules/luksopenswaphookcfg/main.py:86 #: src/modules/luksopenswaphookcfg/main.py:90 src/modules/rawfs/main.py:164 #: src/modules/initramfscfg/main.py:85 src/modules/initramfscfg/main.py:89 @@ -36,372 +36,349 @@ msgstr "Mounting partitions." #: src/modules/fstab/main.py:361 src/modules/fstab/main.py:388 #: src/modules/localecfg/main.py:135 src/modules/networkcfg/main.py:42 msgid "Configuration Error" -msgstr "Configuration Error" +msgstr "" -#: src/modules/mount/main.py:145 src/modules/initcpiocfg/main.py:198 +#: src/modules/mount/main.py:145 src/modules/initcpiocfg/main.py:228 #: src/modules/luksopenswaphookcfg/main.py:87 src/modules/rawfs/main.py:165 #: src/modules/initramfscfg/main.py:86 src/modules/openrcdmcryptcfg/main.py:73 #: src/modules/fstab/main.py:356 msgid "No partitions are defined for
{!s}
to use." -msgstr "No partitions are defined for
{!s}
to use." +msgstr "" #: src/modules/services-systemd/main.py:26 msgid "Configure systemd services" -msgstr "Configure systemd services" +msgstr "" #: src/modules/services-systemd/main.py:59 #: src/modules/services-openrc/main.py:93 msgid "Cannot modify service" -msgstr "Cannot modify service" +msgstr "" #: src/modules/services-systemd/main.py:60 msgid "" "systemctl {arg!s} call in chroot returned error code {num!s}." msgstr "" -"systemctl {arg!s} call in chroot returned error code {num!s}." #: src/modules/services-systemd/main.py:63 #: src/modules/services-systemd/main.py:67 msgid "Cannot enable systemd service {name!s}." -msgstr "Cannot enable systemd service {name!s}." +msgstr "" #: src/modules/services-systemd/main.py:65 msgid "Cannot enable systemd target {name!s}." -msgstr "Cannot enable systemd target {name!s}." +msgstr "" #: src/modules/services-systemd/main.py:69 msgid "Cannot disable systemd target {name!s}." -msgstr "Cannot disable systemd target {name!s}." +msgstr "" #: src/modules/services-systemd/main.py:71 msgid "Cannot mask systemd unit {name!s}." -msgstr "Cannot mask systemd unit {name!s}." +msgstr "" #: src/modules/services-systemd/main.py:73 msgid "" -"Unknown systemd commands {command!s} and " -"{suffix!s} for unit {name!s}." +"Unknown systemd commands {command!s} and {suffix!s} for unit {name!s}." msgstr "" -"Unknown systemd commands {command!s} and " -"{suffix!s} for unit {name!s}." #: src/modules/umount/main.py:31 msgid "Unmount file systems." -msgstr "Unmount file systems." +msgstr "" #: src/modules/unpackfs/main.py:35 msgid "Filling up filesystems." -msgstr "Filling up filesystems." +msgstr "" #: src/modules/unpackfs/main.py:255 msgid "rsync failed with error code {}." -msgstr "rsync failed with error code {}." +msgstr "" #: src/modules/unpackfs/main.py:300 msgid "Unpacking image {}/{}, file {}/{}" -msgstr "Unpacking image {}/{}, file {}/{}" +msgstr "" #: src/modules/unpackfs/main.py:315 msgid "Starting to unpack {}" -msgstr "Starting to unpack {}" +msgstr "" #: src/modules/unpackfs/main.py:324 src/modules/unpackfs/main.py:464 msgid "Failed to unpack image \"{}\"" -msgstr "Failed to unpack image \"{}\"" +msgstr "" #: src/modules/unpackfs/main.py:431 msgid "No mount point for root partition" -msgstr "No mount point for root partition" +msgstr "" #: src/modules/unpackfs/main.py:432 msgid "globalstorage does not contain a \"rootMountPoint\" key, doing nothing" -msgstr "globalstorage does not contain a \"rootMountPoint\" key, doing nothing" +msgstr "" #: src/modules/unpackfs/main.py:437 msgid "Bad mount point for root partition" -msgstr "Bad mount point for root partition" +msgstr "" #: src/modules/unpackfs/main.py:438 msgid "rootMountPoint is \"{}\", which does not exist, doing nothing" -msgstr "rootMountPoint is \"{}\", which does not exist, doing nothing" +msgstr "" #: src/modules/unpackfs/main.py:454 src/modules/unpackfs/main.py:458 #: src/modules/unpackfs/main.py:478 msgid "Bad unsquash configuration" -msgstr "Bad unsquash configuration" +msgstr "" #: src/modules/unpackfs/main.py:455 msgid "The filesystem for \"{}\" ({}) is not supported by your current kernel" -msgstr "The filesystem for \"{}\" ({}) is not supported by your current kernel" +msgstr "" #: src/modules/unpackfs/main.py:459 msgid "The source filesystem \"{}\" does not exist" -msgstr "The source filesystem \"{}\" does not exist" +msgstr "" #: src/modules/unpackfs/main.py:465 msgid "" "Failed to find unsquashfs, make sure you have the squashfs-tools package " "installed" msgstr "" -"Failed to find unsquashfs, make sure you have the squashfs-tools package " -"installed" #: src/modules/unpackfs/main.py:479 msgid "The destination \"{}\" in the target system is not a directory" -msgstr "The destination \"{}\" in the target system is not a directory" +msgstr "" #: src/modules/displaymanager/main.py:526 msgid "Cannot write KDM configuration file" -msgstr "Cannot write KDM configuration file" +msgstr "" #: src/modules/displaymanager/main.py:527 msgid "KDM config file {!s} does not exist" -msgstr "KDM config file {!s} does not exist" +msgstr "" #: src/modules/displaymanager/main.py:588 msgid "Cannot write LXDM configuration file" -msgstr "Cannot write LXDM configuration file" +msgstr "" #: src/modules/displaymanager/main.py:589 msgid "LXDM config file {!s} does not exist" -msgstr "LXDM config file {!s} does not exist" +msgstr "" #: src/modules/displaymanager/main.py:672 msgid "Cannot write LightDM configuration file" -msgstr "Cannot write LightDM configuration file" +msgstr "" #: src/modules/displaymanager/main.py:673 msgid "LightDM config file {!s} does not exist" -msgstr "LightDM config file {!s} does not exist" +msgstr "" #: src/modules/displaymanager/main.py:747 msgid "Cannot configure LightDM" -msgstr "Cannot configure LightDM" +msgstr "" #: src/modules/displaymanager/main.py:748 msgid "No LightDM greeter installed." -msgstr "No LightDM greeter installed." +msgstr "" #: src/modules/displaymanager/main.py:779 msgid "Cannot write SLIM configuration file" -msgstr "Cannot write SLIM configuration file" +msgstr "" #: src/modules/displaymanager/main.py:780 msgid "SLIM config file {!s} does not exist" -msgstr "SLIM config file {!s} does not exist" +msgstr "" #: src/modules/displaymanager/main.py:906 msgid "No display managers selected for the displaymanager module." -msgstr "No display managers selected for the displaymanager module." +msgstr "" #: src/modules/displaymanager/main.py:907 msgid "" "The displaymanagers list is empty or undefined in both globalstorage and " "displaymanager.conf." msgstr "" -"The displaymanagers list is empty or undefined in both globalstorage and " -"displaymanager.conf." #: src/modules/displaymanager/main.py:989 msgid "Display manager configuration was incomplete" -msgstr "Display manager configuration was incomplete" +msgstr "" #: src/modules/initcpiocfg/main.py:28 msgid "Configuring mkinitcpio." -msgstr "Configuring mkinitcpio." +msgstr "" -#: src/modules/initcpiocfg/main.py:202 +#: src/modules/initcpiocfg/main.py:232 #: src/modules/luksopenswaphookcfg/main.py:91 #: src/modules/initramfscfg/main.py:90 src/modules/openrcdmcryptcfg/main.py:77 #: src/modules/fstab/main.py:362 src/modules/localecfg/main.py:136 #: src/modules/networkcfg/main.py:43 msgid "No root mount point is given for
{!s}
to use." -msgstr "No root mount point is given for
{!s}
to use." +msgstr "" #: src/modules/luksopenswaphookcfg/main.py:26 msgid "Configuring encrypted swap." -msgstr "Configuring encrypted swap." +msgstr "" #: src/modules/rawfs/main.py:26 msgid "Installing data." -msgstr "Installing data." +msgstr "" #: src/modules/services-openrc/main.py:29 msgid "Configure OpenRC services" -msgstr "Configure OpenRC services" +msgstr "" #: src/modules/services-openrc/main.py:57 msgid "Cannot add service {name!s} to run-level {level!s}." -msgstr "Cannot add service {name!s} to run-level {level!s}." +msgstr "" #: src/modules/services-openrc/main.py:59 msgid "Cannot remove service {name!s} from run-level {level!s}." -msgstr "Cannot remove service {name!s} from run-level {level!s}." +msgstr "" #: src/modules/services-openrc/main.py:61 msgid "" "Unknown service-action {arg!s} for service {name!s} in run-" "level {level!s}." msgstr "" -"Unknown service-action {arg!s} for service {name!s} in run-" -"level {level!s}." #: src/modules/services-openrc/main.py:94 msgid "" "rc-update {arg!s} call in chroot returned error code {num!s}." msgstr "" -"rc-update {arg!s} call in chroot returned error code {num!s}." #: src/modules/services-openrc/main.py:101 msgid "Target runlevel does not exist" -msgstr "Target runlevel does not exist" +msgstr "" #: src/modules/services-openrc/main.py:102 msgid "" "The path for runlevel {level!s} is {path!s}, which does not " "exist." msgstr "" -"The path for runlevel {level!s} is {path!s}, which does not " -"exist." #: src/modules/services-openrc/main.py:110 msgid "Target service does not exist" -msgstr "Target service does not exist" +msgstr "" #: src/modules/services-openrc/main.py:111 msgid "" -"The path for service {name!s} is {path!s}, which does not " -"exist." +"The path for service {name!s} is {path!s}, which does not exist." msgstr "" -"The path for service {name!s} is {path!s}, which does not " -"exist." #: src/modules/plymouthcfg/main.py:27 msgid "Configure Plymouth theme" -msgstr "Configure Plymouth theme" +msgstr "" #: src/modules/packages/main.py:50 src/modules/packages/main.py:59 #: src/modules/packages/main.py:69 msgid "Install packages." -msgstr "Install packages." +msgstr "" #: src/modules/packages/main.py:57 #, python-format msgid "Processing packages (%(count)d / %(total)d)" -msgstr "Processing packages (%(count)d / %(total)d)" +msgstr "" #: src/modules/packages/main.py:62 #, python-format msgid "Installing one package." msgid_plural "Installing %(num)d packages." -msgstr[0] "Installing one package." -msgstr[1] "Installing %(num)d packages." +msgstr[0] "" +msgstr[1] "" #: src/modules/packages/main.py:65 #, python-format msgid "Removing one package." msgid_plural "Removing %(num)d packages." -msgstr[0] "Removing one package." -msgstr[1] "Removing %(num)d packages." +msgstr[0] "" +msgstr[1] "" #: src/modules/packages/main.py:638 src/modules/packages/main.py:650 #: src/modules/packages/main.py:678 msgid "Package Manager error" -msgstr "Package Manager error" +msgstr "" #: src/modules/packages/main.py:639 msgid "" "The package manager could not prepare updates. The command
{!s}
" "returned error code {!s}." msgstr "" -"The package manager could not prepare updates. The command
{!s}
" -"returned error code {!s}." #: src/modules/packages/main.py:651 msgid "" -"The package manager could not update the system. The command
{!s}
" -" returned error code {!s}." +"The package manager could not update the system. The command
{!s}
" +"returned error code {!s}." msgstr "" -"The package manager could not update the system. The command
{!s}
" -" returned error code {!s}." #: src/modules/packages/main.py:679 msgid "" "The package manager could not make changes to the installed system. The " "command
{!s}
returned error code {!s}." msgstr "" -"The package manager could not make changes to the installed system. The " -"command
{!s}
returned error code {!s}." #: src/modules/bootloader/main.py:43 msgid "Install bootloader." -msgstr "Install bootloader." +msgstr "" #: src/modules/bootloader/main.py:508 msgid "Bootloader installation error" -msgstr "Bootloader installation error" +msgstr "" #: src/modules/bootloader/main.py:509 msgid "" -"The bootloader could not be installed. The installation command " -"
{!s}
returned error code {!s}." +"The bootloader could not be installed. The installation command
{!s} returned error code {!s}."
 msgstr ""
-"The bootloader could not be installed. The installation command "
-"
{!s}
returned error code {!s}." #: src/modules/hwclock/main.py:26 msgid "Setting hardware clock." -msgstr "Setting hardware clock." +msgstr "" #: src/modules/mkinitfs/main.py:27 msgid "Creating initramfs with mkinitfs." -msgstr "Creating initramfs with mkinitfs." +msgstr "" #: src/modules/mkinitfs/main.py:49 msgid "Failed to run mkinitfs on the target" -msgstr "Failed to run mkinitfs on the target" +msgstr "" #: src/modules/mkinitfs/main.py:50 src/modules/dracut/main.py:50 msgid "The exit code was {}" -msgstr "The exit code was {}" +msgstr "" #: src/modules/dracut/main.py:27 msgid "Creating initramfs with dracut." -msgstr "Creating initramfs with dracut." +msgstr "" #: src/modules/dracut/main.py:49 msgid "Failed to run dracut on the target" -msgstr "Failed to run dracut on the target" +msgstr "" #: src/modules/initramfscfg/main.py:32 msgid "Configuring initramfs." -msgstr "Configuring initramfs." +msgstr "" #: src/modules/openrcdmcryptcfg/main.py:26 msgid "Configuring OpenRC dmcrypt service." -msgstr "Configuring OpenRC dmcrypt service." +msgstr "" #: src/modules/fstab/main.py:29 msgid "Writing fstab." -msgstr "Writing fstab." +msgstr "" #: src/modules/fstab/main.py:389 msgid "No
{!s}
configuration is given for
{!s}
to use." -msgstr "No
{!s}
configuration is given for
{!s}
to use." +msgstr "" #: src/modules/dummypython/main.py:35 msgid "Dummy python job." -msgstr "Dummy python job." +msgstr "" #: src/modules/dummypython/main.py:37 src/modules/dummypython/main.py:93 #: src/modules/dummypython/main.py:94 msgid "Dummy python step {}" -msgstr "Dummy python step {}" +msgstr "" #: src/modules/localecfg/main.py:30 msgid "Configuring locales." -msgstr "Configuring locales." +msgstr "" #: src/modules/networkcfg/main.py:29 msgid "Saving network configuration." -msgstr "Saving network configuration." +msgstr "" From 65c1ef7cb5fcab2bc80268aebc15de072ffab0f2 Mon Sep 17 00:00:00 2001 From: demmm Date: Fri, 24 Sep 2021 16:27:35 +0200 Subject: [PATCH 12/32] [initcpiocfg] fix install failure due to extra s --- src/modules/initcpiocfg/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index ba43984d2..99168dcde 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -128,7 +128,7 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): line = "HOOKS=\"{!s}\"".format(' '.join(hooks)) elif line.startswith("MODULES"): line = "MODULES=\"{!s}\"".format(' '.join(modules)) - elif lines.startswith("FILES"): + elif line.startswith("FILES"): line = "FILES=\"{!s}\"".format(' '.join(files)) mkinitcpio_file.write(line + "\n") From 590f16370ca764385a2e89e369681c419dc30326 Mon Sep 17 00:00:00 2001 From: corey lang Date: Mon, 27 Sep 2021 01:04:52 -0500 Subject: [PATCH 13/32] [networkcfg] fix replace_username() undefined variables --- src/modules/networkcfg/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/networkcfg/main.py b/src/modules/networkcfg/main.py index 4dc6cbbf7..0ee47c1aa 100644 --- a/src/modules/networkcfg/main.py +++ b/src/modules/networkcfg/main.py @@ -73,12 +73,12 @@ def replace_username(nm_config_filename, live_user, target_user): if not os.path.exists(nm_config_filename): return - with open(target_network, "r") as network_conf: + with open(nm_config_filename, "r") as network_conf: text = network_conf.readlines() live_permissions = 'permissions=user:{}:;'.format(live_user) - target_permissions = 'permissions=user:{}:;\n'.format(user) - with open(target_network, "w") as network_conf: + target_permissions = 'permissions=user:{}:;\n'.format(target_user) + with open(nm_config_filename, "w") as network_conf: for line in text: if live_permissions in line: line = target_permissions From c4034d944bb6484a85fcb2ddc613f75c1d51eaf9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:08:22 +0200 Subject: [PATCH 14/32] Changes: pre-release housekeeping --- CHANGES | 9 +++++++++ CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 97f8bd4c7..a9afa18f1 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,15 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. +# 3.2.44.2 (2021-09-27) # + +This release contains contributions from (alphabetically by first name): + - + +This is a hotfix for a typo -- not a syntax error -- that affects the +*networkcfg* module. Reported and fixed by . + + # 3.2.44.1 (2021-09-24) # This release contains contributions from (alphabetically by first name): diff --git a/CMakeLists.txt b/CMakeLists.txt index 01ae160d9..58a06db81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ # TODO:3.3: Require CMake 3.12 cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) project( CALAMARES - VERSION 3.2.44.1 + VERSION 3.2.44.2 LANGUAGES C CXX ) From 657a36310bb8e7199ad5ac897160469c5df16f13 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:18:12 +0200 Subject: [PATCH 15/32] [libcalamares] Log the Python pre-script a little better - Make clear that the @ is a string-location, and how long the pre-script is (although in practice, it will be either null and 0, or the values set in the loadmodule executable). --- src/libcalamares/PythonJob.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 1a4683c29..201f56a15 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -330,7 +330,8 @@ void PythonJob::setInjectedPreScript( const char* preScript ) { s_preScript = preScript; - cDebug() << "Python pre-script set to" << Logger::Pointer( preScript ); + cDebug() << "Python pre-script set to string" << Logger::Pointer( preScript ) << "length" + << ( preScript ? strlen( preScript ) : 0 ); } } // namespace Calamares From de9e6a7d7086b2d4859ac6fa869afd19ab337969 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:27:36 +0200 Subject: [PATCH 16/32] [calamares] Log module-searching in the test-application --- src/calamares/testmain.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 6d75a4fbb..35cddfce8 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -143,8 +143,7 @@ handle_args( QCoreApplication& a ) parser.value( langOption ), parser.value( brandOption ), parser.isSet( slideshowOption ) || parser.isSet( uiOption ), - pythonInjection - }; + pythonInjection }; } } @@ -299,7 +298,8 @@ load_module( const ModuleConfig& moduleConfig ) bool ok = false; QVariantMap descriptor; - for ( const QString& prefix : QStringList { "./", "src/modules/", "modules/" } ) + QStringList moduleDirectories { "./", "src/modules/", "modules/" }; + for ( const QString& prefix : qAsConst( moduleDirectories ) ) { // Could be a complete path, eg. src/modules/dummycpp/module.desc fi = QFileInfo( prefix + moduleName ); @@ -330,7 +330,7 @@ load_module( const ModuleConfig& moduleConfig ) if ( !ok ) { - cWarning() << "No suitable module descriptor found."; + cWarning() << "No suitable module descriptor found in" << Logger::DebugList( moduleDirectories ); return nullptr; } @@ -461,7 +461,7 @@ main( int argc, char* argv[] ) #ifdef WITH_PYTHON if ( module.m_pythonInjection ) { - Calamares::PythonJob::setInjectedPreScript(pythonPreScript); + Calamares::PythonJob::setInjectedPreScript( pythonPreScript ); } #endif #ifdef WITH_QML From 058e6cbcda1104455c7e0f777e0170f9eedd483a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:34:08 +0200 Subject: [PATCH 17/32] [calamares] Log failed module-load in test-application --- src/calamares/testmain.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 35cddfce8..c0258eb54 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -325,6 +325,17 @@ load_module( const ModuleConfig& moduleConfig ) { break; } + else + { + if ( !fi.exists() ) + { + cDebug() << "Expected a descriptor file" << fi.path(); + } + else + { + cDebug() << "Read descriptor" << fi.path() << "and it was empty."; + } + } } } From 7cda1d2edde0e3e0e4c682adf8028588b2aee23c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:39:27 +0200 Subject: [PATCH 18/32] [calamares] Test-loader tries loading from install-dir, too --- src/calamares/testmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index c0258eb54..1d6971e80 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -298,7 +298,7 @@ load_module( const ModuleConfig& moduleConfig ) bool ok = false; QVariantMap descriptor; - QStringList moduleDirectories { "./", "src/modules/", "modules/" }; + QStringList moduleDirectories { "./", "src/modules/", "modules/", CMAKE_INSTALL_FULL_LIBDIR "/calamares/modules/" }; for ( const QString& prefix : qAsConst( moduleDirectories ) ) { // Could be a complete path, eg. src/modules/dummycpp/module.desc From 815bb62ae520d24923b6cc1aed8c1340117f508f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 14:26:43 +0200 Subject: [PATCH 19/32] [calamares] Fix test-application command-line-args - use C++11 uniform-initialization - while here, remove space from name of --global option --- src/calamares/testmain.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 1d6971e80..9d0189031 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -71,22 +71,20 @@ handle_args( QCoreApplication& a ) { QCommandLineOption debugLevelOption( QStringLiteral( "D" ), "Verbose output for debugging purposes (0-8), ignored.", "level" ); - QCommandLineOption globalOption( QStringList() << QStringLiteral( "g" ) << QStringLiteral( "global " ), + QCommandLineOption globalOption( { QStringLiteral( "g" ), QStringLiteral( "global" ) }, QStringLiteral( "Global settings document" ), "global.yaml" ); - QCommandLineOption jobOption( QStringList() << QStringLiteral( "j" ) << QStringLiteral( "job" ), - QStringLiteral( "Job settings document" ), - "job.yaml" ); - QCommandLineOption langOption( QStringList() << QStringLiteral( "l" ) << QStringLiteral( "language" ), + QCommandLineOption jobOption( + { QStringLiteral( "j" ), QStringLiteral( "job" ) }, QStringLiteral( "Job settings document" ), "job.yaml" ); + QCommandLineOption langOption( { QStringLiteral( "l" ), QStringLiteral( "language" ) }, QStringLiteral( "Language (global)" ), "languagecode" ); - QCommandLineOption brandOption( QStringList() << QStringLiteral( "b" ) << QStringLiteral( "branding" ), + QCommandLineOption brandOption( { QStringLiteral( "b" ), QStringLiteral( "branding" ) }, QStringLiteral( "Branding directory" ), "path/to/branding.desc", "src/branding/default/branding.desc" ); - QCommandLineOption uiOption( QStringList() << QStringLiteral( "U" ) << QStringLiteral( "ui" ), - QStringLiteral( "Enable UI" ) ); - QCommandLineOption slideshowOption( QStringList() << QStringLiteral( "s" ) << QStringLiteral( "slideshow" ), + QCommandLineOption uiOption( { QStringLiteral( "U" ), QStringLiteral( "ui" ) }, QStringLiteral( "Enable UI" ) ); + QCommandLineOption slideshowOption( { QStringLiteral( "s" ), QStringLiteral( "slideshow" ) }, QStringLiteral( "Run slideshow module" ) ); QCommandLineParser parser; parser.setApplicationDescription( "Calamares module tester" ); @@ -101,7 +99,7 @@ handle_args( QCoreApplication& a ) parser.addOption( uiOption ); parser.addOption( slideshowOption ); #ifdef WITH_PYTHON - QCommandLineOption pythonOption( QStringList() << QStringLiteral( "P" ) << QStringLiteral( "no-injected-python" ), + QCommandLineOption pythonOption( { QStringLiteral( "P" ), QStringLiteral( "no-injected-python" ) }, QStringLiteral( "Do not disable potentially-harmful Python commands" ) ); parser.addOption( pythonOption ); #endif From f197acf8e00d20db25f267604685898dc0547daa Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 17:27:42 +0200 Subject: [PATCH 20/32] CI: add stubs for libcalamares bits, to help pylint --- ci/libcalamares/__init__.py | 9 +++++++++ ci/libcalamares/globalstorage.py | 9 +++++++++ ci/libcalamares/utils.py | 15 +++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 ci/libcalamares/__init__.py create mode 100644 ci/libcalamares/globalstorage.py create mode 100644 ci/libcalamares/utils.py diff --git a/ci/libcalamares/__init__.py b/ci/libcalamares/__init__.py new file mode 100644 index 000000000..11bf0ffe2 --- /dev/null +++ b/ci/libcalamares/__init__.py @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# Stubs for part of the Python API from libcalamares +# (although the **actual** API is presented through +# Boost::Python, not as a bare C-extension) so that +# pylint doesn't complain about libcalamares internals. + +pass diff --git a/ci/libcalamares/globalstorage.py b/ci/libcalamares/globalstorage.py new file mode 100644 index 000000000..3c2acb870 --- /dev/null +++ b/ci/libcalamares/globalstorage.py @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# Stubs for part of the Python API from libcalamares +# (although the **actual** API is presented through +# Boost::Python, not as a bare C-extension) so that +# pylint doesn't complain about libcalamares internals. + +def value(_): return 1 diff --git a/ci/libcalamares/utils.py b/ci/libcalamares/utils.py new file mode 100644 index 000000000..1d423893b --- /dev/null +++ b/ci/libcalamares/utils.py @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# Stubs for part of the Python API from libcalamares +# (although the **actual** API is presented through +# Boost::Python, not as a bare C-extension) so that +# pylint doesn't complain about libcalamares internals. + +def debug(_): pass + +def warning(_): pass + +def gettext_path(): pass + +def gettext_languages(): pass From 836ea55dbd1da35ea0c4f4205662de4693827fe2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 17:50:47 +0200 Subject: [PATCH 21/32] Changes: credit to Corey for fixes --- CHANGES | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index a9afa18f1..773f05e57 100644 --- a/CHANGES +++ b/CHANGES @@ -10,10 +10,10 @@ website will have to do for older versions. # 3.2.44.2 (2021-09-27) # This release contains contributions from (alphabetically by first name): - - + - Corey Lang (new contributor, welcome!) This is a hotfix for a typo -- not a syntax error -- that affects the -*networkcfg* module. Reported and fixed by . +*networkcfg* module. Reported and fixed by Corey. # 3.2.44.1 (2021-09-24) # From 719548213f00a504f383ca67f8cc5f051586f3f3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 17:52:02 +0200 Subject: [PATCH 22/32] CMake: if pylint is available, run it as part of the test-suite This introduces a stub-implementation (fake) that mimics the API offered by libcalamares (the library is actually exposed to Python via Boost::Python, so it doesn't act like a C-extension). Using that stub-implementation, we can check Python modules for validity as part of the test-suite. The stub-implementation is needed, because otherwise every Python module already fails at `import libcalamares`. - stub-implement the API that is actually used by the Python modules - in globalstorage, be slightly smart about what keys are being requested (so that e.g. all the modules that handle partitions information get an empty list and can manipulate that, instead of erroring out when they get a string) --- .../CalamaresAddModuleSubdirectory.cmake | 25 +++++++++++++++++++ ci/libcalamares/__init__.py | 2 +- ci/libcalamares/globalstorage.py | 17 ++++++++++++- ci/libcalamares/utils.py | 8 ++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/CMakeModules/CalamaresAddModuleSubdirectory.cmake b/CMakeModules/CalamaresAddModuleSubdirectory.cmake index 1f1c02300..91524a09e 100644 --- a/CMakeModules/CalamaresAddModuleSubdirectory.cmake +++ b/CMakeModules/CalamaresAddModuleSubdirectory.cmake @@ -42,6 +42,18 @@ include( CalamaresCheckModuleSelection ) set( MODULE_DATA_DESTINATION share/calamares/modules ) +# We look for Pylint (just once) so that unittests can be added that +# check the syntax / variables of Python modules. This should help +# avoid more typo's-in-releases. +if(BUILD_TESTING AND NOT PYLINT_COMMAND_SEARCHED) + set(PYLINT_COMMAND_SEARCHED TRUE) + find_program( + PYLINT_COMMAND + NAMES pylint3 pylint + PATHS $ENV{HOME}/.local/bin + ) +endif() + function( _calamares_add_module_subdirectory_impl ) set( SUBDIRECTORY ${ARGV0} ) @@ -241,6 +253,19 @@ function( _calamares_add_module_subdirectory_impl ) if ( EXISTS ${_testdir}/CMakeTests.txt AND NOT EXISTS ${_mod_dir}/CMakeLists.txt ) include( ${_testdir}/CMakeTests.txt ) endif() + if ( PYLINT_COMMAND AND MODULE_INTERFACE MATCHES "python" ) + # Python modules get an additional test via pylint; this + # needs to run at top-level because the ci/libcalamares directory + # contains API stubs. + # + # TODO: the entry point is assumed to be `main.py`, but that is + # configurable through module.desc + add_test( + NAME lint-${SUBDIRECTORY} + COMMAND env PYTHONPATH=ci: ${PYLINT_COMMAND} -E ${_mod_dir}/main.py + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + endif() endif() endfunction() diff --git a/ci/libcalamares/__init__.py b/ci/libcalamares/__init__.py index 11bf0ffe2..1f7a09430 100644 --- a/ci/libcalamares/__init__.py +++ b/ci/libcalamares/__init__.py @@ -6,4 +6,4 @@ # Boost::Python, not as a bare C-extension) so that # pylint doesn't complain about libcalamares internals. -pass +VERSION_SHORT="1.0" diff --git a/ci/libcalamares/globalstorage.py b/ci/libcalamares/globalstorage.py index 3c2acb870..d40a28204 100644 --- a/ci/libcalamares/globalstorage.py +++ b/ci/libcalamares/globalstorage.py @@ -6,4 +6,19 @@ # Boost::Python, not as a bare C-extension) so that # pylint doesn't complain about libcalamares internals. -def value(_): return 1 +def count(): return 1 + +def keys(): return [] + +def contains(_): return True + +def value(key): + if key in ("branding",): + return dict() + if key in ("partitions",): + return list() + return "" + +def insert(key, value): pass + +def remove(_): pass diff --git a/ci/libcalamares/utils.py b/ci/libcalamares/utils.py index 1d423893b..706e4a95a 100644 --- a/ci/libcalamares/utils.py +++ b/ci/libcalamares/utils.py @@ -10,6 +10,14 @@ def debug(_): pass def warning(_): pass +def error(_): pass + def gettext_path(): pass def gettext_languages(): pass + +def target_env_call(_): return 0 + +def check_target_env_call(_): pass + +def mount(device, mountpoint, fstype, options): return 0 From 96c89fc08011a8f4532e60989efb784624626529 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 20:29:03 +0200 Subject: [PATCH 23/32] [displaymanager] Fix Python errors Apparently nobody ever hit the else-branch here (because each DM has exactly one implementation -- that's what the check is there for!) because the logging of the error itself would raise IndexError or ValueError. --- src/modules/displaymanager/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 8b63b9e8d..5fb228682 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -198,7 +198,7 @@ desktop_environments = [ DesktopEnvironment('/usr/bin/fvwm3', 'fvwm3'), DesktopEnvironment('/usr/bin/sway', 'sway'), DesktopEnvironment('/usr/bin/ukui-session', 'ukui'), - DesktopEnvironment('/usr/bin/cutefish-session', 'cutefish-xsession'), + DesktopEnvironment('/usr/bin/cutefish-session', 'cutefish-xsession'), ] @@ -923,7 +923,7 @@ def run(): else: dm_instance = None else: - libcalamares.utils.debug("{!s} has {!d} implementation classes.".format(dm).format(len(impl))) + libcalamares.utils.debug("{!s} has {!s} implementation classes.".format(dm, len(impl))) if dm_instance is None: libcalamares.utils.debug("{!s} selected but not installed".format(dm)) From 16f8243fb34277f71a2c7fdab1fbdb233c6e0f3c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 20:41:52 +0200 Subject: [PATCH 24/32] [unpackfs] Move to conventional python-libcalamares use All **other** modules fully specify libcalamares; only unpackfs was importing shortcuts. Change to conventional usage (partly because that's easier on the pylint implementation, partly because it's then consistent with the rest). --- src/modules/unpackfs/main.py | 51 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index 8a5194843..e48e9b6bd 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -22,13 +22,12 @@ import subprocess import sys import tempfile -from libcalamares import * -from libcalamares.utils import mount +import libcalamares import gettext _ = gettext.translation("calamares-python", - localedir=utils.gettext_path(), - languages=utils.gettext_languages(), + localedir=libcalamares.utils.gettext_path(), + languages=libcalamares.utils.gettext_languages(), fallback=True).gettext def pretty_name(): @@ -123,14 +122,14 @@ class UnpackEntry: return if os.path.isdir(self.source): - r = mount(self.source, imgmountdir, "", "--bind") + r = libcalamares.utils.mount(self.source, imgmountdir, "", "--bind") elif os.path.isfile(self.source): - r = mount(self.source, imgmountdir, self.sourcefs, "loop") + r = libcalamares.utils.mount(self.source, imgmountdir, self.sourcefs, "loop") else: # self.source is a device - r = mount(self.source, imgmountdir, self.sourcefs, "") + r = libcalamares.utils.mount(self.source, imgmountdir, self.sourcefs, "") if r != 0: - utils.debug("Failed to mount '{}' (fs={}) (target={})".format(self.source, self.sourcefs, imgmountdir)) + libcalamares.utils.debug("Failed to mount '{}' (fs={}) (target={})".format(self.source, self.sourcefs, imgmountdir)) raise subprocess.CalledProcessError(r, "mount") @@ -142,7 +141,7 @@ def global_excludes(): List excludes for rsync. """ lst = [] - extra_mounts = globalstorage.value("extraMounts") + extra_mounts = libcalamares.globalstorage.value("extraMounts") if extra_mounts is None: extra_mounts = [] @@ -251,7 +250,7 @@ def file_copy(source, entry, progress_cb): # https://bugzilla.redhat.com/show_bug.cgi?id=868755#c50 # for the same issue in Anaconda, which uses a similar workaround. if process.returncode != 0 and process.returncode != 23: - utils.warning("rsync failed with error code {}.".format(process.returncode)) + libcalamares.utils.warning("rsync failed with error code {}.".format(process.returncode)) return _("rsync failed with error code {}.").format(process.returncode) return None @@ -298,7 +297,7 @@ class UnpackOperation: global status status = _("Unpacking image {}/{}, file {}/{}").format((complete_count+1), len(self.entries), current_done, current_total) - job.setprogress(progress) + libcalamares.job.setprogress(progress) def run(self): """ @@ -313,7 +312,7 @@ class UnpackOperation: complete = 0 for entry in self.entries: status = _("Starting to unpack {}").format(entry.source) - job.setprogress( ( 1.0 * complete ) / len(self.entries) ) + libcalamares.job.setprogress( ( 1.0 * complete ) / len(self.entries) ) entry.do_mount(source_mount_path) entry.do_count() # Fill in the entry.total @@ -398,7 +397,7 @@ def repair_root_permissions(root_mount_point): try: os.chmod(root_mount_point, 0o755) # Want / to be rwxr-xr-x except OSError as e: - utils.warning("Could not set / to safe permissions: {}".format(e)) + libcalamares.utils.warning("Could not set / to safe permissions: {}".format(e)) # But ignore it @@ -414,9 +413,9 @@ def extract_weight(entry): wi = int(w) return wi if wi > 0 else 1 except ValueError: - utils.warning("*weight* setting {!r} is not valid.".format(w)) + libcalamares.utils.warning("*weight* setting {!r} is not valid.".format(w)) except TypeError: - utils.warning("*weight* setting {!r} must be number.".format(w)) + libcalamares.utils.warning("*weight* setting {!r} must be number.".format(w)) return 1 @@ -424,16 +423,16 @@ def run(): """ Unsquash filesystem. """ - root_mount_point = globalstorage.value("rootMountPoint") + root_mount_point = libcalamares.globalstorage.value("rootMountPoint") if not root_mount_point: - utils.warning("No mount point for root partition") + libcalamares.utils.warning("No mount point for root partition") return (_("No mount point for root partition"), _("globalstorage does not contain a \"rootMountPoint\" key, " "doing nothing")) if not os.path.exists(root_mount_point): - utils.warning("Bad root mount point \"{}\"".format(root_mount_point)) + libcalamares.utils.warning("Bad root mount point \"{}\"".format(root_mount_point)) return (_("Bad mount point for root partition"), _("rootMountPoint is \"{}\", which does not " "exist, doing nothing").format(root_mount_point)) @@ -444,22 +443,22 @@ def run(): # - unsupported filesystems # - non-existent sources # - missing tools for specific FS - for entry in job.configuration["unpack"]: + for entry in libcalamares.job.configuration["unpack"]: source = os.path.abspath(entry["source"]) sourcefs = entry["sourcefs"] if sourcefs not in supported_filesystems: - utils.warning("The filesystem for \"{}\" ({}) is not supported by your current kernel".format(source, sourcefs)) - utils.warning(" ... modprobe {} may solve the problem".format(sourcefs)) + libcalamares.utils.warning("The filesystem for \"{}\" ({}) is not supported by your current kernel".format(source, sourcefs)) + libcalamares.utils.warning(" ... modprobe {} may solve the problem".format(sourcefs)) return (_("Bad unsquash configuration"), _("The filesystem for \"{}\" ({}) is not supported by your current kernel").format(source, sourcefs)) if not os.path.exists(source): - utils.warning("The source filesystem \"{}\" does not exist".format(source)) + libcalamares.utils.warning("The source filesystem \"{}\" does not exist".format(source)) return (_("Bad unsquash configuration"), _("The source filesystem \"{}\" does not exist").format(source)) if sourcefs == "squashfs": if shutil.which("unsquashfs") is None: - utils.warning("Failed to find unsquashfs") + libcalamares.utils.warning("Failed to find unsquashfs") return (_("Failed to unpack image \"{}\"").format(self.source), _("Failed to find unsquashfs, make sure you have the squashfs-tools package installed")) @@ -467,18 +466,18 @@ def run(): unpack = list() is_first = True - for entry in job.configuration["unpack"]: + for entry in libcalamares.job.configuration["unpack"]: source = os.path.abspath(entry["source"]) sourcefs = entry["sourcefs"] destination = os.path.abspath(root_mount_point + entry["destination"]) if not os.path.isdir(destination) and sourcefs != "file": - utils.warning(("The destination \"{}\" in the target system is not a directory").format(destination)) + libcalamares.utils.warning(("The destination \"{}\" in the target system is not a directory").format(destination)) if is_first: return (_("Bad unsquash configuration"), _("The destination \"{}\" in the target system is not a directory").format(destination)) else: - utils.debug(".. assuming that the previous targets will create that directory.") + libcalamares.utils.debug(".. assuming that the previous targets will create that directory.") unpack.append(UnpackEntry(source, sourcefs, destination)) # Optional settings From 51898ea32b23f0450999318792033795c264a4b2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 20:48:28 +0200 Subject: [PATCH 25/32] [unpackfs] Fix typo Apparently everyone shipping a squashfs image also has the tools installed, because the error message reporting that the tools-are- missing contained a reference to an undefined variable. Fix that, and while here improve the error message so you don't get a whole path as a title in the error message. The slightly weird error-message construction is so that no messages change and no translation work is needed. --- src/modules/unpackfs/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index e48e9b6bd..020db370c 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -460,8 +460,9 @@ def run(): if shutil.which("unsquashfs") is None: libcalamares.utils.warning("Failed to find unsquashfs") - return (_("Failed to unpack image \"{}\"").format(self.source), - _("Failed to find unsquashfs, make sure you have the squashfs-tools package installed")) + return (_("Bad unsquash configuration"), + _("Failed to find unsquashfs, make sure you have the squashfs-tools package installed.") + + " " + _("Failed to unpack image \"{}\"").format(source)) unpack = list() From de63669ceee38b21faba08c245f41d4ffb6ef3f6 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 21:32:43 +0200 Subject: [PATCH 26/32] CI: add missing API stub-implementation for pylint --- ci/libcalamares/job.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ci/libcalamares/job.py diff --git a/ci/libcalamares/job.py b/ci/libcalamares/job.py new file mode 100644 index 000000000..9ea38b878 --- /dev/null +++ b/ci/libcalamares/job.py @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# Stubs for part of the Python API from libcalamares +# (although the **actual** API is presented through +# Boost::Python, not as a bare C-extension) so that +# pylint doesn't complain about libcalamares internals. + +configuration = dict() + +def setprogress(_): pass + +def pretty_name(): return "" + +def working_path(): return "" From 6b460ce440451f6434582ee9511f634c036fd835 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 16:49:53 +0200 Subject: [PATCH 27/32] [partition] Compare size with the canonical source of "right EFI size" While here, note that the canonical source returns bytes (not MiB). --- src/modules/partition/core/PartUtils.cpp | 3 +-- src/modules/partition/core/PartUtils.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 806c0ceb3..4460bda3e 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -472,8 +472,7 @@ isEfiFilesystemSuitableSize( const Partition* candidate ) { auto size = candidate->capacity(); // bytes - using CalamaresUtils::Units::operator""_MiB; - if ( size >= 300_MiB ) + if ( size >= efiFilesystemMinimumSize() ) { return true; } diff --git a/src/modules/partition/core/PartUtils.h b/src/modules/partition/core/PartUtils.h index dd4efc867..102c70087 100644 --- a/src/modules/partition/core/PartUtils.h +++ b/src/modules/partition/core/PartUtils.h @@ -94,7 +94,7 @@ bool isEfiFilesystemSuitableType( const Partition* candidate ); */ bool isEfiFilesystemSuitableSize( const Partition* candidate ); -/** @brief Returns the minimum size of an EFI boot partition. +/** @brief Returns the minimum size of an EFI boot partition in bytes. * * This is determined as 300MiB, based on the FAT32 standard * and EFI documentation (and not a little discussion in Calamares From a72fc065025e39c1688676c1c38d94143256554a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 16:54:16 +0200 Subject: [PATCH 28/32] [partition] Fix message (use MiB instead of bytes) Reported by cfinnberg. FIXES: #1796 --- src/modules/partition/PartitionViewStep.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index c17954810..ea2f874ce 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -558,9 +558,10 @@ PartitionViewStep::onLeave() if ( !okSize ) { cDebug() << o << "ESP too small"; + const auto atLeastBytes = PartUtils::efiFilesystemMinimumSize(); + const auto atLeastMiB = CalamaresUtils::Units::BytesToMiB( atLeastBytes ); description.append( ' ' ); - description.append( tr( "The filesystem must be at least %1 MiB in size." ) - .arg( PartUtils::efiFilesystemMinimumSize() ) ); + description.append( tr( "The filesystem must be at least %1 MiB in size." ).arg( atLeastMiB ) ); } if ( !okFlag ) { From 90eb0cd844fccea444b411d92b946ee88b3cda97 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 18:08:18 +0200 Subject: [PATCH 29/32] [partition] Fix build --- src/modules/partition/PartitionViewStep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index ea2f874ce..a6b5e1dd8 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -559,7 +559,7 @@ PartitionViewStep::onLeave() { cDebug() << o << "ESP too small"; const auto atLeastBytes = PartUtils::efiFilesystemMinimumSize(); - const auto atLeastMiB = CalamaresUtils::Units::BytesToMiB( atLeastBytes ); + const auto atLeastMiB = CalamaresUtils::BytesToMiB( atLeastBytes ); description.append( ' ' ); description.append( tr( "The filesystem must be at least %1 MiB in size." ).arg( atLeastMiB ) ); } From 05f287ebbb75cd5f82dec7312a8745dd478f05aa Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 18:02:40 +0200 Subject: [PATCH 30/32] [partition] Use the configured EFI size The `partition.conf` file contains an EFI-size. The default is 300MiB, but distributions might like to use a bigger (or smaller) value. Apply the configuration consistently everywhere where we need "the size of the EFI partition". Extend the internal method to look at the configured size. --- src/modules/partition/Config.cpp | 19 +++++++++++++++++- src/modules/partition/core/PartUtils.cpp | 20 +++++++++++++++++-- .../partition/core/PartitionActions.cpp | 9 +-------- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/modules/partition/Config.cpp b/src/modules/partition/Config.cpp index 508231a75..e383b3a73 100644 --- a/src/modules/partition/Config.cpp +++ b/src/modules/partition/Config.cpp @@ -13,6 +13,7 @@ #include "GlobalStorage.h" #include "JobQueue.h" +#include "partition/PartitionSize.h" #include "utils/Logger.h" #include "utils/Variant.h" @@ -233,7 +234,23 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu // Read and parse key efiSystemPartitionSize if ( configurationMap.contains( "efiSystemPartitionSize" ) ) { - gs->insert( "efiSystemPartitionSize", CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" ) ); + const QString sizeString = CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" ); + CalamaresUtils::Partition::PartitionSize part_size = CalamaresUtils::Partition::PartitionSize( sizeString ); + if ( part_size.isValid() ) + { + gs->insert( "efiSystemPartitionSize", sizeString ); + gs->insert( "efiSystemPartitionSize_i", part_size.toBytes() ); + + if ( part_size.toBytes() != PartUtils::efiFilesystemMinimumSize() ) + { + cWarning() << "EFI partition size" << sizeString << "has been adjusted to" + << PartUtils::efiFilesystemMinimumSize() << "bytes"; + } + } + else + { + cWarning() << "EFI partition size" << sizeString << "is invalid, ignored"; + } } // Read and parse key efiSystemPartitionName diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 4460bda3e..836994439 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -471,8 +471,12 @@ bool isEfiFilesystemSuitableSize( const Partition* candidate ) { auto size = candidate->capacity(); // bytes + if ( size <= 0 ) + { + return false; + } - if ( size >= efiFilesystemMinimumSize() ) + if ( size_t( size ) >= efiFilesystemMinimumSize() ) { return true; } @@ -521,7 +525,19 @@ size_t efiFilesystemMinimumSize() { using CalamaresUtils::Units::operator""_MiB; - return 300_MiB; + + auto uefisys_part_sizeB = 300_MiB; + auto* gs = Calamares::JobQueue::instance()->globalStorage(); + if ( gs->contains( "efiSystemPartitionSize_i" ) ) + { + uefisys_part_sizeB = gs->value( "efiSystemPartitionSize_i" ).toLongLong(); + } + // There is a lower limit of what can be configured + if ( uefisys_part_sizeB < 32_MiB ) + { + uefisys_part_sizeB = 32_MiB; + } + return uefisys_part_sizeB; } diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index 422c1d38f..8514bbe2c 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -118,14 +118,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO if ( isEfi ) { - int uefisys_part_sizeB = 300_MiB; - if ( gs->contains( "efiSystemPartitionSize" ) ) - { - CalamaresUtils::Partition::PartitionSize part_size - = CalamaresUtils::Partition::PartitionSize( gs->value( "efiSystemPartitionSize" ).toString() ); - uefisys_part_sizeB = part_size.toBytes( dev->capacity() ); - } - + size_t uefisys_part_sizeB = PartUtils::efiFilesystemMinimumSize(); qint64 efiSectorCount = CalamaresUtils::bytesToSectors( uefisys_part_sizeB, dev->logicalSize() ); Q_ASSERT( efiSectorCount > 0 ); From d556dae415befd38b237f63659681ebb1b14464a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 18:22:56 +0200 Subject: [PATCH 31/32] [partition] Document how the configurable EFI size is coordinated --- src/modules/partition/Config.cpp | 16 +++++++++------- src/modules/partition/core/PartUtils.cpp | 3 +++ src/modules/partition/core/PartUtils.h | 6 ++++++ src/modules/partition/partition.conf | 6 ++++++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/modules/partition/Config.cpp b/src/modules/partition/Config.cpp index e383b3a73..05975213e 100644 --- a/src/modules/partition/Config.cpp +++ b/src/modules/partition/Config.cpp @@ -235,16 +235,18 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu if ( configurationMap.contains( "efiSystemPartitionSize" ) ) { const QString sizeString = CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" ); - CalamaresUtils::Partition::PartitionSize part_size = CalamaresUtils::Partition::PartitionSize( sizeString ); - if ( part_size.isValid() ) + CalamaresUtils::Partition::PartitionSize part_size + = CalamaresUtils::Partition::PartitionSize( sizeString ); + if (part_size.isValid()) { - gs->insert( "efiSystemPartitionSize", sizeString ); - gs->insert( "efiSystemPartitionSize_i", part_size.toBytes() ); + // Insert once as string, once as a size-in-bytes; + // changes to these keys should be synchronized with PartUtils.cpp + gs->insert( "efiSystemPartitionSize", sizeString ); + gs->insert( "efiSystemPartitionSize_i", part_size.toBytes()); - if ( part_size.toBytes() != PartUtils::efiFilesystemMinimumSize() ) + if (part_size.toBytes() != PartUtils::efiFilesystemMinimumSize()) { - cWarning() << "EFI partition size" << sizeString << "has been adjusted to" - << PartUtils::efiFilesystemMinimumSize() << "bytes"; + cWarning() << "EFI partition size" << sizeString << "has been adjusted to" << PartUtils::efiFilesystemMinimumSize() << "bytes"; } } else diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 836994439..507330a80 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -527,6 +527,9 @@ efiFilesystemMinimumSize() using CalamaresUtils::Units::operator""_MiB; auto uefisys_part_sizeB = 300_MiB; + + // The default can be overridden; the key used here comes + // from the partition module Config.cpp auto* gs = Calamares::JobQueue::instance()->globalStorage(); if ( gs->contains( "efiSystemPartitionSize_i" ) ) { diff --git a/src/modules/partition/core/PartUtils.h b/src/modules/partition/core/PartUtils.h index 102c70087..31b4cde84 100644 --- a/src/modules/partition/core/PartUtils.h +++ b/src/modules/partition/core/PartUtils.h @@ -100,6 +100,12 @@ bool isEfiFilesystemSuitableSize( const Partition* candidate ); * and EFI documentation (and not a little discussion in Calamares * issues about what works, what is effective, and what is mandated * by the standard and how all of those are different). + * + * This can be configured through the `partition.conf` file, + * key *efiSystemPartitionSize*, which will then apply to both + * automatic partitioning **and** the warning for manual partitioning. + * + * A minimum of 32MiB (which is bonkers-small) is enforced. */ size_t efiFilesystemMinimumSize(); diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 899eb6269..b03c855db 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -10,6 +10,12 @@ efiSystemPartition: "/boot/efi" # This optional setting specifies the size of the EFI system partition. # If nothing is specified, the default size of 300MiB will be used. +# +# This size applies both to automatic partitioning and the checks +# during manual partitioning. A minimum of 32MiB is enforced, +# 300MiB is the default, M is treated as MiB, and if you really want +# one-million (10^6) bytes, use MB. +# # efiSystemPartitionSize: 300M # This optional setting specifies the name of the EFI system partition (see From bcad6981647eadc32050d8ef967509a86d0e9847 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 23:33:43 +0200 Subject: [PATCH 32/32] Changes: post-release housekeeping --- CHANGES | 13 +++++++++++++ CMakeLists.txt | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 773f05e57..b668e2496 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,19 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. +# 3.2.45 (unreleased) # + +This release contains contributions from (alphabetically by first name): + - No external contributors yet + +## Core ## + - No core changes yet + +## Modules ## + - The *partition* module now consistently uses the configured EFI + partition size (defaults to 300MiB). + + # 3.2.44.2 (2021-09-27) # This release contains contributions from (alphabetically by first name): diff --git a/CMakeLists.txt b/CMakeLists.txt index 58a06db81..01ff932af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,11 +41,11 @@ # TODO:3.3: Require CMake 3.12 cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) project( CALAMARES - VERSION 3.2.44.2 + VERSION 3.2.45 LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development ### OPTIONS #