[arch-projects] [RFC 11/23] Support literal (-o/--opt) options in the options list

Matthew Monaco dgbaley27 at 0x01b.net
Fri May 18 12:22:05 EDT 2012


From: Matthew Monaco <matthew.monaco at 0x01b.net>

This is needed so we don't break existing configs. The approach here is
to allow these intermixed with the comma separated key=value pairs.
---
 cryptmount.sh |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/cryptmount.sh b/cryptmount.sh
index 7e89bbc..e86323b 100755
--- a/cryptmount.sh
+++ b/cryptmount.sh
@@ -373,7 +373,7 @@ ct_resolve_device() {
 
 ct_parse_options() {
 
-	local IFS=',' optlst="$*" opt key val
+	local IFS=',' optlst="$*" opt key val depr=0
 
 	for opt in $optlst; do
 
@@ -382,6 +382,17 @@ ct_parse_options() {
 		case "$opt" in
 			"")
 				continue;;
+			-*)
+				if [ $depr -eq 0 ]; then
+					info "You are using a deprecated format for the options field. The entire"
+					info " field will be passed directly to cryptsetup. Please use the more"
+					info " standardized comma-deliminated options list instead. This format"
+					info " will be removed in a future version of cryptmount/crypttab!"
+					depr=1
+				fi
+				args="$args $opt"
+				continue
+				;;
 			*=*)
 				key="${opt%%=*}"
 				val="${opt#*=}"
-- 
1.7.10.2



More information about the arch-projects mailing list