Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Fix how we do major updates / branch changes.
Browse files Browse the repository at this point in the history
Do the package downloading after rebooting with new kernel, in order
to make sure we can run the new pkg ABI
  • Loading branch information
Kris Moore committed Nov 11, 2013
1 parent 3f8190c commit 65f3853
Showing 1 changed file with 52 additions and 17 deletions.
69 changes: 52 additions & 17 deletions src-sh/pc-updatemanager/pc-updatemanager
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DOWNLOADDIR="/usr/local/tmp"
SYSVER="`uname -r | cut -d '-' -f 1-2`" ; export SYSVER

# Get the system type
SYSTYPE="`pbreg get /PC-BSD/SysType`" ; export SYSTYPE
SYSTYPE="`/usr/local/bin/pbreg get /PC-BSD/SysType`" ; export SYSTYPE

# Set the config location
UPDATECONF="${PROGDIR}/conf/sysupdate.conf"
Expand Down Expand Up @@ -413,6 +413,56 @@ rollback_update()
fi
}

# After installing the kernel and rebooting, this gets run
finish_major_fbsd_update() {

PATH="${PATH}:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
export PATH

echo "Installing FreeBSD updates... Please wait..."
freebsd-update --non-interactive install
if [ $? -ne 0 ] ; then
echo "Warning: Failed running freebsd-update install!"
echo "Press ENTER to continue"
read tmp
fi

# Lets pre-download all packages
echo "Downloading updated packages..."
download_cache_packages "pkg-static upgrade -fn"
if [ $? -ne 0 ] ; then
echo "Warning: Failed running 'pkg-static upgrade -fn'"
echo "Press ENTER to continue"
read tmp
fi

# Now its time to force a pkg-update of all packages to their new FreeBSD compiled versions
SKIP_CACHE_PKGS="YES" ; export SKIP_CACHE_PKGS
pc-updatemanager pkgupdate -f
if [ $? -ne 0 ] ; then
echo "Warning: Failed running 'pc-updatemanager pkgupdate -f'"
echo "Press ENTER to continue"
read tmp
fi

# Last but not least, lets make sure to re-stamp GRUB in case any loader.conf.pcbsd modules changed
grub-mkconfig -o /boot/grub/grub.cfg
if [ $? -ne 0 ] ; then
echo "Warning: Failed running 'pc-updatemanager pkgupdate -f'"
echo "Press ENTER to continue"
read tmp
fi

echo "Updating overlay files..."
if [ -e "/usr/local/bin/pc-softwaremanager" ] ; then
pc-extractoverlay desktop
else
pc-extractoverlay server
fi

exit 0
}

start_major_fbsd_update() {
local rel=`echo $1 | sed 's|fbsd-||g'`
PKGROLLBACK="NO"
Expand Down Expand Up @@ -442,15 +492,6 @@ start_major_fbsd_update() {

# Lets install pkgng update
PKGROLLBACK="YES"
echo "Installing pkgng update..."
pkg-static add /usr/local/tmp/pkg.txz

# Lets pre-download all packages
download_cache_packages "pkg-static upgrade -fn"
if [ $? -ne 0 ] ; then
rollback_update
exit_err "Failed downloading packages for update..."
fi

# Download update files from freebsd-update
freebsd-update --non-interactive -r "$rel" upgrade
Expand All @@ -469,13 +510,6 @@ start_major_fbsd_update() {
exit_err "Failed running \"freebsd-update install\"..."
fi

# Now its time to force a pkg-update of all packages to their new FreeBSD compiled versions
SKIP_CACHE_PKGS="YES" ; export SKIP_CACHE_PKGS
pc-updatemanager pkgupdate -f

# Last but not least, lets make sure to re-stamp GRUB in case any loader.conf.pcbsd modules changed
grub-mkconfig -o /boot/grub/grub.cfg

echo "Major update finished!"
echo "Please reboot the system for changes to take effect."
exit 0
Expand Down Expand Up @@ -594,6 +628,7 @@ case $1 in
do_branch "${2}" ;;
pkgcheck) checkup_pkgs ;;
pkgupdate) update_pkgs "$2" ;;
finish-major-update) finish_major_fbsd_update ;;
install) get_update_file
do_install "${2}" ;;
*) show_usage ;;
Expand Down

0 comments on commit 65f3853

Please sign in to comment.