#!/bin/sh

# Copyright 2009,2010 Holger Levsen (holger@layer-acht.org)
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#
# send reminders about the status of the package
# run via cron by holger on ravel.debian.org
#
#   holger@ravel:~$ crontab -l
#   # m h  dom mon dow   command
#   # run on the 2nd and 4th sunday of a month
#   23 1 8-14,22-28 * 0 test `/bin/date +\%w` -eq 0 && /home/holger/debian-edu-doc/debian/mail_stats_to_list
#

cd ~holger/debian-edu-doc
svn up > /dev/null 2>&1 && svn status 
if [ $(echo $?) -ne 0 ] ; then
	echo "Problem with svn checkout at ravel.debian.org:~holger/debian-edu-doc - please fix." | mail -s "problem with debian-edu-doc status mails" holger@layer-acht.org
	exit 1
fi

#
# loop through manuals
#
cd documentation
# actually only send mails about debian-edu-squeeze - you can add more directories to the loop here
for i in debian-edu-squeeze ; do
	if [ "$i" != scripts ] && [ "$i" != norwegian ] && [ $(ls $i/$i-manual.*.po > /dev/null 2>&1 ; echo $?) -eq 0 ] && [ "$i" != debian-edu-etch ] ; then 
		cd $i 
		TMPFILE=$(mktemp)
		echo "The (translated) $i manual as PDF or HTML is available at http://maintainer.skolelinux.org/debian-edu-doc/" > $TMPFILE
		echo >> $TMPFILE
		echo "To understand this mail better, please read /usr/share/doc/debian-edu-doc/README." >> $TMPFILE
		echo "This mail is automatically send by a cronjob run by Holger Levsen every two weeks. Please send feedback, suggestions, flames and cookies via this list." >> $TMPFILE
		echo >> $TMPFILE
		make update > /dev/null 2>&1 
		make status >> $TMPFILE 2>&1 
		cat $TMPFILE | mail -s "Content and translation status for the $i manual" debian-edu@lists.debian.org
		rm $TMPFILE
		cd ..
	fi
done
cd ..

