Tree


LICENSEcommits | blame
README.mdcommits | blame
mysysupgrade.shcommits | blame
sysupgrade*commits | blame
sysupgrade_setscommits | blame

README.md

# -*- coding: utf-8 -*-


# Introduction

For several years, I've been using a customized version of [sysupgrade](https://man.openbsd.org/sysupgrade) to avoid deploying all OpenBSD sets across my different machines. This adapted script has been working flawlessly since several years now for my needs. I hope it will be useful for you too.  

Here’s an example of `/etc/sysupgrade_sets` on my OpenBSD system, which is connected to my Hi-Fi system which runs on a very small machine having limited memory and disk space:

    obsd:~# cat /etc/sysupgrade_sets
    -game*  # Exclude game sets
    -xs*    # Exclude X server and X share sets, but keep xbase
    -xf*    # Exclude X font sets

As shown, comments are allowed, and the syntax is similar to the installation process. This file specifies which sets to download and install.

# My sysupgrade Script

You can download [my custom sysupgrade script here](https://repo.vincentdelft.be/mysysupgrade.git/) or use the following commands:

    obsd:~# TODO ftp https://vincentdelft.be/static/post/post_20241101/mysysupgrade.ksh
    obsd:~# ksh mysysupgrade.ksh

Like the default version, this script needs to be run with `ksh`.


# Using My sysupgrade Script

Here’s a walkthrough of using the script to upgrade an OpenBSD 7.5 server. You can see the steps it performs:

    obsd: ~ # ksh mysysupgrade.ksh
    Fetching from https://cdn.openbsd.org/pub/OpenBSD/7.6/amd64/
    SHA256.sig   100% |*************************************************************************|  2324       00:00
    Signature Verified
    BUILDINFO    100% |*************************************************************************|    54       00:00
    Verifying old sets.
    The following files will be downloaded: INSTALL.amd64 base76.tgz bsd bsd.mp bsd.rd comp76.tgz man76.tgz xbase76.tgz
    old file: INSTALL.amd64 base75.tgz bsd bsd.mp bsd.rd comp75.tgz man75.tgz xbase75.tgz
    INSTALL.amd64 100% |************************************************************************| 44889       00:00
    base76.tgz   100% |*************************************************************************|   414 MB    00:38
    bsd          100% |*************************************************************************| 28007 KB    00:03
    bsd.mp       100% |*************************************************************************| 28139 KB    00:03
    bsd.rd       100% |*************************************************************************|  4600 KB    00:02
    comp76.tgz   100% |*************************************************************************| 81512 KB    00:08
    man76.tgz    100% |*************************************************************************|  8039 KB    00:04
    xbase76.tgz  100% |*************************************************************************| 60681 KB    00:10
    Verifying sets.
    Fetching updated firmware.
    fw_update: add none; update intel,inteldrm,vmm|
    Reboot now ?(Y/n) n
    obsd: ~ # 

The script creates an `/auto_upgrade.conf` file, simulating the manual input you would typically provide during an upgrade. Here’s a look:

    Location of sets = disk
    Pathname to the sets = /mnt/home/_sysupgrade/
    Set name(s) = -game*
    Set name(s) = -xs*
    Set name(s) = -xf*
    Directory does not contain SHA256.sig. Continue without verification = yes

This configuration specifies the sets’ location and excludes game, xs, and xf sets based on `/etc/sysupgrade_sets`. The installation script installs only what is in `/mnt/home/_sysupgrade`.

The script also ensures that `/bsd.upgrade` is prepared and protected with the `700` permission:

    obsd:~# ls -al /bsd.upgrade
    -rwx------  1 root  wheel  4710411 Oct 31 14:42 /bsd.upgrade

To complete the upgrade, reboot the machine:

    obsd:~# reboot

If you have console access, you can monitor the process. Otherwise, wait a few minutes for the upgrade and a final reboot.


# Final Steps for usual upgrade process

After rebooting, complete the upgrade by running usual commands :

    obsd:~# sysmerge
    obsd:~# pkg_add -u

Although the upgrade script includes a first-boot `sysmerge`, it might not cover all changes to customized files. Package updates can take longer depending on your internet speed and the number of installed packages. Once everything is up-to-date, reboot the system again:

    obsd:~# reboot


My customized `sysupgrade` has suited my needs perfectly, and I hope it does the same for you!


"""