aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2024-04-30 23:54:26 -0400
committerTheodore Ts'o <tytso@mit.edu>2024-04-30 23:54:26 -0400
commit7480dcacb0b79faf8c7608ce136c37d6cc6e2254 (patch)
tree34ee92f6eed9636ecfb41f267194b30b3163fc7a
parent3ab99d9b6022ffa369e8ce7ae5643a30028d0db1 (diff)
downloade2fsprogs-7480dcacb0b79faf8c7608ce136c37d6cc6e2254.tar.gz
e2scrub: test for the presence of systemd using test -e /run/systemd/system
Debian has a package called "systemctl" which provides a systemctl executable to "manage services without systemd". So test for whether we have a fully functional systemd system by checking for the existence of /run/systemd/system instead testing for the presence of the command named systemctl. Addresses-Debian-Bug: #1070107 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--scrub/e2scrub_all.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in
index fe4dda95a..f0593d8cb 100644
--- a/scrub/e2scrub_all.in
+++ b/scrub/e2scrub_all.in
@@ -161,7 +161,7 @@ mapfile -t targets < <(ls_targets)
for tgt in "${targets[@]}"; do
# If we're not reaping and systemd is present, try invoking the
# systemd service.
- if [ "${reap}" -ne 1 ] && type systemctl > /dev/null 2>&1; then
+ if [ "${reap}" -ne 1 ] && [ -e /run/systemd/system ]; then
svcname="$(escape_path_for_systemd "${tgt}")"
${DBG} systemctl start "${svcname}" 2> /dev/null
res=$?