From 4c23d3f3d5ebd616d0f0a40aa12f7844ec4f0e55 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Wed, 1 Jan 2025 18:17:31 -0600 Subject: [PATCH] Refresh patches --- debian/patches/dracut-params.patch | 130 ------------------ ...y-present-with-encryption-partitions.patch | 12 +- debian/patches/series | 1 - .../patches/unmount-encrypted-devices.patch | 49 +++---- 4 files changed, 22 insertions(+), 170 deletions(-) delete mode 100644 debian/patches/dracut-params.patch diff --git a/debian/patches/dracut-params.patch b/debian/patches/dracut-params.patch deleted file mode 100644 index 0f11957..0000000 --- a/debian/patches/dracut-params.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 119f3fb4bda07634aad9b6c6c3790cfb8253ebb0 Mon Sep 17 00:00:00 2001 -From: Simon Quigley -Date: Fri, 22 Nov 2024 16:36:22 -0600 -Subject: [PATCH 1/3] [dracut] Add an options setting for additional Dracut - parameters - ---- - src/modules/dracut/dracut.conf | 5 +++++ - src/modules/dracut/dracut.schema.yaml | 1 + - src/modules/dracut/main.py | 23 +++++++++++++++-------- - 3 files changed, 21 insertions(+), 8 deletions(-) - -diff --git a/src/modules/dracut/dracut.conf b/src/modules/dracut/dracut.conf -index ba1a7b08cb..c3f0c2469c 100644 ---- a/src/modules/dracut/dracut.conf -+++ b/src/modules/dracut/dracut.conf -@@ -8,3 +8,8 @@ - # set a custom name, including the path - # - initramfsName: /boot/initramfs-freebsd.img -+ -+# Optional: define a list of strings to be passed as arguments to Dracut -+# By default, -f is always included -+options: -+ - "-f" -diff --git a/src/modules/dracut/dracut.schema.yaml b/src/modules/dracut/dracut.schema.yaml -index d6008e1bf5..de1114ccc9 100644 ---- a/src/modules/dracut/dracut.schema.yaml -+++ b/src/modules/dracut/dracut.schema.yaml -@@ -7,3 +7,4 @@ additionalProperties: false - type: object - properties: - initramfsName: { type: string } -+ options: { type: array, items: { type: string } } -diff --git a/src/modules/dracut/main.py b/src/modules/dracut/main.py -index 85e6f3e7ff..e987373879 100644 ---- a/src/modules/dracut/main.py -+++ b/src/modules/dracut/main.py -@@ -35,15 +35,22 @@ def run_dracut(): - - :return: - """ -+ # Fetch the job configuration -+ cli_options = ["-f"] -+ initramfs_name = libcalamares.job.configuration.get('initramfsName', None) -+ dracut_options = libcalamares.job.configuration.get('options', []) -+ -+ # Parse the custom options if there are any -+ for option in dracut_options: -+ # Deduplication check -+ if option not in cli_options: -+ cli_options.append(option) -+ -+ if initramfs_name: -+ cli_options.append(initramfs_name) -+ - try: -- initramfs_name = libcalamares.job.configuration['initramfsName'] -- target_env_process_output(['dracut', '-f', initramfs_name]) -- except KeyError: -- try: -- target_env_process_output(['dracut', '-f']) -- except subprocess.CalledProcessError as cpe: -- libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}") -- return cpe.returncode -+ target_env_process_output(['dracut'] + cli_options) - except subprocess.CalledProcessError as cpe: - libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}") - return cpe.returncode - -From 8ea29c271f38a80290a0981b8f51eb5d9f2d25a8 Mon Sep 17 00:00:00 2001 -From: Simon Quigley -Date: Fri, 22 Nov 2024 19:46:32 -0600 -Subject: [PATCH 2/3] [dracut] Ensure the user can remove -f but it stays as - the default - ---- - src/modules/dracut/main.py | 13 +++---------- - 1 file changed, 3 insertions(+), 10 deletions(-) - -diff --git a/src/modules/dracut/main.py b/src/modules/dracut/main.py -index e987373879..9e2bc318f5 100644 ---- a/src/modules/dracut/main.py -+++ b/src/modules/dracut/main.py -@@ -36,21 +36,14 @@ def run_dracut(): - :return: - """ - # Fetch the job configuration -- cli_options = ["-f"] - initramfs_name = libcalamares.job.configuration.get('initramfsName', None) -- dracut_options = libcalamares.job.configuration.get('options', []) -- -- # Parse the custom options if there are any -- for option in dracut_options: -- # Deduplication check -- if option not in cli_options: -- cli_options.append(option) -+ dracut_options = libcalamares.job.configuration.get('options', ['-f']) - - if initramfs_name: -- cli_options.append(initramfs_name) -+ dracut_options.append(initramfs_name) - - try: -- target_env_process_output(['dracut'] + cli_options) -+ target_env_process_output(['dracut'] + dracut_options) - except subprocess.CalledProcessError as cpe: - libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}") - return cpe.returncode - -From 3151eb7c8244020adc594635154c5bb714027dbb Mon Sep 17 00:00:00 2001 -From: Simon Quigley -Date: Fri, 22 Nov 2024 19:47:15 -0600 -Subject: [PATCH 3/3] [dracut] Stylistic update for conf file list - ---- - src/modules/dracut/dracut.conf | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/modules/dracut/dracut.conf b/src/modules/dracut/dracut.conf -index c3f0c2469c..190933bcdd 100644 ---- a/src/modules/dracut/dracut.conf -+++ b/src/modules/dracut/dracut.conf -@@ -11,5 +11,4 @@ initramfsName: /boot/initramfs-freebsd.img - - # Optional: define a list of strings to be passed as arguments to Dracut - # By default, -f is always included --options: -- - "-f" -+options: [ "-f" ] diff --git a/debian/patches/enable-only-present-with-encryption-partitions.patch b/debian/patches/enable-only-present-with-encryption-partitions.patch index e4de39b..f988608 100644 --- a/debian/patches/enable-only-present-with-encryption-partitions.patch +++ b/debian/patches/enable-only-present-with-encryption-partitions.patch @@ -43,7 +43,7 @@ Last-Update: 2024-02-26 // warnings to ensure that all the cases are covered below. @@ -252,6 +259,10 @@ PartitionLayout::createPartitions( Devic availableSectors = totalSectors; - for ( const auto& entry : qAsConst( m_partLayout ) ) + for ( const auto& entry : std::as_const( m_partLayout ) ) { + if ( luksPassphrase.isEmpty() && entry.partOnlyPresentWithEncryption ) { + // this partition is being skipped entirely @@ -54,7 +54,7 @@ Last-Update: 2024-02-26 { @@ -265,6 +276,10 @@ PartitionLayout::createPartitions( Devic // Assign sectors for percentage-defined partitions. - for ( const auto& entry : qAsConst( m_partLayout ) ) + for ( const auto& entry : std::as_const( m_partLayout ) ) { + if ( luksPassphrase.isEmpty() && entry.partOnlyPresentWithEncryption ) { + // this partition is being skipped entirely @@ -65,7 +65,7 @@ Last-Update: 2024-02-26 qint64 sectors @@ -288,6 +303,10 @@ PartitionLayout::createPartitions( Devic availableSectors = totalSectors; - for ( const auto& entry : qAsConst( m_partLayout ) ) + for ( const auto& entry : std::as_const( m_partLayout ) ) { + if ( luksPassphrase.isEmpty() && entry.partOnlyPresentWithEncryption ) { + // this partition is being skipped entirely @@ -94,7 +94,7 @@ Last-Update: 2024-02-26 const QString& minSize = QString(), --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf -@@ -266,6 +266,7 @@ defaultFileSystemType: "ext4" +@@ -316,6 +316,7 @@ lvm: # type: "4f68bce3-e8cd-4db1-96e7-fbcaf984b709" # filesystem: "ext4" # noEncrypt: false @@ -102,7 +102,7 @@ Last-Update: 2024-02-26 # mountPoint: "/" # size: 20% # minSize: 500M -@@ -275,6 +276,7 @@ defaultFileSystemType: "ext4" +@@ -325,6 +326,7 @@ lvm: # type: "933ac7e1-2eb4-4f13-b844-0e14e2aef915" # filesystem: "ext4" # noEncrypt: false @@ -110,7 +110,7 @@ Last-Update: 2024-02-26 # mountPoint: "/home" # size: 3G # minSize: 1.5G -@@ -303,6 +305,7 @@ defaultFileSystemType: "ext4" +@@ -353,6 +355,7 @@ lvm: # default filesystem type, or the user's choice, will be applied instead # of "unknown" (e.g. the user might pick ext4, or xfs). # - noEncrypt: whether this partition is exempt from encryption if enabled (optional parameter; default is false) diff --git a/debian/patches/series b/debian/patches/series index 4445ddf..88d5c36 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,5 +2,4 @@ apport-package-hook.patch enable-only-present-with-encryption-partitions.patch grub-debconf-config.patch -dracut-params.patch unmount-encrypted-devices.patch diff --git a/debian/patches/unmount-encrypted-devices.patch b/debian/patches/unmount-encrypted-devices.patch index 7b53d32..8c56213 100644 --- a/debian/patches/unmount-encrypted-devices.patch +++ b/debian/patches/unmount-encrypted-devices.patch @@ -9,11 +9,9 @@ Subject: [PATCH 1/2] [libcalamares] Add a closeCryptsetup function to properly src/libcalamares/partition/Mount.h | 7 +++++++ 2 files changed, 16 insertions(+) -diff --git a/src/libcalamares/partition/Mount.cpp b/src/libcalamares/partition/Mount.cpp -index 03b776f4be..e4c3d06b94 100644 --- a/src/libcalamares/partition/Mount.cpp +++ b/src/libcalamares/partition/Mount.cpp -@@ -84,6 +84,15 @@ unmount( const QString& path, const QStringList& options ) +@@ -84,6 +84,15 @@ unmount( const QString& path, const QStr return r.getExitCode(); } @@ -29,11 +27,9 @@ index 03b776f4be..e4c3d06b94 100644 struct TemporaryMount::Private { QString m_devicePath; -diff --git a/src/libcalamares/partition/Mount.h b/src/libcalamares/partition/Mount.h -index 3781c4feb2..e197594a1d 100644 --- a/src/libcalamares/partition/Mount.h +++ b/src/libcalamares/partition/Mount.h -@@ -51,6 +51,13 @@ DLLEXPORT int mount( const QString& devicePath, +@@ -51,6 +51,13 @@ DLLEXPORT int mount( const QString& devi */ DLLEXPORT int unmount( const QString& path, const QStringList& options = QStringList() ); @@ -47,26 +43,12 @@ index 3781c4feb2..e197594a1d 100644 /** @brief Mount and automatically unmount a device * - -From f6fc0d19493afbb084f57f81e451c9f0d0844281 Mon Sep 17 00:00:00 2001 -From: Simon Quigley -Date: Fri, 22 Nov 2024 19:38:15 -0600 -Subject: [PATCH 2/2] [umount] After unmounting partitions, close any encrypted - partitions that are still open - ---- - src/modules/umount/UmountJob.cpp | 41 ++++++++++++++++++++++++++++++++ - 1 file changed, 41 insertions(+) - -diff --git a/src/modules/umount/UmountJob.cpp b/src/modules/umount/UmountJob.cpp -index 1e207d9eae..8cc8796ac9 100644 --- a/src/modules/umount/UmountJob.cpp +++ b/src/modules/umount/UmountJob.cpp -@@ -93,6 +93,38 @@ unmountTargetMounts( const QString& rootMountPoint ) - return Calamares::JobResult::ok(); +@@ -94,6 +94,38 @@ unmountTargetMounts( const QString& root } -+static Calamares::JobResult + static Calamares::JobResult +unmountEncryptedPartitions( const QList& partitions ) +{ + // Iterate on each partition in global storage @@ -98,22 +80,23 @@ index 1e207d9eae..8cc8796ac9 100644 + return Calamares::JobResult::ok(); +} + - static Calamares::JobResult ++static Calamares::JobResult exportZFSPools() { -@@ -152,6 +184,15 @@ UmountJob::exec() - } - } - + auto* gs = Calamares::JobQueue::instance()->globalStorage(); +@@ -149,6 +181,15 @@ UmountJob::exec() + if ( !r ) + { + return r; ++ } ++ } ++ + // For encrypted systems, close the partitions + { + auto r = unmountEncryptedPartitions( gs->value("partitions").toList() ); + if ( !r ) + { + return r; -+ } -+ } -+ - // For ZFS systems, export the pools - { - auto r = exportZFSPools(); + } + } +