libfprint/tests/test-generated-hwdb.sh
Marco Trevisan (Treviño) 533180a2e6 data: Use auto-generated but hardcoded autosuspend hwdb file
This solves various problems:
 1. It stays the same also if some drivers have been disabled
 2. It uses a stable path for being imported by systemd
 3. It is still checked for its validity by tests
 4. It can be auto-generated using a simple command
2021-01-20 21:17:42 +01:00

24 lines
546 B
Bash
Executable file

#!/usr/bin/env bash
set -e
[ -x "$UDEV_HWDB" ] || exit 1
if [ "$UDEV_HWDB_CHECK_CONTENTS" == 1 ]; then
generated_rules=$(mktemp "${TMPDIR:-/tmp}/libfprint-XXXXXX.hwdb")
else
generated_rules=/dev/null
fi
$UDEV_HWDB > "$generated_rules"
if [ "$UDEV_HWDB_CHECK_CONTENTS" != 1 ]; then
exit 77
fi
if ! cmp "$MESON_SOURCE_ROOT/data/autosuspend.hwdb" "$generated_rules"; then
echo "E: Autosuspend file needs to be re-generated!"
echo " ninja -C $MESON_BUILD_ROOT libfprint/sync-udev-hwdb"
exit 1
fi
rm "$generated_rules"