Import initial

This commit is contained in:
Benjamin Renard 2010-05-11 09:48:45 +02:00
commit 1cec8ada0c

48
check_rc_upgrade.sh Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
MAIL=root
TIME=7
CACHE=/var/www/webmail/.cache_check_upgrade
DEBUG=0
[ "$1" == "-v" ] && DEBUG=1
current=`egrep "define.*RCMAIL_VERSION" /var/www/webmail/public_html/program/include/iniset.php|sed "s/define('.*', '\([^']*\)'.*$/\1/"`
[ $DEBUG -eq 1 ] && echo "Current : $current"
newest=`wget -q http://www.roundcube.net/download -O - |grep Stable|sed 's/^.*Stable.*: \(.*\)<\/td>.*$/\1/'`
[ $DEBUG -eq 1 ] && echo "Newest : $newest"
if [ "$newest" != "$current" ]
then
tmp=`mktemp`
echo "New RoundCude release" > $tmp
echo "=====================" >> $tmp
echo "Current : $current" >> $tmp
echo "Newest : $newest" >> $tmp
M=0
if [ -f $CACHE ]
then
if [ "`diff $tmp $CACHE`" != "" -o `find $CACHE -mtime +$TIME | wc -l` -eq 1 ]
then
[ $DEBUG -eq 1 ] && echo "Cache trop vieux ou modif => On envoi"
M=1
else
[ $DEBUG -eq 1 ] && echo "Pas de modif et cache trop recent : pas d'envoi"
fi
else
[ $DEBUG -eq 1 ] && echo "Pas encore de cache => On envoi"
M=1
fi
if [ $M -eq 1 ]
then
cat $tmp > $CACHE
cat $tmp | mail -s "New RoundCude release : $newest" $MAIL
[ $DEBUG -eq 1 ] && echo "Mail envoyé"
fi
rm -f $tmp
else
[ $DEBUG -eq 1 ] && echo "Pas de changement de version"
fi