OpenBSD 7.2

Page content

OpenBSD 7.2 finally released.

Yesterday, the 53th Relase of OpenBSD got publised, the [Version 7.2)(https://www.openbsd.org/72.html). I’ll upgrade my boxes as usual with the following Script. The most obvious change is the Performance improvement for the Package Mangager, but there is always so more see undeadly

Upgrade Guide

As usual, follow to official Upgrade Guide. You can Upgrade with an USB Stick, ISO Image, PXE Boot or inline (from a running system).

As with other Versions, i have my own upgrade Script for upgrading all my boxes. Use it at your own risk and test it somewhere before you do this on your productive environment.

Upgrade Script

you have been warned … !

copy/paste the section below

cat << 'EOF' > /root/upgrade_to_72.sh
#!/usr/bin/env bash
#
# OpenBSD Upgrade Script - Upgrade from 7.1 to 7.2
#
# Copyright (c) 2022 StockerSolutions / @stoege
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Vars
ver="7.2"
old_ver="7.1"

# Version
version="v0.1 / 2022-10-21 / Stoege"
comment="Let's Upgrade to $ver"

# Path, Helpers, Hello
opwd=$(pwd); cd $(dirname $0); source .helpers; h1 "$comment $version"

check_diskfree () {
  
  h1 "check if 1.1G Disk Free"

  FREE=$(df -k /usr |awk '/usr/{ print $4 }')
  if [[ $FREE -lt 1150000 ]]; then

    FREE=$((FREE / 1024))

    echo
    h6 "you have ${FREE} MB free Diskspace at /usr. Need at least 1.1GB! Exit ..."
    
    h2 "you may wanna remove GENERIC Kernel Stuff?"
    h6 "rm -rf /usr/share/relink/kernel"

    echo
    exit 1

  else

    echo
    echo "more than 1.1 GBs free! Let's proceed ..."
    echo

  fi;

}


prepare () {

  h1 "let's update bsd.rd"

  ftp -o /bsd.rd "https://cdn.openbsd.org/pub/OpenBSD/${ver}/amd64/bsd.rd"

  h1 "let's upgrade to ${ver} ..."

  h1 "cleanup switchd"
  userdel _switchd
  groupdel _switchd
  rm /etc/rc.d/switchd /usr/sbin/switchctl /usr/sbin/switchd \
    /usr/share/man/man4/switch.4 /usr/share/man/man5/switchd.conf.5 \
    /usr/share/man/man8/switchctl.8 /usr/share/man/man8/switchd.8

}

download() {

  local _response=$(sysupgrade -n)

  if [[ $_response == *reboot ]]; then
    h1 "Installed! Let's reboot ..."
    rm /home/_sysupgrade/{xf,xs}*
  else
    h1 "Nothing todo ..."
  fi

}

install() {
  reboot
}

postwork() {

  h1 "let's do some postwork after upgrade to ${ver} ..."

  h2 "make dev"
  cd /dev
  ./MAKEDEV all

  h2 "install boot"
  _boot=$(mount |awk -F'[/ ]' '/ on \/ / {print $3}')
  installboot ${_boot%?}

  h2 "sysmerge"
  sysmerge |tee -a /var/log/upgrade_${ver}.log
  
  h2 "fw_update"
  fw_update -v
  fw_update -v |tee -a /var/log/upgrade_${ver}.log

  h2 "syspatch"
  syspatch |tee -a /var/log/upgrade_${ver}.log

  h2 "pkg_add -Vu"
  pkg_add -Vu |tee -a /var/log/upgrade_${ver}.log

  h2 "python 3.9 now default"
  cd /usr/local/bin/
  ln -sf python3.9 python3
  ln -sf python3.9-config python3-config
  
  h2 "pkg_delete -a"
  pkg_delete -a |tee -a /var/log/upgrade_${ver}.log

  h2 "updatedb &"
  /usr/libexec/locate.updatedb &

  h2 "delete the upgrade script"
  rm /root/upgrade_to_72.sh

  h2 "upgrade done. do one more reboot and check if everything works as expected !"

}

# Main
_ver=$(uname -r)

if [ "$_ver" == "${old_ver}" ]; then

  check_diskfree
  prepare
  download
  install

elif [ "$_ver" == "${ver}" ]; then

  postwork

fi

exit 0
EOF

set permission

chmod u+x /root/upgrade_to_72.sh

run it twice ! 1 time to upgrade, 1 time after reboot to upgrade packages …

/root/upgrade_to_72.sh

behind Proxy …

if you’re ever behind a proxy which blocks some files by Mediatype (ARGHHHH!!!), you can do a workaround

download iso

ftp -o /tmp/install72.iso http://cdn.openbsd.org/pub/OpenBSD/7.2/amd64/install72.iso

mount locally

vnconfig vnd0 /tmp/install72.iso
mount -t cd9660 /dev/vnd0c /mnt

copy the files to /home/_sysupgrade

cp /mnt/7.2/amd64/* /home/_sysupgrade/

… and try the Script again :)

Happy Upgrade !


Any Comments ?

sha256: f9dec7a59180a8e4295911946276edc82baf17373e5130e3023ca7042bc576b1