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

Example way to solve this for mkinitrd ...



Hello, 

I implemented a way to fix this for initrd-tools :

Index: mkinitrd
===================================================================
--- mkinitrd	(revision 4448)
+++ mkinitrd	(working copy)
@@ -1309,7 +1309,7 @@
 CONFDIR=/etc/mkinitrd
 unset keep croot cmkimage out || :
 
-while getopts "d:km:o:r:" flag; do
+while getopts "d:km:o:r:-:" flag; do
 	case $flag in
 	d)
 		CONFDIR="$OPTARG"
@@ -1335,6 +1335,16 @@
 	r)
 		croot=$OPTARG
 		;;
+	-)
+		case ${OPTARG%=*} in
+			supported-host-version)
+				supported_host_version=${OPTARG#*=}
+				;;
+			supported-target-version)
+				supported_target_version=${OPTARG#*=}
+				;;
+		esac
+		;;
 	*)
 		usage
 		;;
@@ -1342,6 +1352,19 @@
 done
 shift $(($OPTIND - 1))
 
+if [ "$supported_host_version" ] || [ "$supported_target_version" ]; then
+	if [ "$supported_host_version" ]; then
+		host_upstream_version=${supported_host_version%%-*}
+	fi
+	if [ "$supported_target_version" ]; then
+		target_upstream_version=${supported_target_version%%-*}
+		if dpkg --compare-versions "$target_upstream_version" ge "2.6.13"; then
+			exit 1
+		fi
+	fi
+	exit 0
+fi
+
 if ! [ $out ] || [ $# -gt 1 ]; then
 	usage
 fi

which altough it may not be the nicest way, fixes the issue. Notice that the
invocation is :

  ./mkinitrd --supported-target-version=2.6.13-1-powerpc --supported-host-version=2.6.12-1-powerpc

Due to the way getopts is implemented in shell, so i guess this should be the
version to use here.

I will implement this in initrd-tools and initramfs-tools in the debian-kernel
svn, but await for comments before doing an upload, Jonas, i would appreciate
if you would be able to do this for yaird asap too, as i don't speak perl,
which i think is what yaird implements, right ?

Friendly,

Sven Luther



Reply to: