[PC-BSD Commits] r21199 - in pcbsd/current/src-sh/pc-updatemanager: . conf

svn at pcbsd.org svn at pcbsd.org
Fri Jan 25 11:57:47 PST 2013


Author: kris
Date: 2013-01-25 19:57:47 +0000 (Fri, 25 Jan 2013)
New Revision: 21199

Modified:
   pcbsd/current/src-sh/pc-updatemanager/conf/sysupdate.conf
   pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager
Log:

Large update to the pc-updatemanager util.

1. Switch to using a single HTTP pull for updates
   This fixes issues for users of proxys that cant do FTP
   Also cuts down on number of times we have to fetch
2. Simplify the patchfile creation / distribution process
3. Start adding framework for doing "freebsd-update" updates

This is NOT finished, only the stand-alone updates are working ATM. Still
chewing on how we will do FreeBSD updates / PC-BSD minor updates. 



Modified: pcbsd/current/src-sh/pc-updatemanager/conf/sysupdate.conf
===================================================================
--- pcbsd/current/src-sh/pc-updatemanager/conf/sysupdate.conf	2013-01-25 16:42:41 UTC (rev 21198)
+++ pcbsd/current/src-sh/pc-updatemanager/conf/sysupdate.conf	2013-01-25 19:57:47 UTC (rev 21199)
@@ -1,31 +1,21 @@
 # Configuration settings for PC-BSD Updater Service
 # Change with care! Messing with this may break your updates!
-#
-# NOTE: Proxy settings are in /usr/local/etc/pcbsd.conf
 
 #  Set this variable to the server you wish to pull system updates from
 #  Needs to be a "fetchable" HTTP or FTP URL
-UPDATESERVER: ftp://sysupdate.pcbsd.org/pub/system-updates/patchset
+UPDATESERVER: http://updates.pcbsd.org
 
-# The patch set you wish to pull, normally "pcbsd" or "pcbsdtest"
-PATCHSET: pcbsd
+# The patch set you wish to pull, normally "updates" or "test-updates"
+PATCHSET: updates
 
-# Which updates to check for
-# ALL - Major Version Changes, Pkg Updates
-# MINOR - Pkg Updates
-UPDATETYPE: ALL
-
-# Patch data will be pulled down as a .tgz file, which contains upgrade 
-# data files (.upd) for your version of PC-BSD
+# Patch data will be pulled down as a .upd file, which contains upgrade 
+# information for PC-BSD
 #
 # EXAMPLE:
 #
-# If UPDATESERVER is http://sysupdate.pcbsd.org and PATCHSET is pcbsd 
+# If UPDATESERVER is http://updates.pcbsd.org and PATCHSET is update
 # then the download URL would look something like this:
 #
-#  ftp://sysupdate.pcbsd.org/patch-pcbsd-7.0.1-i386.tgz
-#      ^^ SERVER                    ^^^^ SET
-#                                         ^^^^ PC-BSD Version
-#                                               ^^^ System Architecture
+#  http://updates.pcbsd.org/update.upd
 
 

Modified: pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager
===================================================================
--- pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager	2013-01-25 16:42:41 UTC (rev 21198)
+++ pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager	2013-01-25 19:57:47 UTC (rev 21199)
@@ -5,8 +5,16 @@
 # Source our functions
 . /usr/local/share/pcbsd/scripts/functions.sh
 
+# Set the program location
 PROGDIR="/usr/local/share/pcbsd/pc-updatemanager" ; export PROGDIR
 
+# Start by sourcing /etc/profile
+# This grabs any HTTP_ / FTP_ PROXY variables
+. /etc/profile
+
+PCBSD_ETCCONF="/usr/local/etc/pcbsd.conf"
+export PCBSD_ETCCONF
+
 # Set the pub openssl key
 SKEY="${PROGDIR}/conf/security.key" ; export SKEY
 
@@ -16,6 +24,9 @@
 # Get the system version we are checking for updates to
 SYSVER="`pbreg get /PC-BSD/Version`" ; export SYSVER
 
+# Get the made date for this system
+SYSMDATE="`pbreg get /PC-BSD/mdate`" ; export SYSMDATE
+
 # Set the config location
 UPDATECONF="${PROGDIR}/conf/sysupdate.conf"
 
