@echo off
REM ######################################################################
REM #  Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
REM #  vganesan   01/10/14    Clean up all other product code, invoke only OPatchauto
REM #                         OMS
REM #  skkurapa   10/03/13    Initial Creation
REM ######################################################################

setlocal enabledelayedexpansion

REM # Set the base path
set BASE=%~DP0%


REM # Look for debug env variable
set DEBUG=%OMSPATCHER_DEBUG%

REM # Check for OMSPATCHER_DEBUG
set DEBUGVAL=false
if "%DEBUG%" == "TRUE" (set DEBUGVAL=true) else if "%DEBUG%" == "true" (set DEBUGVAL=true) 

set PARAMS=%*
set PARAMS=%PARAMS% 

if NOT "%DEBUGVAL%" == "true" goto CALLOPATCHAUTONODEBUG
echo Command to execute: %BASE%\scripts\oms\omspatcher.bat %PARAMS%
:CALLOPATCHAUTONODEBUG
%BASE%\scripts\oms\omspatcher.bat %PARAMS%

:OPATCHAUTODONE
set RESULT=%ERRORLEVEL%
if %ERRORLEVEL% == 0 goto SUCCEXIT
if NOT %ERRORLEVEL% ==0  goto FAILEXIT

:FAILEXIT
echo.
echo OMSPatcher failed with error code = %RESULT%
goto EXIT

:SUCCEXIT
echo.
echo OMSPatcher succeeded.
goto EXIT

:EXIT
exit /b %RESULT%
