From faeac57bf47befd3b3e9bc7ffac34506eb12999f Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sun, 26 Apr 2026 02:57:22 +0200 Subject: [PATCH] feat: add dnf action support --- README.md | 3 ++- STATE.md | 2 ++ bin/netupgrade | 9 +++++++++ config/netupgrade/hypervisor-01.cfg | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 65836fc..88a4d12 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Supported actions: - `apt` - `yum` +- `dnf` - `pkg` - `pacman` - `apk` @@ -40,7 +41,7 @@ Optional log viewer: - otherwise one of: `nano`, `vi`, `less` Remote hosts must also provide the commands needed by the configured actions, such as: -`apt-get`, `yum`, `pkg`, `pacman`, `apk`, `docker`, `docker compose`, or `reboot`. +`apt-get`, `yum`, `dnf`, `pkg`, `pacman`, `apk`, `docker`, `docker compose`, or `reboot`. ## Install diff --git a/STATE.md b/STATE.md index 44ee3a5..0ab5ecd 100644 --- a/STATE.md +++ b/STATE.md @@ -26,6 +26,7 @@ ## Supported actions - `apt` - `yum` +- `dnf` - `pkg` - `pacman` - `apk` @@ -71,6 +72,7 @@ - Log summary generation was rewritten to avoid `sed -i` interpolation and now replaces the log atomically - `apk` and `apt` cleanup behavior was corrected to better match real package-manager semantics - The sample configuration in `config/netupgrade/hypervisor-01.cfg` now keeps the alternate `docker-01` reboot example commented out rather than active by default +- A new `dnf` action was added alongside the existing `yum` action to support newer RPM-based systems without breaking existing configurations ## Change guidance - `STATE.md` should stay focused on current state, architecture, and constraints diff --git a/bin/netupgrade b/bin/netupgrade index c2bb1bf..1053fc1 100755 --- a/bin/netupgrade +++ b/bin/netupgrade @@ -242,6 +242,15 @@ runCmd() { # $1=host $2=name $3=cmd ERROR=1 fi ;; + dnf) + if [ "${YES}" -eq 1 ]; then + YESARG="-y" + fi + echo "dnf ${YESARG} upgrade --refresh" | tee -a "${LOGFILENAME}" + if ! runSSH "${HOST}" dnf ${YESARG} upgrade --refresh | tee -a "${LOGFILENAME}"; then + ERROR=1 + fi + ;; pkg) if [ "${YES}" -eq 1 ]; then YESARG="-y" diff --git a/config/netupgrade/hypervisor-01.cfg b/config/netupgrade/hypervisor-01.cfg index d148e2a..79309b3 100644 --- a/config/netupgrade/hypervisor-01.cfg +++ b/config/netupgrade/hypervisor-01.cfg @@ -4,6 +4,7 @@ NODES+=("10.0.0.101;debian-01;apt;reboot") NODES+=("10.0.0.102;archlinux-01;pacman;reboot") NODES+=("10.0.0.103;alpine-01;apk;reboot") NODES+=("10.0.0.104;redhat-01;yum;reboot") +NODES+=("10.0.0.106;rocky-01;dnf;reboot") NODES+=("10.0.0.105;freebsd-01;pkg;reboot") NODES+=("10.0.0.211;docker-01;docker-stacks:/srv/stacks") #NODES+=("10.0.0.211;docker-01;cmd:reboot")