more work on check_licenses script
[oonf.git] / files / check_licences.sh
1 #!/bin/sh
2
3 LEN=`cat ./files/default_licence.txt |wc -c`
4
5 OKAY=0
6 BAD=0
7
8 EXCEPT="-not -wholename ./src-plugins/nl80211_listener/nl80211.h"
9 for file in $(eval find ./src* -type f -name *[.][ch] ${EXCEPT})
10 do
11         cmp --bytes ${LEN} ${file} ./files/default_licence.txt
12         if [ ${?} != 0 ]
13         then
14                 BAD=$((${BAD} + 1))
15         else
16                 OKAY=$((${OKAY} + 1))
17         fi
18 done
19
20 TOTAL=$((${OKAY} + ${BAD}))
21
22 if [ ${OKAY} != 0 ]
23 then
24         echo "Found ${OKAY} source/header files with the correct header"
25 fi
26 if [ ${BAD} != 0 ]
27 then
28         echo "Found ${BAD} source/header files with the wrong or an outdated header"
29 fi
30 if [ ${TOTAL} = 0 ]
31 then
32         echo "No files found, please run script from the main directory of the repository"
33 fi