[PC-BSD Commits] r21476 - pcbsd/current/src-sh/pc-metapkgmanager

svn at pcbsd.org svn at pcbsd.org
Tue Feb 12 09:28:16 PST 2013


Author: kris
Date: 2013-02-12 17:28:16 +0000 (Tue, 12 Feb 2013)
New Revision: 21476

Modified:
   pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager
Log:

Speed up and fix how we detect meta-pkg status with pkgng



Modified: pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager
===================================================================
--- pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager	2013-02-12 15:43:40 UTC (rev 21475)
+++ pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager	2013-02-12 17:28:16 UTC (rev 21476)
@@ -230,27 +230,12 @@
 	if [ -z "$myPkg" ] ; then exit_err "No FreeBSD package specified for meta-pkg: ${1}" ; fi
 	_mpkg=$1
 
-	found=1
-	nfound=0
-
 	# Parse pkg db to see if pkgs are installed
-	list=$(pkg query "%n")
-
-	pName=${myPkg%-*}
-	case $'\n'$list$'\n' in
-		*$'\n'"$pName"$'\n'*) found=0 ;;
-		*) nfound=1 ;;
- 	esac
-
-	if [ "$found" = "0" -a "$nfound" = "0" ] ; then
+	pkg query "%n" | grep -q "^$myPkg"
+	if [ $? -eq 0 ] ; then
 		echo "The meta-pkg $_mpkg is installed"
 		return 0
-	fi
-	if [ "$found" = "0" -a "$nfound" = "1" ] ; then
-		echo "The meta-pkg $_mpkg is partially installed"
-		return 1
-	fi
-	if [ "$found" = "1" ] ; then
+	else
 		echo "The meta-pkg $_mpkg is not installed"
 		return 255
 	fi



More information about the Commits mailing list