SVN: rc-scripts/trunk/rc.d/init.d/functions

glen glen at pld-linux.org
Thu Apr 24 00:31:51 CEST 2008


Author: glen
Date: Thu Apr 24 00:31:50 2008
New Revision: 9720

Modified:
   rc-scripts/trunk/rc.d/init.d/functions
Log:
- handle also `uname -r` returning "2.6.25-1"

Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions	(original)
+++ rc-scripts/trunk/rc.d/init.d/functions	Thu Apr 24 00:31:50 2008
@@ -156,14 +156,17 @@
 		IFS='.'
 		set -- $v
 		IFS=$old_IFS
-		ver=${3%_*}
-		while [ ${#ver} -lt 3 ] ; do ver="0$ver" ; done
+
+		# strip _* or -* from versions like: "2.6.25_vanilla-1", "2.6.25-1"
+		ver=${3%[-_]*}
+
+		while [ ${#ver} -lt 3 ]; do ver="0$ver"; done
 		ver="$2$ver"
-		while [ ${#ver} -lt 6 ] ; do ver="0$ver" ; done
+		while [ ${#ver} -lt 6 ]; do ver="0$ver"; done
 		ver="$1$ver"
-		while [ ${#ver} -lt 9 ] ; do ver="0$ver" ; done
+		while [ ${#ver} -lt 9 ]; do ver="0$ver"; done
 		echo $ver
-	} </proc/version
+	} < /proc/version
 }
 
 kernelverser()


More information about the pld-cvs-commit mailing list