Linux Audio

Check our new training course

Loading...
Note: File does not exist in v4.6.
 1#!/bin/bash
 2
 3cd Documentation/
 4
 5# Check entries that should be removed
 6
 7obsolete=""
 8for 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
12done
13
14# Check directory entries that should be added
15search=""
16dir=""
17for 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
22done
23
24for i in $search; do
25	if [ "$(grep -P "^$i" 00-INDEX)" == "" ]; then
26		dir="$dir $i"
27	fi
28done
29
30# Check file entries that should be added
31search=""
32file=""
33for 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
38done
39
40for i in $search; do
41	if [ "$(grep -P "^$i\$" 00-INDEX)" == "" ]; then
42		file="$file $i"
43	fi
44done
45
46# Output its findings
47
48echo -e "Documentation/00-INDEX check results:\n"
49
50if [ "$obsolete" != "" ]; then
51	echo -e "- Should remove those entries:\n\t$obsolete\n"
52else
53	echo -e "- No obsolete entries\n"
54fi
55
56if [ "$dir" != "" ]; then
57	echo -e "- Should document those directories:\n\t$dir\n"
58else
59	echo -e "- No new directories to add\n"
60fi
61
62if [ "$file" != "" ]; then
63	echo -e "- Should document those files:\n\t$file"
64else
65	echo "- No new files to add"
66fi