| 1 |
#!/bin/sh |
| 2 |
#set -xv |
| 3 |
|
| 4 |
### |
| 5 |
# # Set script variables |
| 6 |
### |
| 7 |
WWW_HOME=~www |
| 8 |
export WWW_HOME |
| 9 |
# read variables used by several scripts |
| 10 |
echo "`date` Sourcing ${WWW_HOME}/bin/nightly-vars" |
| 11 |
. ${WWW_HOME}/bin/nightly-vars |
| 12 |
|
| 13 |
### |
| 14 |
# # Prepare diffmon files |
| 15 |
### |
| 16 |
echo "`date` Making diffmon config file for English HTML files" |
| 17 |
# |
| 18 |
# 1) Doing this by excluding |
| 19 |
# -name "*_toc.html" |
| 20 |
# -name "*_stoc.html" |
| 21 |
# -name "*_foot.html" |
| 22 |
# -regex ".*_[0-9]+.html" |
| 23 |
# is a small kludge, as it assumes there are no manually created |
| 24 |
# files with these patterns. -len tower |
| 25 |
# |
| 26 |
# If you make a change to this exception list, |
| 27 |
# you should consider also changing the list in make.html.TAGS |
| 28 |
# They can be (and currently are) different. |
| 29 |
# |
| 30 |
# 2) Filenames that have colons (":") in them confuse diffmon, |
| 31 |
# so we wild card them with the "sed -e 's/:/?/g" lines below. |
| 32 |
# |
| 33 |
# 3) Without the "sort -u" lines below, there are reports of a file being |
| 34 |
# added and deleted in the same diffmon run on a diffmon-web*.cf file. The |
| 35 |
# reason is that `find's output is not sorted. |
| 36 |
# |
| 37 |
find ${HTMLDIRS} \ |
| 38 |
-name "*.html" -type f \ |
| 39 |
\ |
| 40 |
-a \! -name "*_toc.html" \ |
| 41 |
-a \! -name "*_stoc.html" \ |
| 42 |
-a \! -name "*_foot.html" \ |
| 43 |
-a \! -regex ".*_[0-9]+.html" \ |
| 44 |
-a \! -path "/home/www/html/directory/*" \ |
| 45 |
\ |
| 46 |
-a \! -path "/home/www/html/software/*/*" \ |
| 47 |
| sed -e 's/:/?/g' \ |
| 48 |
| awk \ |
| 49 |
'{ printf "%s : -u : diffmon-web\n",$1 }' \ |
| 50 |
| sort -u \ |
| 51 |
| sed -f /home/diffmon/diffmon-web.sed \ |
| 52 |
> /home/diffmon/diffmon-web.cf |
| 53 |
# used WEBLANG here, not TAGSLANG. the webmasters are responsible for |
| 54 |
# the translations for which there are no translation teams. -len tower |
| 55 |
for i in $WEBLANG; do |
| 56 |
mv /home/diffmon/diffmon-web.cf /home/diffmon/diffmon-web.cf.IN |
| 57 |
grep -v "\.$i\.html : " \ |
| 58 |
< /home/diffmon/diffmon-web.cf.IN \ |
| 59 |
> /home/diffmon/diffmon-web.cf |
| 60 |
done |
| 61 |
rm /home/diffmon/diffmon-web.cf.IN |
| 62 |
|
| 63 |
echo "`date` Making diffmon config file for translation team:" |
| 64 |
echo -n " " |
| 65 |
for i in $WEBLANG; do |
| 66 |
echo -n " $i" |
| 67 |
# Set up for the translated files: |
| 68 |
find ${HTMLDIRS} \ |
| 69 |
-name "*.$i.html" -type f \ |
| 70 |
-a \! -path "/home/www/html/brave-gnu-world/*" \ |
| 71 |
-a \! -path "/home/www/html/server/$i/*" \ |
| 72 |
-a \! -path "/home/www/html/software/*/*" \ |
| 73 |
| sed -e 's/:/?/g' \ |
| 74 |
| sort -u \ |
| 75 |
| awk -v LANG=$i \ |
| 76 |
'{ printf "%s : -u : diffmon-web-%s-%s\n",$1,LANG,LANG }' \ |
| 77 |
> /home/diffmon/diffmon-web-$i-$i.cf |
| 78 |
# Now set up for the English originals that are translated: |
| 79 |
# NOTE: Some files are not translations, they are originals written in |
| 80 |
# that language (e.g. some under /home/www/html/fsfe/), and |
| 81 |
# English translations of them may not exist. In these cases, |
| 82 |
# errors will be sent to diffmon-web-errors on those non-existant files. |
| 83 |
# An addition to this script to delete such files from |
| 84 |
# /home/diffmon/diffmon-web-$i.cf would make monitoring the mail sent to |
| 85 |
# diffmon-web-errors easier. A file containing the files to delete would |
| 86 |
# be the best way to go, as it means a deliberate decision has been |
| 87 |
# made to not monitor a file. -tower |
| 88 |
sed -e "s/$i\.html : /html : /" \ |
| 89 |
-e "s/diffmon-web-$i-$i/diffmon-web-$i/" \ |
| 90 |
< /home/diffmon/diffmon-web-$i-$i.cf \ |
| 91 |
> /home/diffmon/diffmon-web-$i.cf |
| 92 |
# Now add the webmaster guideline diffmons |
| 93 |
cat >> /home/diffmon/diffmon-web-$i.cf <<EOF |
| 94 |
/home/www/html/server/fsf-html-style-sheet.html : -u : web-translators-$i |
| 95 |
EOF |
| 96 |
find /home/www/html/server/standards/ \ |
| 97 |
-name "*.html" -type f \ |
| 98 |
-printf "%p : -u : web-translators-$i\n" \ |
| 99 |
>> /home/diffmon/diffmon-web-$i.cf |
| 100 |
done |
| 101 |
echo " " |
| 102 |
|
| 103 |
### |
| 104 |
# # Run diffmon |
| 105 |
### |
| 106 |
echo "`date` Running diffmon for translation team:" |
| 107 |
echo -n " " |
| 108 |
for i in $WEBLANG; do |
| 109 |
echo -n " $i" |
| 110 |
# ran with the -n flag - this is a local change to diffmon that |
| 111 |
# prevents cache updates |
| 112 |
/home/diffmon/diffmon -c diffmon-web-$i.cf -e diffmon-web-$i-errors -o /home/diffmon/old_file_dir -p /home/diffmon -n |
| 113 |
# let the e-mail queue empty (to keep web server response reasonable): |
| 114 |
sleep 120 |
| 115 |
/home/diffmon/diffmon -c diffmon-web-$i-$i.cf -e diffmon-web-$i-$i-errors -o /home/diffmon/old_file_dir -p /home/diffmon |
| 116 |
# let the e-mail queue empty (to keep web server response reasonable): |
| 117 |
sleep 120 |
| 118 |
done |
| 119 |
echo " " |
| 120 |
|
| 121 |
echo "`date` Running diffmon for English HTML files" |
| 122 |
/home/diffmon/diffmon -c diffmon-web.cf -e diffmon-web-errors -o /home/diffmon/old_file_dir -p /home/diffmon |
| 123 |
# let the e-mail queue empty (to keep web server response reasonable): |
| 124 |
sleep 120 |
| 125 |
|
| 126 |
echo "`date` Running main diffmon" |
| 127 |
/home/diffmon/diffmon -c diffmon.cf -e diffmon-www-errors -o /home/diffmon/old_file_dir -p /home/diffmon |
| 128 |
# let the e-mail queue empty (to keep web server response reasonable): |
| 129 |
sleep 120 |
| 130 |
|
| 131 |
# this compile-command lets you syntax check the script. -len |
| 132 |
# |
| 133 |
# local variables: |
| 134 |
# eval: (make-local-variable 'compile-command) |
| 135 |
# eval: (setq compile-command (concat "/bin/sh -n " buffer-file-name)) |
| 136 |
# quote-region-quote: "# " |
| 137 |
# end: |