#!/bin/sh
if ! grep -q Freifunk.Net /srv/www/index.html 2>&-; then
  test -f /srv/www/index.html && mv /srv/www/index.html /srv/www/index-old.html
fi
mv /srv/www/index-new.html /srv/www/index.html
if grep -q ":tiberius" /etc/httpd.conf 2>&-;then
  echo "Changed the web admin/tiberius password to random in /etc/httpd.conf!!!"
  pw=$(dd if=/dev/urandom bs=1 count=10 | hexdump | sed -ne 's/ //g;s/^0*//;1p')
  sed -e "s/:tiberius/:$pw/" /etc/httpd.conf > /tmp/httpd.conf.$$
  mv /tmp/httpd.conf.$$ /etc/httpd.conf
fi
