Changeset 02f5b7c


Ignore:
Timestamp:
05/09/13 13:41:00 (16 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
aa93327
Parents:
2bba3b7
Message:

Improve the major update functionality. Now we will pre-cache all the packages / update
data first, then start the install of both world + packages at the end.

If it fails at any step, it will roll-back the update, undoing changes to PKGNG

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/pc-updatemanager/pc-updatemanager

    ra3b102b r02f5b7c  
    360360} 
    361361 
     362rollback_update() 
     363{ 
     364  cp /usr/local/etc/pkg.conf.preUpgrade /usr/local/etc/pkg.conf 
     365  if [ "$PKGROLLBACK" = "YES" ] ; then 
     366 
     367  fi 
     368} 
     369 
    362370start_major_fbsd_update() { 
    363371  local rel=`echo $1 | sed 's|fbsd-||g'` 
     372  PKGROLLBACK="NO" 
    364373 
    365374  # Lets backup the old pkg.conf file 
     
    372381  echo "PKG_CACHEDIR: /usr/local/tmp" >>/usr/local/etc/pkg.conf 
    373382 
     383  # Lets backup old pkgng 
     384  oPkg=`pkg info pkg | awk '{print $1}'` 
     385  pkg create -o /usr/local/tmp/ ${oPkg} 
     386  if [ -e "/usr/local/tmp/oldPkg.txz" ] ; then rm /usr/local/tmp/oldPkg.txz; fi 
     387  mv /usr/local/tmp/${oPkg}.txz /usr/local/tmp/oldPkg.txz 
     388 
     389  # Lets download the new pkgng for this release 
     390  if [ -e "/usr/local/tmp/pkg.txz" ] ; then rm /usr/local/tmp/pkg.txz; fi 
     391  pc-pkg getfile -o /usr/local/tmp/pkg.txz /packages/$rel/$arch/Latest/pkg.txz 
     392  if [ $? -ne 0 ] ; then 
     393     rollback_update 
     394     exit_err "Failed downloading pkgng update..." 
     395  fi 
     396 
     397  # Lets install pkgng update 
     398  PKGROLLBACK="YES" 
     399  echo "Installing pkgng update..." 
     400  pkg-static add /usr/local/tmp/pkg.txz 
     401 
    374402  # Lets pre-download all packages 
    375   download_cache_packages "pkg upgrade -f" 
     403  download_cache_packages "pkg-static upgrade -fn" 
     404  if [ $? -ne 0 ] ; then 
     405     rollback_update 
     406     exit_err "Failed downloading packages for update..." 
     407  fi 
    376408 
    377409  # Download update files from freebsd-update 
    378410  freebsd-update --non-interactive -r "$rel" upgrade 
    379411  if [ $? -ne 0 ] ; then 
    380      cp /usr/local/etc/pkg.conf.preUpgrade /usr/local/etc/pkg.conf 
     412     rollback_update 
    381413     exit_err "Failed running \"freebsd-update -r $rel upgrade\"..." 
    382414  fi 
     
    385417  freebsd-update --non-interactive install 
    386418  if [ $? -ne 0 ] ; then 
    387      cp /usr/local/etc/pkg.conf.preUpgrade /usr/local/etc/pkg.conf 
     419     rollback_update 
    388420     exit_err "Failed running \"freebsd-update install\"..." 
    389421  fi 
     
    392424  pc-updatemanager pkgupdate -f 
    393425 
    394   # Now re-extract overlay files again to grab any new changes from a port we just updated 
    395   if [ "$SYSTYPE" = "PCBSD" ]; then  
    396     pc-extractoverlay desktop 
    397   fi 
    398   if [ "$SYSTYPE" = "TRUEOS" ]; then  
    399     pc-extractoverlay server 
    400   fi 
    401  
    402426  echo "Major update finished!"  
    403427  echo "Please reboot the system for changes to take effect."  
     428  exit 0 
    404429} 
    405430 
Note: See TracChangeset for help on using the changeset viewer.