Back to home page

LXR

 
 

    


0001 #!/bin/bash
0002 
0003 cd Documentation/
0004 
0005 # Check entries that should be removed
0006 
0007 obsolete=""
0008 for i in $(tail -n +12 00-INDEX |grep -E '^[a-zA-Z0-9]+'); do
0009         if [ ! -e $i ]; then
0010                 obsolete="$obsolete $i"
0011         fi
0012 done
0013 
0014 # Check directory entries that should be added
0015 search=""
0016 dir=""
0017 for i in $(find . -maxdepth 1 -type d); do
0018         if [ "$i" != "." ]; then
0019                 new=$(echo $i|perl -ne 's,./(.*),$1/,; print $_')
0020                 search="$search $new"
0021         fi
0022 done
0023 
0024 for i in $search; do
0025         if [ "$(grep -P "^$i" 00-INDEX)" == "" ]; then
0026                 dir="$dir $i"
0027         fi
0028 done
0029 
0030 # Check file entries that should be added
0031 search=""
0032 file=""
0033 for i in $(find . -maxdepth 1 -type f); do
0034         if [ "$i" != "./.gitignore" ]; then
0035                 new=$(echo $i|perl -ne 's,./(.*),$1,; print $_')
0036                 search="$search $new"
0037         fi
0038 done
0039 
0040 for i in $search; do
0041         if [ "$(grep -P "^$i\$" 00-INDEX)" == "" ]; then
0042                 file="$file $i"
0043         fi
0044 done
0045 
0046 # Output its findings
0047 
0048 echo -e "Documentation/00-INDEX check results:\n"
0049 
0050 if [ "$obsolete" != "" ]; then
0051         echo -e "- Should remove those entries:\n\t$obsolete\n"
0052 else
0053         echo -e "- No obsolete entries\n"
0054 fi
0055 
0056 if [ "$dir" != "" ]; then
0057         echo -e "- Should document those directories:\n\t$dir\n"
0058 else
0059         echo -e "- No new directories to add\n"
0060 fi
0061 
0062 if [ "$file" != "" ]; then
0063         echo -e "- Should document those files:\n\t$file"
0064 else
0065         echo "- No new files to add"
0066 fi