@@ -28,10 +39,10 @@
 # Patchset Data
 PATCHSERVER="`cat ${UPDATECONF} | grep '^UPDATESERVER:' | cut -d ' ' -f 2`"
 PATCHSET="`cat ${UPDATECONF} | grep '^PATCHSET:' | cut -d ' ' -f 2`"
-PATCHFILE="patch-${PATCHSET}-${SYSVER}-${ARCH}.tgz"
+PATCHFILE="${PATCHSET}.upd"
 PATCHURL="${PATCHSERVER}/${PATCHFILE}"
 PATCHTMPDIR=`mktemp -d /tmp/.sysupdateXXXXXX`
-PATCHTMPFILE="${PATCHTMPDIR}/sysupdate-${SYSVER}.tgz"
+PATCHTMPFILE="${PATCHTMPDIR}/sysupdate-${SYSVER}.upd"
 
 MUSTAGEDIR="${DOWNLOADDIR}/update-stagedir"
 
@@ -40,19 +51,11 @@
 
 if [ ! -d "${DOWNLOADDIR}" ]; then mkdir -p ${DOWNLOADDIR}; fi
 
-# Set the mirror URL
-get_mirror
-MIRRORURL="$VAL"
 
 # Trigger File for Tray Application
 TRIGGERFILE="/tmp/.sysupdatetraytrigger"
 
 DBDIR="/var/db/pc-updatemanager"
-if [ `id -u` != "0" ] ; then
-	AVAILDIR=`mktemp -d /tmp/.sysavailXXXXXX`
-else
-	AVAILDIR="${DBDIR}/available"
-fi
 INSDIR="${DBDIR}/installed"
 IGNDIR="${DBDIR}/ignored"
 
@@ -116,7 +119,7 @@
 # Run-command, halt if command exits with non-0
 rc_halt()
 {
-  CMD="$1"
+  CMD="$@"
 
   if [ -z "${CMD}" ] ; then
     exit_err "Error: missing argument in rc_halt()"
@@ -129,223 +132,243 @@
   fi
 }
 
