Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenBSD 7.5 compatibility #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ radio signals, usually with an attached antenna. And at least the audio
jack is basically an AD converter.

## Installation instructions
For details about the installation, read [INSTALL.md](INSTALL.md).
For details about the installation, read [INSTALL.md](INSTALL.md). For
instructions about updating the OpenBSD release, read
[UPDATE.md](UPDATE.md). The UPDATE.md also documents how to set up and
maintain/sync an OpenBSD mirror in the internal network.

Compatible OpenBSD versions: 7.2 to 7.5

## Required Hardware
* 2x Raspberry Pi 4B
Expand Down
76 changes: 76 additions & 0 deletions UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Updating OpenBSD

Updating OpenBSD can break the diode if the installed Python3 packages are not updated along with the main release.

## Upgrade Sender

To update OpenBSD on the diode, first update the sender:

1. First upgrade to the newest OpenBSD release:
```sh
sysupgrade
```
1. When the system is available again, upgrade the installed packages:
```sh
pkg_add -u
```
1. Check if the sender scripts works as expected:
```sh
rcctl check diode_send
```

## Transfer Files through Diode

1. Download the tgz files for updating OpenBSD:
```sh
BSD_VERSION=7.5
wget -nH -nc -r --no-parent https://cdn.openbsd.org/pub/OpenBSD/$BSD_VERSION/arm65/ -R "index.html*" --reject iso,img
```
1. Move files to diode directory:
```sh
mv ./pub /var/www/diode
```
1. To download all required packages, including dependencies, for running the receiver program, edit the `/etc/openbsd-mirror.conf`:
```
[OpenBSD]
version = 7.5

[aarch64]
py3-serial = *
bash = *
zsh = *
nano = *
xz = *
bzip2 = *
```
You can add additional packages for other architectures as well, for example `amd64`. The file will be updated with the downloaded versions. This will allow the script to download updates if they become available in the mirrors.
1. To start the download, execute the `download_packages` program:
```sh
download_packages --config /etc/openbsd-mirror.conf --directory /home/download/packages
```
1. Move or copy the downloaded packages to the diode directory:
```sh
cp -rp /home/download/packages/pub /var/www/diode/
```
1. Wait until all files are transferred.
1. Clean file chunks on the receiver:
```sh
cd /var/www/diode
find . -name "*-part_*" -delete
```

## Set Up OpenBSD Mirror on Receiver

## Upgrade Receiver
1. First upgrade to the newest OpenBSD release:
```sh
sysupgrade
```
1. When the system is available again, upgrade the installed packages:
```sh
pkg_add -u
```
1. Check if the sender scripts works as expected:
```sh
rcctl check diode_send
```
6 changes: 3 additions & 3 deletions bin/download_packages
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def package_path(stable, os_version, arch, package_filename):
"""
Build path to package file in local file system
"""

return os.path.join(ARGS.directory, "pub/OpenBSD/", os_version, packages_dir(stable),
arch, package_filename)
directory = os.path.join(ARGS.directory, "pub/OpenBSD/", os_version, packages_dir(stable), arch)
Path(directory).mkdir(parents=True, exist_ok=True)
return os.path.join(directory, package_filename)

def packages_dir(stable):
"""
Expand Down
3 changes: 2 additions & 1 deletion etc/rc.d/diode_receive
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ daemon_flags="--directory /var/www/diode --device /dev/cuaU0 --arduino /dev/cuaU
pexp="python3 \/usr\/local\/bin\/diode_receive(.*)

rc_start() {
${rcexec} "${daemon} ${daemon_flags} 2>&1 &"
logger "Starting diode receiver with flags ${daemon_flags}"
rc_exec "${daemon} ${daemon_flags} &"
}

rc_cmd $1
3 changes: 2 additions & 1 deletion etc/rc.d/diode_send
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ daemon_flags="--directory /var/www/diode --device /dev/cuaU0"
pexp="python3 \/usr\/local\/bin\/diode_send(.*)"

rc_start() {
${rcexec} "${daemon} ${daemon_flags} 2>&1 &"
logger "Starting diode sender with flags ${daemon_flags}"
rc_exec "${daemon} ${daemon_flags} &"
}

rc_cmd $1