webperimental: ally share J.S. Bach's Cathedral.
[freeciv.git] / scripts / check_flags.sh
blob0abe68b78ced1826f3feed024f2cb4de7079c46c
1 #!/bin/bash
3 is_verbose=false
4 non_quiet=true
6 if [ "$1" = "-v" ]; then
7 is_verbose=true
8 elif [ "$1" = "-q" ]; then
9 non_quiet=false
12 errors=0
14 data_dir="`dirname $0`/../data"
15 flags_dir="$data_dir/flags"
16 flags_makefile="$data_dir/flags/Makefile.am"
18 for nation in `find $data_dir/nation -name '*.ruleset'`; do
19 $is_verbose && echo $nation
20 flag=`grep -P "^flag\s*=\s*" "$nation" | sed -re 's/flag\s*=\s*\"(.*)\".*$/\1/'`
21 $is_verbose && echo "flag='$flag'"
22 for suf in ".png" "-large.png" "-shield.png" "-shield-large.png" ".svg"; do
23 if [ -f "$flags_dir/$flag$suf" ]; then
24 grep -q "[[:space:]]$flag$suf" "$flags_makefile"
25 if [ $? -ne 0 ]; then
26 $non_quiet && echo "....$flag$suf is missing in $flags_makefile"
27 let 'errors += 1'
29 else
30 $non_quiet && echo "..$flag$suf is missing"
31 let 'errors += 1'
33 done
34 done
36 $non_quiet && echo "Total errors: $errors"
38 if [ $errors -gt 0 ]; then
39 exit 3
40 else
41 exit 0