-do_check() {
+get_update_file() {
 
-	# Now fetch the update file
-    	get_file "${PATCHURL}" "${PATCHTMPFILE}" 3
-	if [ "$?" = "0" ] ; then
-	  # If we have new update-data file, extract it
- 	  cd ${AVAILDIR}/${SYSVER}
+  # Now fetch the update file
+  get_file "${PATCHURL}" "${PATCHTMPFILE}" 1 >/dev/null 2>/dev/null
+  if [ $? -ne 0 ] ; then
+     rm ${PATCHTMPFILE} 2>/dev/null
+     is_net_up
+     if [ $? -eq 0 ] ; then 
+       echo "No updates available for $SYSVER!" ; exit 0 
+     else
+       exit_err "Could not contact update server!"
+     fi
+  fi
 
-	  # Remove old .upd data files
-  	  rm * >/dev/null 2>/dev/null
+  # Now fetch the update file signature
+  get_file "${PATCHURL}.sha1" "${PATCHTMPFILE}.sha1" 1 >/dev/null 2>/dev/null
+  if [ $? -ne 0 ] ; then
+     rm ${PATCHTMPFILE}.sha1 2>/dev/null
+     is_net_up
+     if [ $? -eq 0 ] ; then 
+       echo "No updates available for $SYSVER!" ; exit 0 
+     else
+       exit_err "Could not contact update server!"
+     fi
+  fi
 
-  	  # Extract the patch data 
-  	  tar xvzf ${PATCHTMPFILE} >/dev/null 2>/dev/null
+  # Lets verify the signature of the file
+  openssl dgst -sha1 -verify ${SKEY} \
+	-signature ${PATCHTMPFILE}.sha1 \
+        ${PATCHTMPFILE} >/dev/null 2>/dev/null
+  if [ $? -ne 0 ] ; then
+     rm ${PATCHTMPFILE} 2>/dev/null
+     rm ${PATCHTMPFILE}.sha1 2>/dev/null
+     exit_err "Update file failed verification..."
+  fi
 
-  	  # Remove patchset data, done with it for now
-  	  rm -f ${PATCHTMPFILE}
-          rm -rf ${PATCHTMPDIR} 
-	else
-		# If not root, cleanup tmp AVAILDIR
-		if [ `id -u` != "0" ] ; then 
-			if [ -n "$AVAILDIR" -a "$AVAILDIR" != "/" ] ; then
-				rc_halt "rm -rf ${AVAILDIR}"
-			fi
-		fi
+  # Done with the signature we can discard
+  rm ${PATCHTMPFILE}.sha1
 
-		is_net_up
-		if [ $? -eq 0 ] ; then 
-			echo "No updates available for $SYSVER!" ; exit 0 
-		else
-			exit_err "Could not contact update server!"
-		fi
-	fi
+}
 
-	# Setup our variable, we have no patches so far
-	PATCHFOUND="0" 
+do_check() {
+  # Setup our variable, we have no patches so far
+  PATCHFOUND="0" 
 
-	# CD to the patch directory for this version
-	cd "${AVAILDIR}/${SYSVER}"
+  while read line
+  do
+     echo $line | grep -q "^MU:"
+     if [ $? -eq 0 ] ; then
+        parse_mu_update_line "$line"
+        continue
+     fi
+     echo $line | grep -q "^SA:"
+     if [ $? -eq 0 ] ; then
+        parse_sa_update_line "$line"
+        continue
+     fi
+  done < ${PATCHTMPFILE}
 
-	# Check if we have a major version to update
-	if [ -e "major-update" ] ; then
-	  openssl dgst -sha1 -verify ${SKEY} \
-	  	-signature major-update.sha1 \
-              	major-update >/dev/null 2>/dev/null
-	  if [ $? -eq 0 ] ; then
-	    echo "The following updates are available:"
-	    echo "------------------------------------"
-	    pVer=`cat major-update | grep "^Version:" | sed 's|Version: ||g'`
-	    pDate=`cat major-update | grep "^Date:" | sed 's|Date: ||g'`
-	    pDet=`cat major-update | grep "^DetailsURL:" | sed 's|DetailsURL: ||g'`
-	    pTag="release-${pVer}"
-	    PATCHFOUND="`expr ${PATCHFOUND} + 1`" 
-	    echo "NAME: System Update to ${pVer}" 
-	    echo "TYPE: SYSUPDATE" 
-	    echo "VERSION: ${pVer}" 
-	    echo "DATE: ${pDate}" 
-	    echo "TAG: ${pTag}" 
-  	    echo "DETAILS: ${pDet}" 
-  	    echo ""
-  	    echo "To install this update run \"${0} install ${pTag}\""
-  	    echo ""
-	  fi
-	fi
+  # If no patches
+  if [ "${PATCHFOUND}" = "0" ]; then 
+     # No available updates
+     echo "Your system is up to date!"
+  fi
 
-	echo ""
+  rm ${PATCHTMPFILE}
 
-	# Now check which stand-alone updates are available
-	for i in `ls *.upd 2>/dev/null`
-	do
-   	  if [ ! -e "${INSDIR}/${SYSVER}/${i}" ]
-   	  then
-      	      # Now lets check if this .upd file is valid via the sha1 file
-	      openssl dgst -sha1 -verify ${SKEY} \
-	  	-signature ${i}.sha1 \
-              	${i} >/dev/null 2>/dev/null
-	      if [ $? -eq 0 ] ; then
-		if [ $PATCHFOUND -eq 0 ] ; then
-		  echo "The following updates are available:"
-		  echo "------------------------------------"
-		fi
-	        PATCHFOUND="`expr ${PATCHFOUND} + 1`" 
-		pName=`cat ${i} | grep "^Name:" | sed 's|Name: ||g'`
-		pDate=`cat ${i} | grep "^Date:" | sed 's|Date: ||g'`
-		pSize=`cat ${i} | grep "^Size:" | sed 's|Size: ||g'`
-		pSA=`cat ${i} | grep "^StandAlone:" | sed 's|StandAlone: ||g'`
-		pRR=`cat ${i} | grep "^RequiresReboot:" | sed 's|RequiresReboot: ||g'`
-		pDet=`cat ${i} | grep "^DetailsURL:" | sed 's|DetailsURL: ||g'`
-		pTag=`echo ${i} | sed 's|\.upd||g'`
-		echo "NAME: ${pName}" 
-	        echo "TYPE: PATCH" 
-		echo "DATE: ${pDate}" 
-	        echo "TAG: ${pTag}"
-		echo "SIZE: ${pSize}" 
-		echo "STANDALONE: ${pSA}" 
-		echo "REQUIRESREBOOT: ${pRR}" 
-		echo "DETAILS: ${pDet}" 
-		echo " "
-		echo "To install this update run \"${0} install ${pTag}\""
-		echo " "
-      	      fi
-   	  fi
-	done 
+};
 
-	# If no patches
-	if [ "${PATCHFOUND}" = "0" ]
-	then 
-	  # No available updates
-  	  echo "Your system is up to date!"
-	fi
-	# If not root, cleanup tmp AVAILDIR
-	if [ `id -u` != "0" ] ; then rm -rf "${AVAILDIR}" ; fi
-	exit 0
+parse_mu_update_line()
+{
+   local line="$1"
+
+   # Check if this is a major update we can install
+   local sysUpOVer=`echo $line | cut -d ':' -f 2`
+   local sysUpNVer=`echo $line | cut -d ':' -f 3`
+
+   # Is this an update for our version?
+   if [ `uname -r` != "$sysUpOVer" ] ; then return; fi
+
+   if [ $PATCHFOUND -eq 0 ] ; then
+      echo ""
+      echo "The following updates are available:"
+      echo "------------------------------------"
+   fi
+   echo "NAME: FreeBSD System Update to ${sysUpNVer}" 
+   echo "TYPE: SYSUPDATE" 
+   echo "TAG: fbsd-${sysUpNVer}"
+   echo "VERSION: ${sysUpNVer}" 
+   echo ""
+   echo "To install: \"pc-updatemanager install fbsd-${sysUpNVer}\""
+   echo ""
+   echo ""
+
+   PATCHFOUND="`expr ${PATCHFOUND} + 1`" 
 }
 
-# Make sure we aren't doing stand-alone apps at same time
-sanity_check_updates() {
-	hRelease=no
-	hSalone=no
-	tot=0
-	for up in `echo $1 | sed 's|,| |g'`
-	do
-	  tot=`expr $tot + 1`
-  	  echo $up | grep "release-" >/dev/null 2>/dev/null
-	  if [ $? -eq 0 ] ; then 
-	    mV=`cat ${AVAILDIR}/${SYSVER}/major-update | grep "^Version:" | sed 's|Version: ||g'`
-	    if [ "$up" != "release-$mV" ] ; then
-	      exit_err "Invalid major release for update!"
-            fi
-	    hRelease=yes 
-            continue
-          fi	
+parse_sa_update_line()
+{
+   local line="$1"
 
-	  # If this is a pkg update
-	  if [ "$up" = "pkg-updates" ] ; then continue ; fi
+   # Check if this is an update we can install
+   local saVer=`echo $line | cut -d ':' -f 2`
+   local saArch=`echo $line | cut -d ':' -f 3`
+   local saPlat=`echo $line | cut -d ':' -f 4`
+   local saIdent="`echo $line | cut -d ':' -f 5`"
 
-	  uF="${AVAILDIR}/${SYSVER}/${up}.upd"
-  	  if [ ! -e "${uF}" ] ; then exit_err "Invalid update: ${up}" ; fi  
+   # For this version?
+   if [ "$SYSVER" != "$saVer" ] ; then return ; fi
+   # For this system arch?
+   if [ "$ARCH" != "$saArch" -a "$saArch" != "noarch" ] ; then return ; fi
+   # Already installed?
+   if [ -e "${INSDIR}/${SYSVER}/$saIdent" ] ; then return ; fi
 
-	  # See if this update must be standlone
-	  pSA=`cat ${uF} | grep "^StandAlone:" | sed 's|StandAlone: ||g'`
-	  if [ "$pSA" = "YES" ] ; then hSalone="yes" ; fi
-	
-	done
+   if [ $PATCHFOUND -eq 0 ] ; then
+      echo ""
+      echo "The following updates are available:"
+      echo "------------------------------------"
+   fi
+   local saDesc="`echo $line | cut -d ':' -f 6`"
+   local saSize=`echo $line | cut -d ':' -f 8`
 
-        # If doing too many standalones
-	if [ "$hSalone" = "yes" -a $tot -gt 1 ] ; then
-  	  exit_err "One or more updates must be installed stand-alone!"
-	fi
+   echo "NAME: ${saDesc}" 
+   echo "TYPE: PATCH" 
+   echo "TAG: ${saIdent}"
+   echo "SIZE: ${saSize}Mb" 
+   echo " "
+   echo "To install: \"pc-updatemanager install ${saIdent}\""
+   echo " "
 
-	# If doing a new release must be standalone
-	if [ "$hRelease" = "yes" -a $tot -gt 1 ] ; then
-  	  exit_err "Updating to a new release must be done stand-alone!"
-	fi
+   PATCHFOUND="`expr ${PATCHFOUND} + 1`" 
 }
 
 start_pcbsd_patch() {
-	up="$1"
+  local up="$1"
+  local saIdent=""
+  local saVer=""
+  local saArch=""
+  local saPlat=""
+  local saUrl=""
+  local saDesc=""
+  local saCsum=""
+  local patchLine=""
+  if [ -e "${INSDIR}/${SYSVER}/${up}" ]; then 
+     rm ${PATCHTMPFILE}
+     exit_err "Patch $up already installed!"
+  fi
 
-   	if [ -e "${INSDIR}/${SYSVER}/${up}" ]; then 
-	  exit_err "Patch $up already installed!"
-	fi
+  while read line
+  do
+    echo $line | grep -q "^SA:"
+    if [ $? -ne 0 ] ; then continue; fi
+    saIdent="`echo $line | cut -d ':' -f 5`"
+    # Look for the right stand-alone update
+    if [ "$saIdent" != "$up" ] ; then continue ; fi
+    saVer=`echo $line | cut -d ':' -f 2`
+    saArch=`echo $line | cut -d ':' -f 3`
+    saPlat=`echo $line | cut -d ':' -f 4`
+    # Does this update apply to this system arch?
+    if [ "$saArch" != "$ARCH" -a "$saArch" != "noarch" ] ; then 
+       rm ${PATCHTMPFILE}
+       exit_err "Patch $up is not for this system arch type!"
+    fi
+    if [ "$saVer" != "$SYSVER" ] ; then 
+       rm ${PATCHTMPFILE}
+       exit_err "Patch $up is not for this system version!"
+    fi
 
-        # Start downloading the patch
-        UPDFILE="${AVAILDIR}/${SYSVER}/${up}" 
+    # Got here? We have a patch ready to go
+    patchLine="$line"
+    break
+  done < ${PATCHTMPFILE}
 
-        # Set the URL based on file / mirror
-        FILE="`cat ${UPDFILE} | grep '^FileURL:' | cut -d ' ' -f 2`"
-        PATCHNAME="`cat ${UPDFILE} | grep '^Name:' | sed -e 's|: |:|g' | cut -d ':' -f 2`"
-        FILENAME="`basename ${FILE}`"
-        FILEMD5="`cat ${UPDFILE} | grep '^MD5:' | cut -d ' ' -f 2`"
-        FILEURL="${MIRRORURL}${FILE}"
-        FILEURL="`echo ${FILEURL} | sed -e 's|://|:::|g' | sed -e 's|//|/|g' | sed -e 's|:::|://|g'`"       
+  # Did we find the patch?
+  if [ -z "$patchLine" ] ; then 
+     rm ${PATCHTMPFILE}
+     exit_err "Patch $up not found!"
+  fi
 
-	# Start downloading the patch
-        touch ${TRIGGERFILE}
-        echo "DOWNLOADING: ${PATCHNAME}"
-        echo "DOWNLOADING: ${PATCHNAME}" >${TRIGGERFILE}
+  # Get the patch details
+  saVer=`echo $patchLine | cut -d ':' -f 2`
+  saArch=`echo $patchLine | cut -d ':' -f 3`
+  saPlat=`echo $patchLine | cut -d ':' -f 4`
+  saIdent="`echo $patchLine | cut -d ':' -f 5`"
+  saDesc="`echo $patchLine | cut -d ':' -f 6`"
+  saUrl="`echo $patchLine | cut -d ':' -f 7`"
+  saCsum="`echo $patchLine | cut -d ':' -f 9`"
+  local FILENAME="`basename $saUrl`"
 
-	# Get the file
-    	get_file "${FILEURL}" "${DOWNLOADDIR}/${FILENAME}" 3
-	if [ $? -ne 0 ] ; then
-          echo "FAILED: ${PATCHNAME}" >${TRIGGERFILE}
-          exit_err "Failed to download: ${PATCHNAME}"
-	fi
+  # Start downloading the patch
+  touch ${TRIGGERFILE}
+  echo "DOWNLOADING: ${saIdent}"
+  echo "DOWNLOADING: ${saIdent}" >${TRIGGERFILE}
 
- 	# Check the md5 checksum
-        if [ "$FILEMD5" != "`md5 -q ${DOWNLOADDIR}/${FILENAME} 2>/dev/null`" ]
-        then
-          # Download MD5 doesn't match! Delete the file
-          rm ${DOWNLOADDIR}/${FILENAME}
-          echo "FAILED: ${PATCHNAME}" >${TRIGGERFILE}
-          exit_err "Failed to download: ${PATCHNAME}"
-        else 
-          echo "DOWNLOADFINISHED: ${PATCHNAME}"
-          echo "DOWNLOADFINISHED: ${PATCHNAME}" >${TRIGGERFILE}
-        fi
+  # Get the file
+  get_file "${MIRRORURL}/${saUrl}" "${DOWNLOADDIR}/${FILENAME}" 1
+  if [ $? -ne 0 ] ; then
+     rm ${PATCHTMPFILE}
+     echo "FAILED: ${saIdent}" >${TRIGGERFILE}
+     exit_err "Failed to download: ${saIdent}"
+  fi
 
-        echo "INSTALLING: ${PATCHNAME}" >${TRIGGERFILE}
-        sleep 4
+  # Check the sha256 checksum
+  if [ "$saCsum" != "`sha256 -q ${DOWNLOADDIR}/${FILENAME} 2>/dev/null`" ]
+  then
+     # Download MD5 doesn't match! Delete the file
+     rm ${PATCHTMPFILE}
+     rm ${DOWNLOADDIR}/${FILENAME}
+     echo "FAILED: ${saIdent}" >${TRIGGERFILE}
+     exit_err "Failed to download: ${saIdent}"
+  else 
+     echo "DOWNLOADFINISHED: ${saIdent}"
+     echo "DOWNLOADFINISHED: ${saIdent}" >${TRIGGERFILE}
+  fi
 
-        PATCHTMPDIR="`mktemp -d ${DOWNLOADDIR}/patchInstallXXXXX`"
-        tar xvJf ${DOWNLOADDIR}/${FILENAME} -C ${PATCHTMPDIR} 2>/dev/null
-        cd ${PATCHTMPDIR}
-        sh update.sh
-        if [ $? -eq 0 ]
-        then
-          cp $UPDFILE ${INSDIR}/${SYSVER}/
-          echo "INSTALLFINISHED: ${PATCHNAME}"
-          echo "INSTALLFINISHED: ${PATCHNAME}" >${TRIGGERFILE}
-	else
-          echo "INSTALLFAILED: ${PATCHNAME}" >${TRIGGERFILE}
-	  exit_err "INSTALLFAILED: ${PATCHNAME}"
-        fi
+  echo "INSTALLING: ${saIdent}" >${TRIGGERFILE}
+  sleep 1
 
-        cd ${AVAILDIR}/${SYSVER}
-        rm -rf ${PATCHTMPDIR} 
-        rm ${DOWNLOADDIR}/${FILENAME} >/dev/null 2>/dev/null
+  PATCHTMPDIR="`mktemp -d ${DOWNLOADDIR}/patchInstallXXXXX`"
+  rc_halt "tar xvJf ${DOWNLOADDIR}/${FILENAME} -C ${PATCHTMPDIR}" 2>/dev/null
+  PATCHDIR="$PATCHTMPDIR" ; export PATCHDIR
+  cd ${PATCHTMPDIR}
+  sh update.sh
+  if [ $? -eq 0 ]; then
+     touch "${INSDIR}/${SYSVER}/${saIdent}"
+     echo "INSTALLFINISHED: ${saIdent}"
+     echo "INSTALLFINISHED: ${saIdent}" >${TRIGGERFILE}
+  else
+     rm ${PATCHTMPFILE}
+     rm -rf ${PATCHTMPDIR}
+     rm ${DOWNLOADDIR}/${FILENAME}
+     echo "INSTALLFAILED: ${saIdent}" >${TRIGGERFILE}
+     exit_err "INSTALLFAILED: ${saIdent}"
+  fi
+
+  rc_halt "rm -rf ${PATCHTMPDIR}"
+  rc_halt "rm ${DOWNLOADDIR}/${FILENAME}"
 }
 
 # Make sure we have free space in necessary places for system upgrade
@@ -629,32 +652,34 @@
 	if [ `id -u` != "0" ] ; then exit_err "Must be run as root!" ; fi
 	if [ -z "$1" ] ; then exit_err "No updates specified to install!"; fi
 
-	sanity_check_updates ${1}
-
-	# CD to the patch directory for this version
-	cd ${AVAILDIR}/${SYSVER}
-
 	# Begin to update the selected items
 	for up in `echo $1 | sed 's|,| |g'`
 	do
-
 	  # If this is a major update, start it up!
-  	  echo $up | grep "release-" >/dev/null 2>/dev/null
+  	  echo $up | grep -q "^fbsd-" 
 	  if [ $? -eq 0 ] ; then 
-	    start_major_update "$up"
+	    start_major_fbsd_update "$up"
 	    exit 0
-	  fi
-
-	  # Check if this is a pkg-update request or regular patch
-          if [ "$up" == "pkg-updates" ] ; then
+	  elif [ "$up" == "pkg-updates" ] ; then
+	    # Check if this is a pkg-update request or regular patch
             start_pkg_updates
+            continue
           else
+  	    echo $up | grep -q "^release-" 
+	    if [ $? -eq 0 ] ; then 
+	      start_major_update "$up"
+              continue
+            fi 
+
 	    # Doing regular pcbsd patch
-	    start_pcbsd_patch "${up}.upd"
+	    start_pcbsd_patch "${up}"
+            continue
           fi
+
 	done 
 
         # All Finished!
+        rm ${PATCHTMPFILE}
         exit 0
 }
 
@@ -698,18 +723,6 @@
   exit $result
 }
 
