Linux 4.18.10
[linux/fpc-iii.git] / scripts / check_00index.sh
blobaa47f5926c8094557fa451c82eb29c4ae8125a99
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 cd Documentation/
6 # Check entries that should be removed
8 obsolete=""
9 for i in $(tail -n +12 00-INDEX |grep -E '^[a-zA-Z0-9]+'); do
10 if [ ! -e $i ]; then
11 obsolete="$obsolete $i"
13 done
15 # Check directory entries that should be added
16 search=""
17 dir=""
18 for i in $(find . -maxdepth 1 -type d); do
19 if [ "$i" != "." ]; then
20 new=$(echo $i|perl -ne 's,./(.*),$1/,; print $_')
21 search="$search $new"
23 done
25 for i in $search; do
26 if [ "$(grep -P "^$i" 00-INDEX)" == "" ]; then
27 dir="$dir $i"
29 done
31 # Check file entries that should be added
32 search=""
33 file=""
34 for i in $(find . -maxdepth 1 -type f); do
35 if [ "$i" != "./.gitignore" ]; then
36 new=$(echo $i|perl -ne 's,./(.*),$1,; print $_')
37 search="$search $new"
39 done
41 for i in $search; do
42 if [ "$(grep -P "^$i\$" 00-INDEX)" == "" ]; then
43 file="$file $i"
45 done
47 # Output its findings
49 echo -e "Documentation/00-INDEX check results:\n"
51 if [ "$obsolete" != "" ]; then
52 echo -e "- Should remove those entries:\n\t$obsolete\n"
53 else
54 echo -e "- No obsolete entries\n"
57 if [ "$dir" != "" ]; then
58 echo -e "- Should document those directories:\n\t$dir\n"
59 else
60 echo -e "- No new directories to add\n"
63 if [ "$file" != "" ]; then
64 echo -e "- Should document those files:\n\t$file"
65 else
66 echo "- No new files to add"