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

svn at pcbsd.org svn at pcbsd.org
Thu Mar 15 11:03:05 PDT 2012


Author: kris
Date: 2012-03-15 18:03:04 +0000 (Thu, 15 Mar 2012)
New Revision: 15822

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

Allow us to change meta-pkg sets via CLI option



Modified: pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager
===================================================================
--- pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager	2012-03-15 17:44:42 UTC (rev 15821)
+++ pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager	2012-03-15 18:03:04 UTC (rev 15822)
@@ -29,6 +29,11 @@
 LOGFILE="/tmp/.pc-metapkgmanager.log"
 FTP_PASSIVE_MODE="YES" ; export FTP_PASSIVE_MODE
 
+# The default PKGSET
+PKGSET="pcbsd"
+MPDIR="${DBDIR}/${PKGSET}"
+
+
 display_usage() {
         cat <<EOF
 usage: `basename $0` [options]
@@ -41,9 +46,10 @@
   del pkg1,pkg2	  	 -- Delete the specified list of meta-packages
   list     	         -- List the available meta-packages
   status <pkg>    	 -- List the status of the specified meta-packages
+  --pkgset <pkgset>	 -- Change default pkgset we are using
 
 EOF
-        exit 0
+        exit 1
 }
 
 add_metapkgs() {
@@ -353,27 +359,28 @@
 }
 
 
-# Figure out which meta-pkg set we are working on
-if [ -n "$METAPKGSET" ] ; then
-  PKGSET="$METAPKGSET"
-else
-  PKGSET="pcbsd"
-fi
-if [ ! -d "${DBDIR}/$PKGSET" ] ; then
- echo "No such package set $PKGSET"
- exit 1
-fi
-MPDIR="${DBDIR}/${PKGSET}"
+if [ $# -eq 0 ]; then display_usage; fi
 
+# Parse ye olde cli flags
+while [ $# -gt 0 ]; do
+  case "$1" in
+      list) list_metapkgs ; exit 0 ;;
+       add) parse_metapkgs "$2" "add" "$3" ; exit 0 ;;
+       del) parse_metapkgs "$2" "del" ; exit 0 ;;
+    status) stat_metapkg "$2" ; exit 0 ;;
+  --pkgset) if [ -z "$2" ] ; then display_usage ; fi  
+            PKGSET="$2" 
+            if [ ! -d "${DBDIR}/$PKGSET" ] ; then
+              echo "No such package set $PKGSET"
+              exit 1
+            fi
+            MPDIR="${DBDIR}/${PKGSET}"
+            shift ;;
+         *) display_usage ;;
+    #if [ $# -gt 1 ]; then display_usage; fi
+  esac
+  shift
+done
 
-# Figure out which mode we are running in
-case ${1} in
-   list) list_metapkgs ;;
-   add) parse_metapkgs "$2" "add" "$3" ;;
-   del) parse_metapkgs "$2" "del" ;;
-   status) stat_metapkg "$2" ;;
-   *) display_usage ;;
-esac
-  
 exit 0
 



More information about the Commits mailing list