[PC-BSD Commits] r7437 - pcbsd/current/pc-metapkgmanager
svn at pcbsd.org
svn at pcbsd.org
Wed Aug 25 10:00:51 PDT 2010
Author: kris
Date: 2010-08-25 10:00:51 -0700 (Wed, 25 Aug 2010)
New Revision: 7437
Modified:
pcbsd/current/pc-metapkgmanager/pc-metapkgmanager.sh
Log:
Update pc-metapkgmanager, now we can supply comma delimited list of meta-pkgs to work on
with add/del. Also commit the "add" functionality, which lets us install pkg files from remote or
from local file-system / media
Modified: pcbsd/current/pc-metapkgmanager/pc-metapkgmanager.sh
===================================================================
--- pcbsd/current/pc-metapkgmanager/pc-metapkgmanager.sh 2010-08-25 16:22:10 UTC (rev 7436)
+++ pcbsd/current/pc-metapkgmanager/pc-metapkgmanager.sh 2010-08-25 17:00:51 UTC (rev 7437)
@@ -32,7 +32,7 @@
usage: `basename $0` [options]
Options:
- add <loc> pkg1,pkg2 -- Add the specified list of meta-packages
+ add pkg1,pkg2 <loc> -- Add the specified list of meta-packages
<loc> should be a FTP / HTTP url where pkg_add
can fetch packages, or an absolute path to
location of pkg files on disk.
@@ -45,7 +45,35 @@
}
add_metapkgs() {
+ if [ -z "$1" ] ; then exit_err "No meta-pkg specified!" ; fi
+ if [ -z "$2" ] ; then exit_err "No pkg location specified!" ; fi
+ if [ ! -e "${MPDIR}/${1}/pkg-list" ] ; then exit_err "No such meta-pkg: $1" ; fi
+ _apkg=$1
+ # Figure out the type of location we are installing from
+ echo $2 | grep -e '^http://' -e '^ftp://' >/dev/null 2>/dev/null
+ if [ "$?" = "0" ] ; then
+ loc="NET"
+ else
+ if [ ! -d "${2}" ] ; then exit_err "The pkg location does not exist!" ; fi
+ loc="PATH"
+ fi
+
+ # Now query pkg_info to confirm each pkg is installed
+ while read pkg
+ do
+ echo "Installing package: $pkg"
+
+ # Start installing the packages now
+ if [ "$loc" = "NET" ] ; then
+ PACKAGESITE="$2" ; export PACKAGESITE
+ pkg_add -r "$pkg"
+ else
+ cd "${2}"
+ pkg_add "${pkg}.tbz"
+ fi
+ done < ${MPDIR}/${_apkg}/pkg-list
+
}
# Delete specified meta-pkg, and packages which it installed that are not used elsewhere
@@ -189,11 +217,26 @@
exit 0
}
+# Read through comma delimited list of meta-pkgs
+parse_metapkgs() {
+ if [ "$2" != "add" -a "$2" != "del" ] ; then
+ exit_err "Internal error, must use add/del for parse_metapkgs"
+ fi
+
+ local list
+ list=`echo "$1" | sed 's|,| |g'`
+ for z in $list
+ do
+ if [ "$2" = "add" ] ; then add_metapkgs "$z" "$3" ; fi
+ if [ "$2" = "del" ] ; then del_metapkgs "$z" ; fi
+ done
+}
+
# Figure out which mode we are running in
case ${1} in
list) list_metapkgs ;;
- add) add_metapkgs "$2" ;;
- del) del_metapkgs "$2" ;;
+ add) parse_metapkgs "$2" "add" "$3" ;;
+ del) parse_metapkgs "$2" "del" ;;
status) stat_metapkg "$2" ;;
*) display_usage ;;
esac
More information about the Commits
mailing list