pushd tmp || exit rm -f ip-to-country.csv.gz wget software77.net/geo-ip/?DL=1 -O ip-to-country.csv.gz new_db_version=`php -r "if (!file_exists('ip-to-country.csv.gz')) exit(1);echo date(\"Y.m.d\n\", filemtime('ip-to-country.csv.gz'));"` if [ $? != 0 ] then echo $new_db_version; exit 1 fi old_db_version=`cat ../build.properties | grep database_ver | grep -o "[0-9].*"` if [ "$new_db_version" == "$old_db_version" -a "$1" != "-f" ] then echo "No changes" exit 0 fi cat ../build.properties | grep -v "database_ver\|# ver" > build.properties echo "# version number in date format, year.month.day" >> build.properties echo "database_ver=$new_db_version" >> build.properties rm -f ip-to-country.csv gunzip ip-to-country.csv.gz cp ip-to-country.csv ../ cp build.properties ../ cd .. ant if [ "$?" -ne "0" ]; then echo "ant failed" exit 1 fi cd dist/tmp php -f ip2c_test.php ../../ip-to-country.csv ../../ip-to-country.bin if [ "$?" -ne "0" ]; then echo "failed" exit 1 fi echo "great success" popd