Merge branch 'TimePath/cleanup'
[xonotic/xonotic-data.pk3dir.git] / check-cvars.sh
1 #!/bin/sh
2
3 errord=false
4
5 check_files()
6 {
7         countw=`awk ''"$3"' { print $2; }' "$1" | sort -u | tr -d '\r' | git hash-object --stdin | cut -c 1-32`
8         for b in $2; do
9                 countb=`awk ''"$3"' { print $2; }' "$b" | sort -u | tr -d '\r' | git hash-object --stdin | cut -c 1-32`
10                 if [ "$countw" != "$countb" ]; then
11                         echo "Mismatch between "$1" and $b. Aborting."
12                         echo "Differences are:"
13                         echo "< missing in $b"
14                         echo "> must get removed from $b"
15                         A=`mktemp || echo a.tmp`
16                         B=`mktemp || echo b.tmp`
17                         awk ''"$3"' { print $2; }' "$1"      | sort -u | tr -d '\r' > "$A"
18                         awk ''"$3"' { print $2; }' "$b"                     | sort -u | tr -d '\r' > "$B"
19                         diff "$A" "$B" | grep '^[<>]' | sort
20                         rm -f "$A" "$B"
21                         errord=true
22                 fi
23         done
24 }
25
26 check_files "balance-xonotic.cfg" "balance-*.cfg" "/^seta? g_/"
27 check_files "_hud_descriptions.cfg" "hud_*.cfg" "/^seta? hud_/"
28
29 if $errord; then
30         echo "Please wait for 30 seconds, so you have had enough time to read this..."
31         sleep 30
32 fi