LinkedIn Sourceforge

Vincent's Blog

Pleasure in the job puts perfection in the work (Aristote)

Details about my sysupgrade.sh script

Posted on 2021-05-09 12:48:00 from Vincent in OpenBSD

In this post, I'll share some screenshots concerning mysysupgrade.sh script.

This post is linked to the previous one post in October of 2020.

No features has been added, just more details on what it does during the upgrade process


Introduction

I take the hypothesis that you have already read my previous post concerning sysupgrade. In short, the tool proposed by OpenBSD install systematically all possible sets. On several of my machines, I do not need game.tgz, xserv.tgz, xfont.tgz, ...

Moreover the underlying tools used by this sysupgrade provide such features of set selection, so I've just use them in my proposed sysupgrade.sh script.

I encourage you to (re)read my previous post about sysupgrade.

Let's begin with configuration. Adapt /etc/sysupgrade_sets

To better understand the screen shots you will see, let me share the config I'm using on my webserver machine:
i

obsd: ~$ more /etc/sysupgrade_sets  
-x* #remove all X sets
+xbase* #but still keep xbase
-g* #remove games

This config file must contains name of sets you want to select or you want to unselect. You have to think what you type during the initial installation steps.
The list of available sets is documented on the OpenBSD FAQ

Comments, starting with #, are allowed anywhere.

Execution

Do not forget that sysupgrade.sh requires ksh. Do not launch it with sh

obsd:~# ksh sysupgrade.sh
Fetching from https://cdn.openbsd.org/pub/OpenBSD/6.9/amd64/
SHA256.sig   100% |****************************************************************************************|  2144       00:00
Signature Verified
The following files will be downloaded: INSTALL.amd64 base69.tgz bsd bsd.mp bsd.rd comp69.tgz man69.tgz xbase69.tgz
old file: 
INSTALL.amd64 100% |***************************************************************************************| 43523       00:00
base69.tgz   100% |****************************************************************************************|   291 MB    00:10
bsd          100% |****************************************************************************************| 20423 KB    00:02
bsd.mp       100% |****************************************************************************************| 20515 KB    00:02
bsd.rd       100% |****************************************************************************************|  4107 KB    00:01
comp69.tgz   100% |****************************************************************************************| 85958 KB    00:05
man69.tgz    100% |****************************************************************************************|  7560 KB    00:01
xbase69.tgz  100% |****************************************************************************************| 29789 KB    00:04
Verifying sets.
Fetching updated firmware.
Reboot now ?(Y/n)

After this download and verification, you are prompted to reboot immediately or not.
Those files are located in /home/_sysupgrade like official sysupgrade works.

If files are already present, the script will not re-download them.

If verification failed, the script stops.

This script also produce the /auto_upgrade.conf file.
This file is the one used by bsd.upgrade process. You can find details in the manpage
In short, it must contains question = answer

The generated file in my case is:

obsd:~# more /auto_upgrade.conf 
Location of sets = disk
Pathname to the sets = /mnt//home/_sysupgrade/
Set name(s) = -x*
Set name(s) = +xbase*
Set name(s) = -g*
Set name(s) = done
Directory does not contain SHA256.sig. Continue without verification = yes

Only the "Set name(s)" are adapted based on your /etc/systupgrade_sets file. The rest is provided by the original sysupgrade.sh script.

If you look at your / folder, you should see something like this:

obsd:~# ls -al /
total 170944
drwxr-xr-x  14 root  wheel       512 May  7 08:55 .
drwxr-xr-x  14 root  wheel       512 May  7 08:55 ..
drwxr-xr-x   2 root  wheel       512 Oct  5  2020 altroot
-rw-r--r--   1 root  wheel       226 May  7 08:55 auto_upgrade.conf
drwxr-xr-x   2 root  wheel      1024 Oct  5  2020 bin
-rw-r--r--   1 root  wheel     90360 Oct 20  2020 boot
-rwx------   1 root  wheel  20866969 Oct 20  2020 bsd
-rwx------   1 root  wheel  20874353 Oct 20  2020 bsd.booted
-rw-------   1 root  wheel  10393418 Oct 20  2020 bsd.rd
-rw-r--r--   1 root  wheel  15527075 Apr 25  2019 bsd.sp
-rwx------   1 root  wheel   4205670 May  7 08:55 bsd.upgrade
drwxr-xr-x   4 root  wheel     19968 Oct 20  2020 dev
drwxr-xr-x  33 root  wheel      2560 May  7 08:55 etc
drwxr-xr-x   5 root  wheel       512 Oct  5  2020 home
drwxr-xr-x   2 root  wheel       512 Oct  5  2020 mnt
-rw-r--r--   1 root  wheel  15614338 Apr 25  2019 obsd

It's important to verify that bsd.upgrade is "rwx", other else the upgrade process will not start.

Reboot

Then you can reboot your machine. The real upgrade process will begin.

This is a remote machine, so I cannot share the real upgrade process.
But in short, this is the same sequence of screen as if you do it manually.

Remaining tasks

As documented in any upgrade procedure, you still have to perform 2 actions:

sysmerge
pkg_add -u

Conclusions

Hope this clarify what my sysupgrade does and where is differ from the original one.

You can download a new version of my script based on sysupgrade present in OpenBSD 6.9 here



37, 38
displayed: 17239
Comments:

1. From rjc on Sun May 9 13:20:40 2021

Links to your own post are broken - it's _post_, not _posts_ ;^)

2. From rjc on Sun May 9 13:35:18 2021

Given that `SETSDIR` is always an absolute path, you could change: Pathname to the sets = /mnt/${SETSDIR}/ to: Pathname to the sets = /mnt${SETSDIR} in order to get rid of the, IMHO, ugly double slash ('//') in the midle of the path (as well as the trailing one). You might one to rebase your changes onto the current version of the script - 1.44 from a month and a half later - in order to make the diff smaller. Also, no need for the two Copyright lines - simply merge them into one and get rid of the " for OpenBSD 6.8" :^)

3. From Vincent on Sun May 9 14:04:25 2021

Thanks RJC. webpage is now adapted;-). Indeed, the /mnt/$DESTDIR is really specific for one of my machine (where / is read-only, ...). I've removed it from the script. Thanks for your remarks




What is the first vowel of the word Python?