mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
test/bin: add checkflags to detect flag changes
This script can be used in a Makefile to detect flag changes and to save the new flags in a file. License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
parent
8ad4d5031a
commit
a2c41e650d
23
test/bin/checkflags
Executable file
23
test/bin/checkflags
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# Author: Christian Couder <chriscool@tuxfamily.org>
|
||||
# MIT LICENSED
|
||||
|
||||
if test "$#" -lt 3
|
||||
then
|
||||
echo >&2 "usage $0 FILE VALUES MSG..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FLAG_FILE="$1"
|
||||
FLAG_VALS="$2"
|
||||
shift
|
||||
shift
|
||||
FLAG_MSGS="$@"
|
||||
|
||||
# Use x in front of tested values as flags could be
|
||||
# interpreted by "test" to be for itself.
|
||||
if test x"$FLAG_VALS" != x"$(cat "$FLAG_FILE" 2>/dev/null)"
|
||||
then
|
||||
echo "$FLAG_MSGS"
|
||||
echo "$FLAG_VALS" >"$FLAG_FILE"
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user