Merge tag 'hwmon-for-linus-v4.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel...
[platform/kernel/linux-rpi.git] / scripts / check_00index.sh
1 #!/bin/bash
2
3 cd Documentation/
4
5 # Check entries that should be removed
6
7 obsolete=""
8 for i in $(tail -n +12 00-INDEX |grep -E '^[a-zA-Z0-9]+'); do
9         if [ ! -e $i ]; then
10                 obsolete="$obsolete $i"
11         fi
12 done
13
14 # Check directory entries that should be added
15 search=""
16 dir=""
17 for i in $(find . -maxdepth 1 -type d); do
18         if [ "$i" != "." ]; then
19                 new=$(echo $i|perl -ne 's,./(.*),$1/,; print $_')
20                 search="$search $new"
21         fi
22 done
23
24 for i in $search; do
25         if [ "$(grep -P "^$i" 00-INDEX)" == "" ]; then
26                 dir="$dir $i"
27         fi
28 done
29
30 # Check file entries that should be added
31 search=""
32 file=""
33 for i in $(find . -maxdepth 1 -type f); do
34         if [ "$i" != "./.gitignore" ]; then
35                 new=$(echo $i|perl -ne 's,./(.*),$1,; print $_')
36                 search="$search $new"
37         fi
38 done
39
40 for i in $search; do
41         if [ "$(grep -P "^$i\$" 00-INDEX)" == "" ]; then
42                 file="$file $i"
43         fi
44 done
45
46 # Output its findings
47
48 echo -e "Documentation/00-INDEX check results:\n"
49
50 if [ "$obsolete" != "" ]; then
51         echo -e "- Should remove those entries:\n\t$obsolete\n"
52 else
53         echo -e "- No obsolete entries\n"
54 fi
55
56 if [ "$dir" != "" ]; then
57         echo -e "- Should document those directories:\n\t$dir\n"
58 else
59         echo -e "- No new directories to add\n"
60 fi
61
62 if [ "$file" != "" ]; then
63         echo -e "- Should document those files:\n\t$file"
64 else
65         echo "- No new files to add"
66 fi