@ECHO OFF

REM Main script for setting up the web server, including the domain, and preparing the related windows services
REM During the process, various hard coded values in the files will be replaced with the variables defined in this batch file
REM Make sure this script is Run As Administrator, so that the needed Windows service can be installed as well

REM These are the variables that should be set up before you execute this script.

NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
    ECHO.
    ECHO [ERROR] Please run this script as Administrator.
    ECHO Press Enter to exit...
    PAUSE >nul
    EXIT /B
)

:SETUPVARIABLES

SET ABS_WEBSERVERHOME=%~dp0
SET ABS_WEBSERVERSLOT=[ABS_WEBSERVERSLOT]

SET ABS_WEBSERVERSERVICENAME=[ABS_WEBSERVERSERVICENAME]

ECHO  You specified the following values:
ECHO  ABS_WEBSERVERHOME:          %ABS_WEBSERVERHOME%
ECHO  ABS_WEBSERVERSLOT:          %ABS_WEBSERVERSLOT%
ECHO  ABS_WEBSERVERSERVICENAME:   %ABS_WEBSERVERSERVICENAME%

SET CHOOSE=N
SET /P CHOOSE=Do you want to uninstall Tomcat %ABS_WEBSERVERSERVICENAME% service installation? ( Type Y for Yes )
IF /I NOT %CHOOSE%==Y GOTO SETUPVARIABLES

call %ABS_WEBSERVERHOME%custom\install\uninstall.bat %ABS_WEBSERVERHOME% %ABS_WEBSERVERSLOT% %ABS_WEBSERVERSERVICENAME%