root/other-projects/gti/translation_status.sh @ 28491

Revision 28491, 1.8 KB (checked in by ak19, 6 years ago)

Some minor improvements.

  • Property svn:executable set to *
Line 
1#! /bin/bash
2
3GREENSTONE_EMAIL=greenstone_team@cs.waikato.ac.nz
4
5# get rid of any old reports
6report=translation_status_report.txt
7if test -f $report; then
8    rm -f $report
9fi
10
11filelisting=("macros/*.dm" "perllib/strings*.properties" "gli/classes/dictionary*.properties" "gli/help/" "gsinstaller/LanguagePack*.properties")
12
13date=`date +"%d-%m-%y"`
14echo "Translation status report for date: $date" >> $report
15echo "Checked in ${filelisting[@]}" >> $report
16echo "---------------------------------------------" >> $report
17
18# store backup of Internal Field Separator value, then set IFS to newline for splitting on newline
19IFS_BAK=$IFS
20#    IFS='\n' # splits on all whitespace
21IFS='
22'
23
24num_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
29for 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
38done
39
40# restore IFS
41IFS=$IFS_BAK
42IFS_BAK=
43
44if [[ $num_modified == 0 ]]; then
45    echo "No files modified" >> $report
46else
47    echo "" >> $report
48    echo "The above $num_modified files were modified." >> $report
49fi
50
51echo "---------------------------------------------" >> $report
52
53# if no files are modified, we don't send email, otherwise we do
54if [[ $num_modified != 0 ]]; then
55#  echo "Files were modified. Sending email..." 
56    cat $report | mail -s 'GTI: '$num_modified' language file(s) on nzdl have been updated' $GREENSTONE_EMAIL
57    echo "Sent mail of report: $report"
58else
59    echo "No files modified. Not sending mail."
60fi
Note: See TracBrowser for help on using the browser.