Skip to content

Commit 49b2f4a

Browse files
authored
Merge pull request #50 from ActiDoo/codex/investigate-testfailures-in-container-tests
Skip systemctl reload in packaging scripts when systemd inactive
2 parents f3c34e8 + 77c97f9 commit 49b2f4a

File tree

7 files changed

+58
-6
lines changed

7 files changed

+58
-6
lines changed

docs/STATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383
the expected paths while gracefully skipping when no container runtime is
8484
available. The harness now shares the host cgroup namespace so systemd boots
8585
reliably on modern cgroup v2 hosts.
86+
- Maintainer scripts now confirm a live systemd control socket exists before
87+
attempting to reload units, suppressing noisy failures when packages are
88+
installed into containers or chroots without an active init system while
89+
preserving the reload behaviour on real hosts.
8690
- A top-level `Makefile` now standardises local builds, cross-compilation for
8791
`amd64`/`arm64`, and wraps `nfpm` so developers can reproducibly stage
8892
binaries in `dist/` and generate `.deb`/`.rpm` packages without ad-hoc

packaging/scripts/deb/postinst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ set -eu
44
TMPFILES_CONF="/usr/lib/tmpfiles.d/clusterrebootd.conf"
55

66
systemd_active() {
7-
[ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1
7+
if ! command -v systemctl >/dev/null 2>&1; then
8+
return 1
9+
fi
10+
11+
if [ ! -S /run/systemd/private ]; then
12+
return 1
13+
fi
14+
15+
return 0
816
}
917

1018
case "$1" in

packaging/scripts/deb/postrm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
set -eu
33

44
systemd_active() {
5-
[ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1
5+
if ! command -v systemctl >/dev/null 2>&1; then
6+
return 1
7+
fi
8+
9+
if [ ! -S /run/systemd/private ]; then
10+
return 1
11+
fi
12+
13+
return 0
614
}
715

816
case "$1" in

packaging/scripts/deb/prerm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
set -eu
33

44
systemd_active() {
5-
[ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1
5+
if ! command -v systemctl >/dev/null 2>&1; then
6+
return 1
7+
fi
8+
9+
if [ ! -S /run/systemd/private ]; then
10+
return 1
11+
fi
12+
13+
return 0
614
}
715

816
case "$1" in

packaging/scripts/rpm/postinstall.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ set -eu
44
TMPFILES_CONF="/usr/lib/tmpfiles.d/clusterrebootd.conf"
55

66
systemd_active() {
7-
[ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1
7+
if ! command -v systemctl >/dev/null 2>&1; then
8+
return 1
9+
fi
10+
11+
if [ ! -S /run/systemd/private ]; then
12+
return 1
13+
fi
14+
15+
return 0
816
}
917

1018
if [ "$1" -ge 1 ]; then

packaging/scripts/rpm/postremove.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
set -eu
33

44
systemd_active() {
5-
[ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1
5+
if ! command -v systemctl >/dev/null 2>&1; then
6+
return 1
7+
fi
8+
9+
if [ ! -S /run/systemd/private ]; then
10+
return 1
11+
fi
12+
13+
return 0
614
}
715

816
if [ "$1" -eq 0 ]; then

packaging/scripts/rpm/preremove.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
set -eu
33

44
systemd_active() {
5-
[ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1
5+
if ! command -v systemctl >/dev/null 2>&1; then
6+
return 1
7+
fi
8+
9+
if [ ! -S /run/systemd/private ]; then
10+
return 1
11+
fi
12+
13+
return 0
614
}
715

816
if [ "$1" -eq 0 ]; then

0 commit comments

Comments
 (0)