BLog

ImprintImpressum
PrivacyDatenschutz
DisclaimerHaftung
Downloads 

FreeBSD 12.0 has been released - an update log

Updating FreeBSD to another major release is usually straightforward, however, since it is a yearly happening, I happen to forget the very details. On this actual occasion, here comes now the log of the update of a server system from FreeBSD 11.2-RELASE-p6 to FreeBSD 12.0-RELEASE:

mount -rf /
fsck -fy /dev/gpt/SYSTEM
mount /

tmux new "freebsd-update -r 12.0-RELEASE upgrade"

freebsd-update install
shutdown -r now

freebsd-update install
pkg-static install -f pkg
tmux new "~/bin/swr"

freebsd-update install
pwd_mkdb -p /etc/master.passwd
shutdown -r now
#!/bin/sh

# swr - Software Restore shell script

### the list of the ports that shall be updated from sources 
portmake="\
security/cyrus-sasl2 \
devel/subversion \
devel/git \
"

### fetching updates of the FreeBSD ports tree
/usr/bin/printf "\nFetching updates of the FreeBSD ports tree...\n"
/usr/sbin/portsnap fetch update
/usr/sbin/pkg version -v
/usr/sbin/pkg updating -d `date -v-2w +%Y%m%d`

### ask and in case of y|Y run the updating processes
/usr/bin/printf "\nDo you want to continue (y/n)? "
save_stty_state=$(stty -g); stty raw -echo; answer=$(head -c 1); stty $save_stty_state
if echo "$answer" | grep -iq "^y" ; then
   /usr/bin/printf "\n\n"
   /usr/sbin/pkg update

   pkgupgrd=""
   pkgslist="`/usr/sbin/pkg query %o`"
   for pkg in $pkgslist ; do
      for port in $portmake ; do
         if [ "$pkg" == "$port" ] ; then
            continue 2
         fi
      done

      pkgupgrd="$pkgupgrd `/usr/sbin/pkg query %n $pkg`"
   done

   /usr/bin/printf "\nUpdating ports...\n"
   if [ "$portmake" != "" ] ; then
      cwd=$PWD
      py="py27-"

      for port in $portmake ; do
         cd "/usr/ports/$port"
         /usr/bin/make deinstall clean
         if [ "${port#$py}" != "$port" ]; then
            /usr/bin/make FLAVOR=py27 install clean
         else
            /usr/bin/make install clean
         fi
      done

      cd "$cwd"

      rm -rf /usr/ports/distfiles/*
   else
      echo "All installed ports are up-to-date."
   fi

   /usr/bin/printf "\nUpdating binary packages...\n"
   if [ "$pkgupgrd" != "" ] ; then
      /usr/sbin/pkg upgrade -fU $pkgupgrd
   else
      echo "All installed packages are up-to-date."
   fi

   /usr/bin/printf "\nCleaning up...\n"
   /usr/sbin/pkg clean -ay

   /usr/bin/find /usr/ports/distfiles -type f -mtime +4w -delete
   /usr/bin/find /usr/ports/distfiles -type d -depth +0 -and -empty -delete

else

   /usr/bin/printf "\n\n"

fi

Copyright © Dr. Rolf Jansen - 2018-12-11 19:00:42

PROMOTION