From 7b6365f710219160b4a64afa5acc86300f537979 Mon Sep 17 00:00:00 2001 From: Sven Seeberg Date: Sat, 1 Jun 2024 16:34:20 +0200 Subject: [PATCH 1/4] Document upgrade to OpenBSD 7.5 --- README.md | 6 +++++- UPDATE.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 UPDATE.md diff --git a/README.md b/README.md index d1a99cc..6fc3ec6 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,11 @@ 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). + +Compatible OpenBSD versions: 7.2 to 7.5 ## Required Hardware * 2x Raspberry Pi 4B diff --git a/UPDATE.md b/UPDATE.md new file mode 100644 index 0000000..28e767f --- /dev/null +++ b/UPDATE.md @@ -0,0 +1,38 @@ +# 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 + + + +## 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 + ``` From ca0baf80632edb0613b87cf6bb69ace48f523f6e Mon Sep 17 00:00:00 2001 From: Sven Seeberg Date: Sat, 1 Jun 2024 18:32:24 +0200 Subject: [PATCH 2/4] Update rc.d scripts --- etc/rc.d/diode_receive | 3 ++- etc/rc.d/diode_send | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/rc.d/diode_receive b/etc/rc.d/diode_receive index 17d89e7..da51421 100755 --- a/etc/rc.d/diode_receive +++ b/etc/rc.d/diode_receive @@ -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 diff --git a/etc/rc.d/diode_send b/etc/rc.d/diode_send index 7ea68cb..2c14bd1 100755 --- a/etc/rc.d/diode_send +++ b/etc/rc.d/diode_send @@ -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 From 24809493c2647d247817a7ea4c628c46713df3d7 Mon Sep 17 00:00:00 2001 From: Sven Seeberg Date: Sat, 1 Jun 2024 18:51:17 +0200 Subject: [PATCH 3/4] Extend update documentation --- README.md | 3 ++- UPDATE.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6fc3ec6..5a99296 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,8 @@ jack is basically an AD converter. ## Installation instructions For details about the installation, read [INSTALL.md](INSTALL.md). For instructions about updating the OpenBSD release, read -[UPDATE.md](UPDATE.md). +[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 diff --git a/UPDATE.md b/UPDATE.md index 28e767f..438104e 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -21,7 +21,45 @@ To update OpenBSD on the diode, first update the sender: ## 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 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: From 192066847ca1985bf397815a11c8124161eb8d27 Mon Sep 17 00:00:00 2001 From: Sven Seeberg Date: Sat, 1 Jun 2024 19:51:31 +0200 Subject: [PATCH 4/4] Create directory for packages, fix #16 --- UPDATE.md | 2 +- bin/download_packages | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UPDATE.md b/UPDATE.md index 438104e..51085a9 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -30,7 +30,7 @@ To update OpenBSD on the diode, first update the sender: ```sh mv ./pub /var/www/diode ``` -1. To download all required packages for running the receiver program, edit the `/etc/openbsd-mirror.conf`: +1. To download all required packages, including dependencies, for running the receiver program, edit the `/etc/openbsd-mirror.conf`: ``` [OpenBSD] version = 7.5 diff --git a/bin/download_packages b/bin/download_packages index 0b08b05..fc96621 100644 --- a/bin/download_packages +++ b/bin/download_packages @@ -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): """