1266 check-environment.sh should check for pkg5 build num of 1.1
authorAlasdair Lumsden <al@everycity.co.uk>
Sun, 24 Jul 2011 21:53:01 +0100
changeset 429 3052dfe666db
parent 428 4c075ab55cbc
child 430 d1cdc8bca584
1266 check-environment.sh should check for pkg5 build num of 1.1
tools/check-environment.sh
--- a/tools/check-environment.sh	Sun Jul 24 15:01:51 2011 +0100
+++ b/tools/check-environment.sh	Sun Jul 24 21:53:01 2011 +0100
@@ -61,22 +61,19 @@
 # is pkg the right version?
 check_pkg_ver()
 {
-	ver="`pkg list pkg://openindiana.org/package/pkg | awk \
-		'BEGIN{SKIP=1}(SKIP==1){SKIP=0;next}{print $2}'`"
+	ver="`/usr/bin/pkg list -H pkg:/package/pkg | \
+		/usr/bin/awk '{print $2}' | /usr/bin/sed 's/.*-//g'`"
 	resp="can't determine goodness"
 
-	case "$ver" in
-		0.5.11-0.*)
-			pkgver="`echo $ver | cut -d- -f2 | cut -d. -f2`"
-			;;
-		*)
+	okver=1.1
+	ok=`echo "if ($ver >= $okver) r=1 ; if ($ver < $okver) r=2 ; r" | bc`
+
+	case "$ok" in
+		2)
+			resp="too old"
 			;;
-	esac
-
-	case "$pkgver" in
-		[0-9][0-9][0-9])
-			resp="too old"
-			[ "$pkgver" -ge 151 ] && resp="ok"
+		1)
+			resp="ok"
 			;;
 		*)
 			;;