[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1066646: Proposed patch



The attached patch should re-enable looking just for image files on all
partitions; it does work on our usecase (but I don't know live-boot well
enough to test for every other one).

Thanks in advance,
-- 
Elena ``of Valhalla''
From 4873cd2e22a2107836d442ed9d98edb5a5325182 Mon Sep 17 00:00:00 2001
From: Elena  Grandi <elena@truelite.it>
Date: Thu, 28 Mar 2024 10:35:07 +0100
Subject: [PATCH] Look for persistence files also on blacklisted devices

---
 components/9990-misc-helpers.sh | 42 ++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh
index 122014f..cac5e96 100755
--- a/components/9990-misc-helpers.sh
+++ b/components/9990-misc-helpers.sh
@@ -1104,6 +1104,31 @@ find_persistence_media ()
 			fi
 		fi
 
+		# Probe for directory with matching name on mounted partition
+		if is_in_comma_sep_list directory ${PERSISTENCE_STORAGE}
+		then
+			result=$(probe_for_directory_name "${overlays}" ${dev})
+			if [ -n "${result}" ]
+			then
+				ret="${ret} ${result}"
+				continue
+			fi
+		fi
+
+		# Close luks device if it isn't used
+		if [ -z "${result}" ] && [ -n "${luks_device}" ] && is_active_luks_mapping "${luks_device}"
+		then
+			cryptsetup luksClose "${luks_device}"
+		fi
+	done
+
+        # It is however fine to look for persistence *files* on the black
+        # listed partitions.
+	for dev in $(storage_devices "" "")
+	do
+		local result luks_device
+		result=""
+
 		# Probe for files with matching name on mounted partition
 		if is_in_comma_sep_list file ${PERSISTENCE_STORAGE}
 		then
@@ -1136,23 +1161,6 @@ find_persistence_media ()
 				continue
 			fi
 		fi
-
-		# Probe for directory with matching name on mounted partition
-		if is_in_comma_sep_list directory ${PERSISTENCE_STORAGE}
-		then
-			result=$(probe_for_directory_name "${overlays}" ${dev})
-			if [ -n "${result}" ]
-			then
-				ret="${ret} ${result}"
-				continue
-			fi
-		fi
-
-		# Close luks device if it isn't used
-		if [ -z "${result}" ] && [ -n "${luks_device}" ] && is_active_luks_mapping "${luks_device}"
-		then
-			cryptsetup luksClose "${luks_device}"
-		fi
 	done
 
 	if [ -n "${ret}" ]
-- 
2.43.0

Attachment: signature.asc
Description: PGP signature


Reply to: