@echo off
REM *********************************************************
REM CallPilot 5.0 High Availability Configuration script
REM 
REM 21/04/2006 Wilfred Gaube Create the script
REM *********************************************************
@cls
@echo.
@echo CallPilot 5.0 High Availability AutoStart Configuration Utility
@echo.

REM Make sure we are passed a parameter with the AutoStart Domain name
@if "%1"=="" goto USAGE

REM Make sure the install directory exists and matches the autostart domain name
@set EMCDir=D:\Program Files\Legato AAM
@echo EMC Autostart domain = %1
@echo EMC Autostart directory = %EMCDir%
@if not EXIST "%EMCDir%\%1" goto WRONGEMCDIR

@echo.
@echo Please choose one of the following:
@echo 1. Configure a CallPilot server with 1 MPB96 board installed
@echo 2. Configure a CallPilot server with 3 MPB96 boards installed
@echo 3. Exit
@echo.
CHOICE /C:123
IF ERRORLEVEL 3 GOTO EXIT
IF ERRORLEVEL 2 GOTO THREEMPB96
IF ERRORLEVEL 1 GOTO ONEMPB96
GOTO END

:THREEMPB96
@echo.
@echo Launching Three MPB96 Configuration script
@echo.
CALL "%EMCDir%\%1\bin\ftPerl" install.pl CallPilot-Mirroring %1 "%EMCDir%"
GOTO END

:ONEMPB96
@echo.
@echo Launching Single MPB96 Configuration script
@echo.
CALL "%EMCDir%\%1\bin\ftPerl" install.pl CallPilot-Mirroring-Single %1 "%EMCDir%"
GOTO END

:WRONGEMCDIR
@echo.
@echo Error: AutoStart directory does not exist.
@echo. 
@echo Based on the AutoStart domain name %s, the directory where the AutoStart
@echo software should be installed in is %EMCDir%, however this directory does
@echo not exist. Please confirm that the supplied AutoStart domain name is 
@echo correct and that the AutoStart software is installed in the correct directory.
@echo.

:EXIT
@echo.
@echo Exiting the utility at the users request.
GOTO END

:USAGE
@echo.
@echo The correct usage for this utility is:
@echo     install.bat [AutoStart domain name]
@echo     Where:
@echo        [AutoStart domain name] Is the domain name entered during the EMC
@echo                                AutoStart Agent installation.   
@echo.
@echo The AutoStart domain name it can be found by opening the services
@echo control panel and examining the name of the EMC AutoStart Agent
@echo or Backbone service. The services have the following format:
@echo     EMC AutoStart - [AutoStart domain name] Agent
@echo     EMC AutoStart - [AutoStart domain name] Backbone
@echo.
GOTO END

:END
@echo.
@echo Done
@echo.