#!/bin/sh
# By Hedayat Vatankhah <hedayat@grad.com>, 2009

# Servers Settings
echo -n "Server IP address: "
read SERVER

EX_MONITOR=true
echo -n "Will you use an external monitor instead of the internal one? [Y/n]" 
read ans
case $ans in
[nN]*)
    EX_MONITOR=false
;;
esac

MONITOR_CLIENT=
if [ "$EX_MONITOR" = "true" ]; then
    echo -n "Monitor client IP address: "
    read MONITOR_CLIENT
fi

echo -n "1st client IP address: "
read CLIENT1

echo -n "2nd client IP address: "
read CLIENT2

echo "# Server/Client settings"
echo "SERVER=$SERVER" > ${HOME}/.rclm3D
echo "USE_EXTERNAL_MONITOR=$EX_MONITOR" >> ${HOME}/.rclm3D
echo "MONITOR_CLIENT=$MONITOR_CLIENT" >> ${HOME}/.rclm3D
echo "CLIENT1=root@$CLIENT1" >> ${HOME}/.rclm3D
echo "CLIENT2=root@$CLIENT2" >> ${HOME}/.rclm3D
echo  >> ${HOME}/.rclm3D

INSTALL_DIR="/usr/"
echo -n "Get the server installation directory (default: $INSTALL_DIR): "
read SIMDIR
if [ -n "$SIMDIR" ]; then
    INSTALL_DIR="$SIMDIR"
fi

echo "# Simulator settings" >> ${HOME}/.rclm3D
echo "SERVER_PREFIX_DIR=\"$INSTALL_DIR\"" >> ${HOME}/.rclm3D
echo "SOCCERSIM_CONF=naosoccersim.rb" >> ${HOME}/.rclm3D
echo "TOTAL_GAME_TIME=600" >> ${HOME}/.rclm3D

echo
echo "* Default values: "
echo "   Total game time=600 seconds (10 min)"
echo "   Soccersim config file=naosoccersim.rb"
echo "Please edit ${HOME}/.rclm3D if needed."
echo
echo "Good luck! :)"

