mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
This fixes the following failure: TEST-23-UNIT-FILE.sh[2408]: + systemd-analyze --recursive-errors=no --man=no verify /usr/lib/systemd/system/sysinit.target.wants/systemd-hwdb-update.service systemd-analyze[2737]: sys-kernel-config.mount: symlinks are not allowed for units of this type, rejecting. systemd-analyze[2737]: proc-sys-fs-binfmt_misc.automount: symlinks are not allowed for units of this type, rejecting. systemd-analyze[2737]: dev-hugepages.mount: symlinks are not allowed for units of this type, rejecting. systemd-analyze[2737]: sys-kernel-tracing.mount: symlinks are not allowed for units of this type, rejecting. systemd-analyze[2737]: sys-kernel-debug.mount: symlinks are not allowed for units of this type, rejecting. systemd-analyze[2737]: sys-fs-fuse-connections.mount: symlinks are not allowed for units of this type, rejecting. systemd-analyze[2737]: dev-mqueue.mount: symlinks are not allowed for units of this type, rejecting. systemd-analyze[2737]: Unit systemd-hwdb-update.service is masked. TEST-23-UNIT-FILE.sh[166]: + : TEST-23-UNIT-FILE.sh[166]: + kill -0 2408 TEST-23-UNIT-FILE.sh[166]: + wait 2408 TEST-23-UNIT-FILE.sh[166]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE.verify-unit-files.sh failed' TEST-23-UNIT-FILE.sh[166]: Subtest /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE.verify-unit-files.sh failed
53 lines
1.6 KiB
Bash
Executable File
53 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
# shellcheck disable=SC2016
|
|
set -eux
|
|
set -o pipefail
|
|
|
|
# Verify our own unit files (where applicable)
|
|
|
|
# This is generated by meson during build
|
|
UNIT_FILE_LIST="/usr/lib/systemd/tests/testdata/installed-unit-files.txt"
|
|
|
|
if [[ ! -f "$UNIT_FILE_LIST" ]]; then
|
|
echo "Couldn't find the list of installed units, skipping the test"
|
|
exit 0
|
|
fi
|
|
|
|
if ! command -v systemd-analyze >/dev/null; then
|
|
echo "Built without systemd-analyze, skipping the test"
|
|
exit 0
|
|
fi
|
|
|
|
mapfile -t UNIT_FILES <"$UNIT_FILE_LIST"
|
|
|
|
if [[ "${#UNIT_FILES[@]}" -le 0 ]]; then
|
|
echo >&2 "The unit file list is empty, this is most likely a bug"
|
|
exit 1
|
|
fi
|
|
|
|
for unit_file in "${UNIT_FILES[@]}"; do
|
|
# Skip the check for a couple of units, namely:
|
|
# - syslog.socket: the corresponding syslog.service might not be installed
|
|
# - rc-local.service: compat API, /etc/rc.d/rc.local most likely won't be present
|
|
if [[ "$unit_file" =~ /(syslog.socket|rc-local.service)$ ]]; then
|
|
continue
|
|
fi
|
|
|
|
# Skip missing unit files - this is useful for $NO_BUILD runs, where certain unit files might be dropped
|
|
# in distro packaging
|
|
if [[ ! -e "$unit_file" ]]; then
|
|
echo "$unit_file not found, skipping"
|
|
continue
|
|
fi
|
|
|
|
# Skip masked unit files
|
|
resolved=$(readlink -f "$unit_file")
|
|
if [[ "$resolved" == "/dev/null" || "$(systemctl is-enabled "${resolved##*/}" 2>/dev/null || :)" == "masked" ]]; then
|
|
echo "$unit_file is masked, skipping"
|
|
continue
|
|
fi
|
|
|
|
systemd-analyze --recursive-errors=no --man=no verify "$unit_file"
|
|
done
|