Change order for download feature

This commit is contained in:
root 2011-02-10 12:09:08 +01:00
parent 12b69e6522
commit bfdb18d89c

View file

@ -10,10 +10,10 @@ MAX_CHECK=10
MAX_FAILED=3 MAX_FAILED=3
SLEEP_ON_FAILED=10 SLEEP_ON_FAILED=10
CHECK_URL=http://www.roundcube.net/download CHECK_URL=http://www.roundcube.net/download
DOWNLOAD=0
DOWNLOAD_DIR=$RC_HOME/../upstream DOWNLOAD_DIR=$RC_HOME/../upstream
DEBUG=0 DEBUG=0
DOWNLOAD=0
function usage() { function usage() {
echo "Usage : $0 [-v] [-d]" echo "Usage : $0 [-v] [-d]"
@ -102,6 +102,20 @@ done
if [ "$newest" != "$current" ] if [ "$newest" != "$current" ]
then then
if [ $DOWNLOAD -eq 1 ]
then
if [ -d "$DOWNLOAD_DIR" ]
then
cd "$DOWNLOAD_DIR"
DOWNLOAD_FILE="$( pwd )/roundcubemail-$newest.tar.gz"
[ $DEBUG -eq 1 ] && echo "Download new release in $DOWNLOAD_FILE"
wget -q -O "$DOWNLOAD_FILE" "$DOWNLOAD_URL"
else
echo "[WARNING] Le dossier de telechargement n'existe pas ($DOWNLOAD_DIR)."
fi
fi
tmp=`mktemp` tmp=`mktemp`
echo "New RoundCude release" > $tmp echo "New RoundCude release" > $tmp
echo "=====================" >> $tmp echo "=====================" >> $tmp
@ -109,19 +123,8 @@ then
echo "Newest : $newest" >> $tmp echo "Newest : $newest" >> $tmp
echo >> $tmp echo >> $tmp
echo "Download URL : $DOWNLOAD_URL" >> $tmp echo "Download URL : $DOWNLOAD_URL" >> $tmp
[ -n "$DOWNLOAD_FILE" -a -f "$DOWNLOAD_FILE" ] && echo "Download file : $( pwd )/roundcubemail-$newest.tar.gz" >> $tmp
if [ $DOWNLOAD -eq 1 ]
then
if [ -d "$DOWNLOAD_DIR" ]
then
cd "$DOWNLOAD_DIR"
[ $DEBUG -eq 1 ] && echo "Download new release in $( pwd )/roundcubemail-$newest.tar.gz"
wget -q -O "roundcubemail-$newest.tar.gz" "$DOWNLOAD_URL"
echo "Download file : $( pwd )/roundcubemail-$newest.tar.gz" >> $tmp
else
echo "[WARNING] Le dossier de telechargement n'existe pas ($DOWNLOAD_DIR)."
fi
fi
M=0 M=0
if [ -f $CACHE ] if [ -f $CACHE ]