[28490] | 1 | #! /bin/bash
|
---|
| 2 |
|
---|
| 3 | [email protected]
|
---|
| 4 |
|
---|
| 5 | # get rid of any old reports
|
---|
| 6 | report=translation_status_report.txt
|
---|
| 7 | if test -f $report; then
|
---|
| 8 | rm -f $report
|
---|
| 9 | fi
|
---|
| 10 |
|
---|
| 11 | filelisting=("macros/*.dm" "perllib/strings*.properties" "gli/classes/dictionary*.properties" "gli/help/" "gsinstaller/LanguagePack*.properties")
|
---|
| 12 |
|
---|
| 13 | date=`date +"%d-%m-%y"`
|
---|
| 14 | echo "Translation status report for date: $date" >> $report
|
---|
| 15 | echo "Checked in ${filelisting[@]}" >> $report
|
---|
| 16 | echo "---------------------------------------------" >> $report
|
---|
| 17 |
|
---|
| 18 | # store backup of Internal Field Separator value, then set IFS to newline for splitting on newline
|
---|
| 19 | IFS_BAK=$IFS
|
---|
| 20 | # IFS='\n' # splits on all whitespace
|
---|
| 21 | IFS='
|
---|
| 22 | '
|
---|
| 23 |
|
---|
| 24 | num_modified=0
|
---|
| 25 |
|
---|
| 26 | # in the lines returned from the diff, test for archives or newline
|
---|
| 27 | # http://stackoverflow.com/questions/229551/string-contains-in-bash
|
---|
| 28 | # http://stackoverflow.com/questions/10515964/counter-increment-in-bash-loop-not-working
|
---|
| 29 | for file in ${filelisting[@]}; do
|
---|
| 30 | status=`svn status $file`
|
---|
| 31 | # "LINE: $file - status: $status"
|
---|
| 32 | # if the file's svn status is modified, write the filename out to the report
|
---|
| 33 | if [[ "$status" == *"M "* ]]; then
|
---|
| 34 | #echo "$file has been modified: $status"
|
---|
| 35 | echo $file >> $report
|
---|
| 36 | ((num_modified++))
|
---|
| 37 | fi
|
---|
| 38 | done
|
---|
| 39 |
|
---|
| 40 | # restore IFS
|
---|
| 41 | IFS=$IFS_BAK
|
---|
| 42 | IFS_BAK=
|
---|
| 43 |
|
---|
| 44 | if [[ $num_modified == 0 ]]; then
|
---|
| 45 | echo "No files modified" >> $report
|
---|
| 46 | else
|
---|
| 47 | echo ""
|
---|
| 48 | echo "The above files were modified ($num_modified number of files)." >> $report
|
---|
| 49 | fi
|
---|
| 50 |
|
---|
| 51 | echo "---------------------------------------------" >> $report
|
---|
| 52 |
|
---|
| 53 | # if no files are modified, we don't send email, otherwise we do
|
---|
| 54 | if [[ $num_modified != 0 ]]; then
|
---|
| 55 | # echo "Files were modified. Sending email..."
|
---|
| 56 | cat $report | mail -s 'TRANSLATION files on nzdl have been updated' $GREENSTONE_EMAIL
|
---|
| 57 | fi
|
---|