#!/bin/sh

if [ ! "$1" ]
then
    echo "No exist patch"
    exit
fi


for DOM in `find */htdocs/libraries/joomla/version.php|cut -d/ -f1`
do

    if [ "`grep \\$RELEASE $DOM/htdocs/libraries/joomla/version.php|grep 1\\.5`" ]
    then
        echo "Actualizando $DOM"
	patch --binary -p1 -d ./$DOM/htdocs/ < $1 &>/dev/null
        if [ $? -ne 0 ]
	then
	    echo "** Error to update domain $DOM"
	fi
    fi
done

