From 7db96da6159ba48cdde44e64d8bd07092e633f04 Mon Sep 17 00:00:00 2001 From: Vinz Spring Date: Tue, 18 Aug 2026 11:46:27 +0000 Subject: [PATCH 1/2] Fix man page naming so 'man smart-restart' works Man pages must be named .
; the file shipped and installed as smart-restart.man1, which man(1) cannot locate. Rename doc/smart-restart.man1 to doc/smart-restart.1, update MAN_FILE and the sources tarball path in the Makefile, and match the new name in the spec %files entry with a smart-restart.1* glob. Also bump the stale Makefile MINOR to 3 to match the v0.3 tag. --- Makefile | 6 +++--- doc/{smart-restart.man1 => smart-restart.1} | 0 smart-restart.spec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename doc/{smart-restart.man1 => smart-restart.1} (100%) diff --git a/Makefile b/Makefile index a19c2eb..6f4aba5 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ PREFIX?=/usr/bin HOOK_DIR= MAJOR=0 -MINOR=2 +MINOR=3 VERSION=v$(MAJOR).$(MINOR) @@ -24,7 +24,7 @@ CONF_DIR=/etc/smart-restart-conf.d HOOK_ACTION=install.action HOOK_ACTION_TEMPLATE=$(HOOK_ACTION).in DENYLIST_CONF_FILE=default-denylist -MAN_FILE=smart-restart.man1 +MAN_FILE=smart-restart.1 MAN_FILE_LOCATION=/usr/share/man/man1 @@ -37,7 +37,7 @@ all: srpm: sources sources: - tar czf ./smart-restart-v$(VERSION).tar.gz --transform 's,^,smart-restart-v$(VERSION)/,' bin conf Makefile smart-restart.spec doc/smart-restart.man1 + tar czf ./smart-restart-v$(VERSION).tar.gz --transform 's,^,smart-restart-v$(VERSION)/,' bin conf Makefile smart-restart.spec doc/smart-restart.1 install: $(info Dest: $(DEST_DIR)) diff --git a/doc/smart-restart.man1 b/doc/smart-restart.1 similarity index 100% rename from doc/smart-restart.man1 rename to doc/smart-restart.1 diff --git a/smart-restart.spec b/smart-restart.spec index 68c60e1..e3275fb 100644 --- a/smart-restart.spec +++ b/smart-restart.spec @@ -44,7 +44,7 @@ make DEST_DIR=$RPM_BUILD_ROOT pkg_manager=%{pkg_manager} PREFIX=%{_bindir} insta %{_bindir}/%{name}.sh %config %{_sysconfdir}/%{_plugin_path}/install.action %config %{_sysconfdir}/smart-restart-conf.d/default-denylist -%doc %{_mandir}/man1/smart-restart.man1.gz +%doc %{_mandir}/man1/smart-restart.1* %changelog * Wed Mar 06 2024 Stanislav Uschakow - 0.1-1.amzn2023.0.1 From 99d766ab022096c067aa194cbc8bccd7de3eea98 Mon Sep 17 00:00:00 2001 From: Vinz Spring Date: Tue, 18 Aug 2026 11:46:27 +0000 Subject: [PATCH 2/2] Make restart hook discovery quiet and deterministic Hook discovery parsed ls output, printing "ls: cannot access ..." to stderr on every dnf transaction when no optional hook files exist, and word-splitting broke on filenames containing whitespace (SC2207). Use nullglob array assignment instead, and set GLOBSORT=name so hook ordering stays name-sorted even if the caller's environment sets a different glob sort order (bash >= 5.3). --- bin/smart-restart.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/smart-restart.sh b/bin/smart-restart.sh index a72aee9..8fb5d21 100755 --- a/bin/smart-restart.sh +++ b/bin/smart-restart.sh @@ -14,10 +14,12 @@ readonly REBOOT_HINT_PATH=${REBOOT_HINT_PATH:-/run/smart-restart} readonly REBOOT_HINT_MARKER="${REBOOT_HINT_PATH}"/reboot-hint-marker readonly CONF_PATH=${CONF_PATH:-/etc/smart-restart-conf.d} readonly DENYLISTS=("${CONF_PATH}"/*-denylist) -# shellcheck disable=SC2207 -readonly PRE_RESTART=($(ls "$CONF_PATH"/*pre-restart | sort -n)) -# shellcheck disable=SC2207 -readonly POST_RESTART=($(ls "$CONF_PATH"/*post-restart | sort -n)) +# Pin name-sorted glob results (bash >= 5.3 honors GLOBSORT from the environment) +GLOBSORT=name +shopt -s nullglob +readonly PRE_RESTART=("$CONF_PATH"/*pre-restart) +readonly POST_RESTART=("$CONF_PATH"/*post-restart) +shopt -u nullglob SYSCTL_COMMAND="${SYSCTL_COMMAND:-systemctl}" NEEDS_RESTARTING_COMMAND="${NEEDS_RESTARTING_COMMAND:-/usr/bin/needs-restarting}"