[readonly/geninitrd/cryptrootfs: 5/6] - validate options.

draenog draenog at pld-linux.org
Sat Nov 2 19:25:33 CET 2013


commit d98d3b3b8d474bd1f040c59d335a992d8fd26de2
Author: serek <serek at pld-linux.org>
Date:   Fri Oct 8 15:29:32 2004 +0000

    - validate options.
    
    svn-id: @4728

 geninitrd | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
---
diff --git a/geninitrd b/geninitrd
index f653f0c..1bd5eb6 100755
--- a/geninitrd
+++ b/geninitrd
@@ -750,7 +750,7 @@ while [ $# -gt 0 ]; do
 		;;
 	--authtype*)
 		if echo $1 | grep -q '=' ; then
-			AUTHTYPE=`echo $1 | sed 's/^--authtype=//'`
+			AUTHTYPE=`echo $1 | awk -F= '/^--authtype=//'`
 		else
 			AUTHTYPE=$2
 			shift
@@ -853,6 +853,34 @@ if [ -z "$target" -o -z "$kernel" ]; then
 	usage
 fi
 
+if [ -z "$AUTHTYPE" ]; then
+	if [ -n "$KEYDEV" -o -n "$KEYPATH" ]; then
+		usage
+	fi
+elif [ x"$AUTHTYPE" = xfilesystem ]; then
+	if [ -z "$KEYDEV" -o -z "$KEYPATH" ]; then
+		usage
+	fi
+elif [ x"$AUTHTYPE" = xpassphrase ]; then
+	if [ -n "$KEYDEV" -o -n "$KEYPATH" ]; then
+		usage
+	fi
+elif [ x"$AUTHTYPE" = xrawdevice ]; then
+	# FIXME:
+	echo rawdevice not implemented yet && exit 1
+	if [ -z "$KEYDEV" -o -n "$KEYPATH" ]; then
+		usage
+	fi
+elif [ x"$AUTHTYPE" = xparanoid ]; then
+	# FIXME:
+	echo rawdevice not implemented yet && exit 1
+	if [ -z "$KEYDEV" -o -z "$KEYPATH" ]; then
+		usage
+	fi
+else
+	usage
+fi
+
 pack_version="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d",$1,$2)}'`"
 pack_version_long="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d%03d",$1,$2,$3)}'`"
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/4124dbdbb787b00cbc1cc14cc05c0a57d5d12625



More information about the pld-cvs-commit mailing list