diff options
| author | Michael Biebl <biebl@debian.org> | 2025-02-12 13:46:55 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2025-02-12 13:46:55 +0100 |
| commit | ec170f43021cdc93a65151f4646875cd3aa42a13 (patch) | |
| tree | edd6f226af21951b7b4ae1954308594413610513 /src/tests/check-systemd-unit.sh | |
| parent | d5d9f6796c16f29776c619f464811917e46521f4 (diff) | |
| parent | 8bdf070ff046f482f6eb5e2b15ebc216f5d1e3da (diff) | |
Update upstream source from tag 'upstream/1.51.90'
Update to upstream version '1.51.90' with Debian dir 5ed61494ac9853892cd39fb1e4debd23f234a5b9
Diffstat (limited to 'src/tests/check-systemd-unit.sh')
| -rwxr-xr-x | src/tests/check-systemd-unit.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/check-systemd-unit.sh b/src/tests/check-systemd-unit.sh new file mode 100755 index 00000000..b16f2a33 --- /dev/null +++ b/src/tests/check-systemd-unit.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# SPDX-License-Identifier: LGPL-2.1-or-later + +set -e +set -o pipefail + +if systemd-analyze --offline=true security 2>/dev/null </dev/null; then + + # We're using "security" as opposed to "verify" because (as of 2024) + # the latter doesn't support --offline runs. + # + # The point is that if anything appears before the security report + # header, there's an error or a warning while parsing the unit file. + env -i systemd-analyze --offline=true security "$1" 2>&1 |awk ' + /NAME.*DESCRIPTION.*EXPOSURE/ {suppress=1} + {if (!suppress) {print; failed++}} + END {exit failed} + ' + +else + echo "SKIP: systemd-analyze --offline=true security not supported" >&2 +fi |