qca-swiss-army-knife/tools/initvals/verify_checksums.sh
Luis R. Rodriguez fc4d32e21b qca-swiss-army-knife: add tools directory for initvals
We are going to rename this git tree to qca-swiss-army-knife.git
and add more tools, as such lets throw the initvals work into
its own directory and allow for other tools to be thrown in here.
Lets add our own top level copyright license, and a simple README.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
2012-05-25 12:37:52 -07:00

40 lines
953 B
Bash
Executable file

#!/bin/sh
CSUM_DIR=".tmp_checksum"
get_family_checksum()
{
local family="$1"
local suffix="$2"
local flag
[ "$suffix" == "hal" ] && flag="ATHEROS=1"
make clean all $flag >/dev/null
./initvals -f $family > "$CSUM_DIR/${family}_$suffix.txt"
./initvals -f $family | sha1sum | sed -e 's/[ -]//g'
}
verify_family_checksum()
{
local family="$1"
local sum_hal
local sum_ath9k
local res
sum_hal=$(get_family_checksum $family hal)
sum_ath9k=$(get_family_checksum $family ath9k)
[ "$sum_hal" == "$sum_ath9k" ] && res="pass" || res="fail"
printf "%-14s %-40s %s\n" "$family" "$sum_hal" "$res"
[ "$res" == "fail" ] && \
diff -Nurw "$CSUM_DIR/${family}_hal.txt" "$CSUM_DIR/${family}_ath9k.txt" | grep '^+[0-9a-f]'
}
FAMILIES="$@"
[ -z "$FAMILIES" ] && FAMILIES="ar5008 ar9001 ar9002 ar9003-2p2 ar9330-1p1 ar9330-1p2 ar9485 ar9580-1p0"
mkdir -p "$CSUM_DIR"
for family in $FAMILIES; do
verify_family_checksum $family
done
rm -rf "$CSUM_DIR"