[arch-projects] [initscripts][PATCH] functions: support UUID tags in /etc/crypttab

Dave Reisner dreisner at archlinux.org
Sat Aug 11 13:19:21 EDT 2012


As per crypttab(5), this is supported. This also adds forward looking support
for PARTUUID, which is valid and should "just work" for GPT partitioned disks.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
Addresses the bug mentioned on the BBS:

https://bbs.archlinux.org/viewtopic.php?pid=1144964

 functions | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/functions b/functions
index e8ff7b8..e6b9af3 100644
--- a/functions
+++ b/functions
@@ -475,6 +475,16 @@ do_unlock_legacy() {
 do_unlock_systemd() {
 	local name=$1 device=$2 password=$3 options=$4 failed=0
 
+	# lazily convert tags to udev symlinks
+	case $device in
+		UUID=*)
+			device=/dev/disk/by-uuid/${device#UUID=}
+			;;
+		PARTUUID=*)
+			device=/dev/disk/by-partuuid/${device#PARTUUID=}
+			;;
+	esac
+
 	if ! /usr/lib/systemd/systemd-cryptsetup attach "$name" "$device" "$password" $options; then
 		failed=1
 	else
-- 
1.7.11.4



More information about the arch-projects mailing list