Blame ecryptfs-utils-111-cve_2016_5224.patch

62db13
=== modified file 'src/utils/ecryptfs-setup-swap'
62db13
--- a/src/utils/ecryptfs-setup-swap	2015-08-04 15:42:02 +0000
62db13
+++ a/src/utils/ecryptfs-setup-swap	2016-07-06 22:31:21 +0000
62db13
@@ -166,8 +166,14 @@
62db13
 	# If this is a GPT partition, mark it as no-auto mounting, to avoid
62db13
 	# auto-activating it on boot
62db13
 	if [ "$(blkid -p -s PART_ENTRY_SCHEME -o value "$swap")" = "gpt" ]; then
62db13
-		drive="${swap%[0-9]*}"
62db13
-		partno="${swap#$drive}"
62db13
+		# Correctly handle NVMe/MMC drives, as well as any similar physical
62db13
+		# block device that follow the "/dev/foo0p1" pattern (LP: #1597154)
62db13
+		if echo "$swap" | grep -qE "^/dev/.+[0-9]+p[0-9]+$"; then
62db13
+			drive=$(echo "$swap" | sed "s:\(.\+[0-9]\)p[0-9]\+:\1:")
62db13
+		else
62db13
+			drive=$(echo "$swap" | sed "s:\(.\+[^0-9]\)[0-9]\+:\1:")
62db13
+		fi
62db13
+		partno=$(echo "$swap" | sed "s:.\+[^0-9]\([0-9]\+\):\1:")
62db13
 		if [ -b "$drive" ]; then
62db13
 			if printf "x\np\n" | fdisk "$drive" | grep -q "^$swap .* GUID:.*\b63\b"; then
62db13
 				echo "$swap is already marked as no-auto"
62db13