#!/bin/bash

#Don't migrate if old config files are not found
MIGRATE=0

if [ -f /etc/httpd/conf/httpd.conf ];then
  echo "Migrating httpd.conf to Apache 2.0"
  /usr/share/ADVX/advx-migrate-httpd.conf
  MIGRATE=1
fi
if [ -f /etc/httpd/conf/httpd-perl.conf ];then
  echo "Migrating httpd-perl.conf to Apache 2.0"
  /usr/share/ADVX/advx-migrate-httpd-perl.conf
  MIGRATE=1
fi

if [ $MIGRATE = "1" ];then
  if [ -f /etc/httpd/conf/commonhttpd.conf ];then
    echo "Migrating commonhttpd.conf to Apache 2.0"
    /usr/share/ADVX/advx-migrate-commonhttpd.conf
  fi
  if [ -f /etc/httpd/conf/vhosts/Vhosts.conf ];then
    echo "Migrating Vhosts.conf to Apache 2.0"
    /usr/share/ADVX/advx-migrate-vhosts.conf
  fi
fi

if [ ! -f /var/www/html/index.shtml -a ! -f /etc/sysconfig/oem -a -r /var/www/html/index-default.shtml ]; then
    cd /var/www/html
    ln -s index-default.shtml index.shtml
fi
