mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
11a1589223
Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
63 lines
1.5 KiB
Bash
Executable File
63 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: LGPL-2.1+
|
|
#
|
|
# Call built systemd-hwdb update on our hwdb files to ensure that they parse
|
|
# without error
|
|
#
|
|
# (C) 2016 Canonical Ltd.
|
|
# Author: Martin Pitt <martin.pitt@ubuntu.com>
|
|
|
|
set -e
|
|
|
|
export SYSTEMD_LOG_LEVEL=info
|
|
ROOTDIR=$(dirname $(dirname $(readlink -f $0)))
|
|
SYSTEMD_HWDB=./systemd-hwdb
|
|
|
|
if [ ! -x "$SYSTEMD_HWDB" ]; then
|
|
echo "$SYSTEMD_HWDB does not exist, please build first"
|
|
exit 1
|
|
fi
|
|
|
|
D=$(mktemp --directory)
|
|
trap "rm -rf '$D'" EXIT INT QUIT PIPE
|
|
mkdir -p "$D/etc/udev"
|
|
ln -s "$ROOTDIR/hwdb" "$D/etc/udev/hwdb.d"
|
|
|
|
# Test "good" properties" — no warnings or errors allowed
|
|
err=$("$SYSTEMD_HWDB" update --root "$D" 2>&1 >/dev/null) && rc= || rc=$?
|
|
if [ -n "$err" ]; then
|
|
echo "$err"
|
|
exit ${rc:-1}
|
|
fi
|
|
if [ -n "$rc" ]; then
|
|
echo "$SYSTEMD_HWDB returned $rc"
|
|
exit $rc
|
|
fi
|
|
|
|
if [ ! -e "$D/etc/udev/hwdb.bin" ]; then
|
|
echo "$D/etc/udev/hwdb.bin was not generated"
|
|
exit 1
|
|
fi
|
|
|
|
# Test "bad" properties" — warnings required, errors not allowed
|
|
rm -f "$D/etc/udev/hwdb.bin" "$D/etc/udev/hwdb.d"
|
|
|
|
ln -s "$ROOTDIR/test/hwdb" "$D/etc/udev/hwdb.d"
|
|
err=$("$SYSTEMD_HWDB" update --root "$D" 2>&1 >/dev/null) && rc= || rc=$?
|
|
if [ -n "$rc" ]; then
|
|
echo "$SYSTEMD_HWDB returned $rc"
|
|
exit $rc
|
|
fi
|
|
if [ -n "$err" ]; then
|
|
echo "Expected warnings"
|
|
echo "$err"
|
|
else
|
|
echo "$SYSTEMD_HWDB unexpectedly printed no warnings"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -e "$D/etc/udev/hwdb.bin" ]; then
|
|
echo "$D/etc/udev/hwdb.bin was not generated"
|
|
exit 1
|
|
fi
|