Changeset 9aa2146


Ignore:
Timestamp:
12/09/13 13:46:40 (13 months ago)
Author:
Kris Moore <kris@…>
Branches:
9.2-release
Children:
1250d393
Parents:
2a26628
Message:

Backport fixes to for pkgng 1.2.x for 9.2

Location:
src-sh
Files:
1 edited
1 moved

Legend:

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

    r9b2e2e6 r9aa2146  
    2626 
    2727# Get the system type 
    28 SYSTYPE="`pbreg get /PC-BSD/SysType`" ; export SYSTYPE 
     28SYSTYPE="`/usr/local/bin/pbreg get /PC-BSD/SysType`" ; export SYSTYPE 
    2929 
    3030# Set the config location 
     
    408408rollback_update() 
    409409{ 
    410   cp /usr/local/etc/pkg.conf.preUpgrade /usr/local/etc/pkg.conf 
     410  cp /tmp/pcbsd.conf.preUpdate.$$ /usr/local/etc/pkg/repos/pcbsd.conf 
    411411  if [ "$PKGROLLBACK" = "YES" ] ; then 
    412412 
    413413  fi 
     414} 
     415 
     416# After installing the kernel and rebooting, this gets run 
     417finish_major_fbsd_update() { 
     418 
     419  PATH="${PATH}:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" 
     420  export PATH 
     421 
     422  echo "Installing FreeBSD updates... Please wait..." 
     423  freebsd-update --non-interactive install 
     424  if [ $? -ne 0 ] ; then 
     425     echo "Warning: Failed running freebsd-update install!" 
     426     echo "Press ENTER to continue" 
     427     read tmp 
     428  fi 
     429 
     430  # Lets pre-download all packages 
     431  echo "Downloading updated packages..." 
     432  download_cache_packages "pkg-static upgrade -fn" 
     433  if [ $? -ne 0 ] ; then 
     434     echo "Warning: Failed running 'pkg-static upgrade -fn'" 
     435     echo "Press ENTER to continue" 
     436     read tmp 
     437  fi 
     438 
     439  # Now its time to force a pkg-update of all packages to their new FreeBSD compiled versions 
     440  SKIP_CACHE_PKGS="YES" ; export SKIP_CACHE_PKGS 
     441  pc-updatemanager pkgupdate -f 
     442  if [ $? -ne 0 ] ; then 
     443     echo "Warning: Failed running 'pc-updatemanager pkgupdate -f'" 
     444     echo "Press ENTER to continue" 
     445     read tmp 
     446  fi 
     447 
     448  # Last but not least, lets make sure to re-stamp GRUB in case any loader.conf.pcbsd modules changed 
     449  grub-mkconfig -o /boot/grub/grub.cfg 
     450  if [ $? -ne 0 ] ; then 
     451     echo "Warning: Failed running 'pc-updatemanager pkgupdate -f'" 
     452     echo "Press ENTER to continue" 
     453     read tmp 
     454  fi 
     455 
     456  echo "Updating overlay files..." 
     457  if [ -e "/usr/local/bin/pc-softwaremanager" ] ; then 
     458    pc-extractoverlay desktop 
     459  else 
     460    pc-extractoverlay server 
     461  fi 
     462 
     463  exit 0 
    414464} 
    415465 
     
    418468  PKGROLLBACK="NO" 
    419469 
    420   # Lets backup the old pkg.conf file 
    421   cp /usr/local/etc/pkg.conf /usr/local/etc/pkg.conf.preUpgrade 
    422  
    423   # Set the new pkg.conf file to the new repo 
     470  # Save the repo file 
     471  cp /usr/local/etc/pkg/repos/pcbsd.conf /tmp/pcbsd.conf.preUpdate.$$ 
     472 
     473  # Set the new pcbsd.conf file to the new repo 
    424474  local arch=`uname -m` 
    425   echo "packagesite: pkg+http://pkg.cdn.pcbsd.org/$rel/$arch" >/usr/local/etc/pkg.conf 
    426   echo "PUBKEY: /usr/local/etc/pkg-pubkey.cert" >>/usr/local/etc/pkg.conf 
    427   echo "PKG_CACHEDIR: /usr/local/tmp" >>/usr/local/etc/pkg.conf 
     475  echo "pcbsd: { 
     476        url: "http://pkg.cdn.pcbsd.org/$rel/$arch", 
     477        signature_type: "fingerprints", 
     478        fingerprints: "/usr/local/etc/pkg/fingerprints/pcbsd", 
     479        enabled: true 
     480       }" > /usr/local/etc/pkg/repos/pcbsd.conf 
    428481 
    429482  # Lets backup old pkgng 
     
    443496  # Lets install pkgng update 
    444497  PKGROLLBACK="YES" 
    445   echo "Installing pkgng update..." 
    446   pkg-static add /usr/local/tmp/pkg.txz 
    447  
    448   # Lets pre-download all packages 
    449   download_cache_packages "pkg-static upgrade -fn" 
    450   if [ $? -ne 0 ] ; then 
    451      rollback_update 
    452      exit_err "Failed downloading packages for update..." 
    453   fi 
    454498 
    455499  # Download update files from freebsd-update 
     
    470514  fi 
    471515 
    472   # Now its time to force a pkg-update of all packages to their new FreeBSD compiled versions 
    473   SKIP_CACHE_PKGS="YES" ; export SKIP_CACHE_PKGS 
    474   pc-updatemanager pkgupdate -f 
    475  
    476   # Last but not least, lets make sure to re-stamp GRUB in case any loader.conf.pcbsd modules changed 
    477   grub-mkconfig -o /boot/grub/grub.cfg  
     516  # Remove backup repo file 
     517  rm /tmp/pcbsd.conf.preUpdate.$$ 
    478518 
    479519  echo "Major update finished!"  
     
    519559checkup_pkgs() { 
    520560 
    521   # Checkout the installed pkgs and compare to master list 
     561  # Update the repo DB 
    522562  rc_halt "pkg-static update" 
     563 
    523564  pkg-static upgrade -n >/tmp/.pkgData.$$ 
     565  if [ $? -ne 0 ] ; then 
     566     echo "Error checking for package updates..." 
     567     exit 1 
     568  fi 
     569 
     570  # Check fr updates now 
    524571  grep -q "Upgrading" /tmp/.pkgData.$$ 
    525572  if [ $? -ne 0 ] ; then 
     
    595642        pkgcheck) checkup_pkgs ;; 
    596643       pkgupdate) update_pkgs "$2" ;; 
     644finish-major-update) finish_major_fbsd_update ;; 
    597645         install) get_update_file 
    598646                  do_install "${2}" ;; 
Note: See TracChangeset for help on using the changeset viewer.