Files
libfprint/tests/test-generated-hwdb.sh
Mohammed Anas d3ec9a80d3 tests: remove Bash dependency in favor of sh
The script works just fine with `sh`.

Also replace nonstandard `test` operator `==` with the standard `=`.

The other changes are mostly cosmetic.
2024-01-22 15:27:33 +00:00

31 lines
707 B
Bash
Executable File

#!/bin/sh -e
if [ ! -x "$UDEV_HWDB" ]; then
echo "E: UDEV_HWDB (${UDEV_HWDB}) unset or not executable."
exit 1
fi
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 [ $? != 0 ]; then
echo "E: UDEV_HWDB (${UDEV_HWDB}) failed to run without error."
exit 1
fi
if [ "$UDEV_HWDB_CHECK_CONTENTS" != 1 ]; then
exit 77
fi
if ! diff -u "$MESON_SOURCE_ROOT/data/autosuspend.hwdb" "$generated_rules"; then
echo "E: Autosuspend file needs to be re-generated!"
echo " ninja -C $MESON_BUILD_ROOT sync-udev-hwdb"
exit 1
fi
rm "$generated_rules"