#!/bin/sh

echo "Content-Type: text/html"
echo
echo "<pre>"

set -e

if [ "$(id -un)" != "www-data" ]; then
        echo "run this as user www-data only" >&2
        exit 1
fi

umask 0002

cd /osgeo/download/osgeo4w
exec 2>>/tmp/osgeo4w-regen.log

date >&2

chmod -f  -R a+r release || true
cat setup_test.ini >setup_test.ini.prev
./genini --recursive --output=setup_test.ini ./release

./versions.pl "current test packages" setup_test.ini >versions_test.html
htmldiff versions_test.html versions.html >versions_diff.html

echo Changes:
diff -u setup_test.ini.prev setup_test.ini || true

echo "</pre>"
echo "<br>"
echo '<a href="/cgi-bin/osgeo4w-promote.sh">Promote changes...</a>'

