+# todo: ssl support is not default for apache.
+# + update scripts to allow both https/http.
+# + add log axis patch.
+
+
+########################################3
+
+if [ -z "$SETUP_IP" ] ; then
+ export IP=`ip addr show eth0 | grep -E "eth0$|eth0:[[:digit:]]+$" | tr '/' ' ' | awk '{print $2}'`
+else
+ export IP=$SETUP_IP
+fi
+if [ -z "$SETUP_HOST" ] ; then
+ if ! rpm -q bind-utils > /dev/null ; then
+ yum install -y bind-utils
+ fi
+ export HOST=`host $IP | cut -d ' ' -f 5 | tr [A-Z] [a-z] | sed -e 's/\.$//g'`
+else
+ export HOST=$SETUP_HOST
+fi
+
+echo "---------------------------------------------------------------"
+echo "setup.sh will configure your system using the following values:"
+echo "IP: $IP"
+echo "HOSTNAME: $HOST"
+echo ""
+echo "You can manually set the IP and HOST, by setting shell variables:"
+echo "export SETUP_IP="
+echo "export SETUP_HOST="
+echo "Proceed? (yes/no):"
+while read userinput ; do
+ if [[ -z "$userinput" ]] ; then
+ echo "Assuming this is correct."
+ break
+ fi
+ if [[ "$userinput" = "yes" || "$userinput" = "y" ]] ; then
+ break
+ fi
+ if [[ "$userinput" = "no" || "$userinput" = "n" ]] ; then
+ exit
+ fi
+done
+