[PC-BSD Commits] r21849 - in pcbsd/current/src-sh: libsh pc-metapkgmanager pc-updatemanager

svn at pcbsd.org svn at pcbsd.org
Wed Mar 13 21:17:13 PDT 2013


Author: kris
Date: 2013-03-14 04:17:13 +0000 (Thu, 14 Mar 2013)
New Revision: 21849

Modified:
   pcbsd/current/src-sh/libsh/functions.sh
   pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager
   pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager
Log:

Convert pc-metapkgmanager to also use aria2 for downloading packages
before installing via pkgng



Modified: pcbsd/current/src-sh/libsh/functions.sh
===================================================================
--- pcbsd/current/src-sh/libsh/functions.sh	2013-03-14 03:07:55 UTC (rev 21848)
+++ pcbsd/current/src-sh/libsh/functions.sh	2013-03-14 04:17:13 UTC (rev 21849)
@@ -7,6 +7,58 @@
 
 PCBSD_ETCCONF="/usr/local/etc/pcbsd.conf"
 
+download_cache_packages()
+{
+  if [ ! -e "/usr/local/etc/pkg.conf" ] ; then
+    exit_err "No /usr/local/etc/pkg.conf!"
+  fi
+
+  # Tickle pkg update first
+  pkg-static update
+
+  ${1} > /tmp/.pkgUpList.$$
+
+  while read line
+  do
+     lTag=`echo $line | awk '{print $1}'` 
+     case $lTag in
+    Upgrading) pkgList="`echo $line | awk '{print $2}' | sed 's|:||g'`-`echo $line | awk '{print $5}'`.txz $pkgList" ;;
+ Reinstalling) pkgList="`echo $line | awk '{print $2}'`.txz $pkgList" ;;
+   Installing) pkgList="`echo $line | awk '{print $2}' | sed 's|:||g'`-`echo $line | awk '{print $3}'`.txz $pkgList" ;;
+                    *) continue ;;
+     esac
+
+  done < /tmp/.pkgUpList.$$
+  rm /tmp/.pkgUpList.$$
+
+  # Get the PKG_CACHEDIR
+  PKG_CACHEDIR="/var/cache/pkg"
+  cat /usr/local/etc/pkg.conf | grep -q "^PKG_CACHEDIR:"
+  if [ $? -eq 0 ] ; then
+    PKG_CACHEDIR="`grep '^PKG_CACHEDIR:' /usr/local/etc/pkg.conf | awk '{print $2}'`"
+  fi
+  if [ -z "$PKG_CACHEDIR" ] ; then
+     exit_err "Failed getting PKG_CACHEDIR"
+  fi
+
+  cat /usr/local/etc/pkg.conf | grep -q "^packagesite:"
+  if [ $? -eq 0 ] ; then
+    pkgUrl="`grep '^packagesite:' /usr/local/etc/pkg.conf | awk '{print $2}' | cut -d '/' -f 4-`"
+  fi
+
+  if [ ! -d "$PKG_CACHEDIR/All" ] ; then
+     mkdir -p ${PKG_CACHEDIR}/All
+  fi
+
+  for i in $pkgList
+  do
+    get_file_from_mirrors "/${pkgUrl}/All/${i}" "${PKG_CACHEDIR}/All/${i}"
+    if [ $? -ne 0 ] ; then
+      exit_err "Failed downloading: /${pkgUrl}/All/${i}"
+    fi
+  done
+}
+
 get_mirror() {
 
   # Check if we already looked up a mirror we can keep using

Modified: pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager
===================================================================
--- pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager	2013-03-14 03:07:55 UTC (rev 21848)
+++ pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager	2013-03-14 04:17:13 UTC (rev 21849)
@@ -85,12 +85,13 @@
     	  # Wait for QT to open the pipe file
     	  sleep 5
 
-    	  # Tickle pkg update first
-    	  pkg update
   	fi
 
+        # Lets pre-download all packages
+        download_cache_packages "pkg-static install -L -n $pkgName"
+
         # Time to run pkgng and let it install packages!
-	pkg install -yf "$pkgName"
+	pkg install -yLf "$pkgName"
 
 	# Cleanup EVENT_PIPE
   	if [ -n "$PCFETCHGUI" ] ; then
@@ -258,11 +259,6 @@
 	# Set the package add exit status to default of 0
 	_pkgStatus=0
 
-	# Run the update manager first to get packages to latest release
-        if [ "$2" = "add" ] ; then
-		pc-updatemanager pkgupdate
-	fi
-
  	local list
 	list=`echo "$1" | sed 's|,| |g'`	
 	for z in $list

Modified: pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager
===================================================================
--- pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager	2013-03-14 03:07:55 UTC (rev 21848)
+++ pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager	2013-03-14 04:17:13 UTC (rev 21849)
@@ -465,59 +465,6 @@
   return 0
 }
 
-download_cache_packages()
-{
-  if [ ! -e "/usr/local/etc/pkg.conf" ] ; then
-    exit_err "No /usr/local/etc/pkg.conf!"
-  fi
-
-  # Tickle pkg update first
-  pkg-static update
-
-  pkg-static upgrade -L -n ${1} > /tmp/.pkgUpList.$$
-
-  while read line
-  do
-     lTag=`echo $line | awk '{print $1}'` 
-     case $lTag in
-    Upgrading) pkgList="`echo $line | awk '{print $2}' | sed 's|:||g'`-`echo $line | awk '{print $5}'`.txz $pkgList" ;;
- Reinstalling) pkgList="`echo $line | awk '{print $2}'`.txz $pkgList" ;;
-   Installing) pkgList="`echo $line | awk '{print $2}' | sed 's|:||g'`-`echo $line | awk '{print $3}'`.txz $pkgList" ;;
-                    *) continue ;;
-     esac
-
-  done < /tmp/.pkgUpList.$$
-  rm /tmp/.pkgUpList.$$
-
-  # Get the PKG_CACHEDIR
-  PKG_CACHEDIR="/var/cache/pkg"
-  cat /usr/local/etc/pkg.conf | grep -q "^PKG_CACHEDIR:"
-  if [ $? -eq 0 ] ; then
-    PKG_CACHEDIR="`grep '^PKG_CACHEDIR:' /usr/local/etc/pkg.conf | awk '{print $2}'`"
-  fi
-  if [ -z "$PKG_CACHEDIR" ] ; then
-     exit_err "Failed getting PKG_CACHEDIR"
-  fi
-
-  cat /usr/local/etc/pkg.conf | grep -q "^packagesite:"
-  if [ $? -eq 0 ] ; then
-    pkgUrl="`grep '^packagesite:' /usr/local/etc/pkg.conf | awk '{print $2}' | cut -d '/' -f 4-`"
-  fi
-
-  if [ ! -d "$PKG_CACHEDIR/All" ] ; then
-     mkdir -p ${PKG_CACHEDIR}/All
-  fi
-
-  for i in $pkgList
-  do
-    get_file_from_mirrors "/${pkgUrl}/All/${i}" "${PKG_CACHEDIR}/All/${i}"
-    if [ $? -ne 0 ] ; then
-      exit_err "Failed downloading: /${pkgUrl}/All/${i}"
-    fi
-  done
-}
-
-
 update_pkgs()
 {
   if [ -n "$1" -a "$1" != "-f" ] ; then
@@ -537,7 +484,7 @@
   fi
 
   # Lets pre-download all the packages
-  download_cache_packages "$1"
+  download_cache_packages "pkg-static upgrade -L -n $1"
 
   # Start the package update!
   pkg-static upgrade -L -y ${1}



More information about the Commits mailing list