From 796c00fb03e50e9b8642ddf6104e1ca0794e975d Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sun, 3 May 2026 15:45:55 +0100 Subject: [PATCH] fix(install): add early systemd detection to prevent mid-install failures - Enhance `handle_systemd()` to check for `/run/systemd/system` and exit early if systemd is not PID 1, with user-friendly error messages. - Update README.md notes for Devuan and SYSTEMD_MODE to reflect the new behavior and clarify requirements. --- README.md | 4 ++-- install_sdrplay_universal.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 16e0372..69f8f70 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Other derivatives are detected automatically via the `ID_LIKE` field in `/etc/os - Debian 13 - NOTE: The Debian project is no longer using a standard package name for `libasound2`. Not to worry, apt will automatically select the `libasound2t64` packages it needs. For all derivative distributions, therefore, the package name will remain "libasound2". - Devuan 6.1 Excalibur - - NOTE: the server-mode installation will not work here, because Devuan does not support systemd) + - NOTE: server-mode installation is unavailable here, because Devuan does not use systemd. The installer detects this and refuses `SYSTEMD_MODE=install` up front rather than failing mid-install. - Manjaro - Fedora 44 - OpenMandriva 6 @@ -60,7 +60,7 @@ The script will present the SDRPlay license agreement and prompt for acceptance - `ACCEPTLICENSE=1` — Skip the interactive license prompt - `DONOTDOWNLOAD=1` — Use local tarballs instead of downloading (place them in the current directory). Also skips the upstream lookup (build hashes and licence text); pin filenames with the override variables below - `NOTSUPPORTED=1` — Skip dependency checks entirely (install them yourself) -- `SYSTEMD_MODE=install SYSTEMD_TARGET=sdrconnectserver` — Enable the server systemd service +- `SYSTEMD_MODE=install SYSTEMD_TARGET=sdrconnectserver` — Enable the server systemd service (requires systemd as PID 1; refuses to run otherwise) - `SDRCONNECT_GITBUILD=` — Pin the SDRconnect build hash, bypassing the upstream lookup - `RIGCONTROL_GITBUILD=` — Pin the RigControl build hash, bypassing the upstream lookup diff --git a/install_sdrplay_universal.sh b/install_sdrplay_universal.sh index a9f22a3..30af5a1 100755 --- a/install_sdrplay_universal.sh +++ b/install_sdrplay_universal.sh @@ -584,6 +584,16 @@ handle_systemd() { return fi + # systemd creates /run/systemd/system when it is PID 1. Bail out early on + # non-systemd inits (Devuan, Artix-openrc/runit, Slackware, etc.) so we + # don't fail mid-install and trigger the rollback trap. + if [[ ! -d /run/systemd/system ]]; then + error "SYSTEMD_MODE=$mode requested, but systemd is not the active init on this system." + error "Re-run without SYSTEMD_MODE (or with SYSTEMD_MODE=skip) and configure the" + error "service manually using your distro's init system (sysvinit, openrc, runit, ...)." + exit 1 + fi + # Only resolve target if we actually need it local target="${SYSTEMD_TARGET:-}"