]>
Commit | Line | Data |
---|---|---|
f15c3233 | 1 | #!/bin/bash |
b2441318 | 2 | # SPDX-License-Identifier: GPL-2.0 |
f15c3233 MCC |
3 | |
4 | cd Documentation/ | |
5 | ||
6 | # Check entries that should be removed | |
7 | ||
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" | |
12 | fi | |
13 | done | |
14 | ||
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" | |
22 | fi | |
23 | done | |
24 | ||
25 | for i in $search; do | |
26 | if [ "$(grep -P "^$i" 00-INDEX)" == "" ]; then | |
27 | dir="$dir $i" | |
28 | fi | |
29 | done | |
30 | ||
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" | |
38 | fi | |
39 | done | |
40 | ||
41 | for i in $search; do | |
42 | if [ "$(grep -P "^$i\$" 00-INDEX)" == "" ]; then | |
43 | file="$file $i" | |
44 | fi | |
45 | done | |
46 | ||
47 | # Output its findings | |
48 | ||
49 | echo -e "Documentation/00-INDEX check results:\n" | |
50 | ||
51 | if [ "$obsolete" != "" ]; then | |
52 | echo -e "- Should remove those entries:\n\t$obsolete\n" | |
53 | else | |
54 | echo -e "- No obsolete entries\n" | |
55 | fi | |
56 | ||
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" | |
61 | fi | |
62 | ||
63 | if [ "$file" != "" ]; then | |
64 | echo -e "- Should document those files:\n\t$file" | |
65 | else | |
66 | echo "- No new files to add" | |
67 | fi |