-# Set the program location
-
-# Start by sourcing /etc/profile
-# This grabs any HTTP_ / FTP_ PROXY variables
-. /etc/profile
-
-# Get the default meta package set we are using
-PKGSET="pcbsd"
-PCBSD_ETCCONF="/usr/local/etc/pcbsd.conf"
-_pkgChk="`sed -n 's/PCBSD_METAPKGSET: //p' ${PCBSD_ETCCONF} 2>/dev/null`"
-if [ -n "${_pkgChk}" ] ; then PKGSET="$_pkgChk" ; fi
-
 # Check if we have an update folder for the version we are on
 if [ ! -d "${AVAILDIR}/${SYSVER}" ] ; then mkdir -p ${AVAILDIR}/${SYSVER} ; fi
 
@@ -722,11 +735,15 @@
 fi
 
 case $1 in
-  	   check) do_check ;;
+  	   check) get_mirror
+                  MIRRORURL="$VAL"
+ 		  get_update_file
+                  do_check ;;
 	pkgcheck) checkup_pkgs ;;
        pkgupdate) update_pkgs ;;
- 	 install) # First update our available list with latest from server 
-	  	  ${0} check >/dev/null 2>/dev/null ;
+ 	 install) get_mirror
+                  MIRRORURL="$VAL"
+ 		  get_update_file
                   do_install "${2}" ;;
 	*) show_usage ;;
 esac



More information about the Commits mailing list