Rational Developer Silent Install doInstall.bat

From MidrangeWiki
Revision as of 23:43, 20 February 2018 by Mattt (talk | contribs)
Jump to: navigation, search
@echo off
setlocal
set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set dt=%date:~10,4%%date:~4,2%%date:~7,2%_%hh%_%time:~3,2%_%time:~6,2%

echo =================================================================
echo Starting RDI Silent Intall %dt%
echo =================================================================

:check_Permissions
    echo Administrative permissions required. Detecting permissions...

    net session >nul 2>&1
    if %errorLevel% neq 0 (
        echo Failure: This script needs to be run as Administrator.
		goto EXIT_1
    )


rem set USER_IM_FOLDER=%1
rem IF ERRORLEVEL 1 (
rem 	set USER_IM_FOLDER="C:\IBM\Installation Manager"
rem ) else if "%USER_IM_FOLDER%"=="" (
rem 	set USER_IM_FOLDER="C:\IBM\Installation Manager"
rem )

echo Checking Installation Manager
IF EXIST "C:\IBM\Installation Manager"\eclipse\IBMIM.exe (
  set USER_IM_FOLDER="C:\IBM\Installation Manager"
) else if EXIST "C:\Program Files\IBM\Installation Manager\eclipse\IBMIM.exe" (
  set USER_IM_FOLDER="C:\Program Files\IBM\Installation Manager"
) else (
  Echo Installation Manager Not Found. 
  echo Install Installation Manager.
  GOTO EXIT_1
)

set RDI_PATCH_FOLDER=C:\Software\RationalDeveloper\RDI_V9.6.0.1
set RDI_INSTALL_FOLDER=C:\Software\RationalDeveloper\RDI_V9.6
set RDI_REMOTE_FOLDER="\\<servername>\Departments\Programming\Downloads\RDi RDp Editors\RDi 9.x\RDI_9.6"
set RDI_INSTALL_SCRIPT=install.xml
set RDI_REMOTE_FILES=%RDI_INSTALL_SCRIPT% RDI_V9.6_CORE_PI_1_EVAL_EMG.zip RDI_V9.6_CORE_PI_2_EVAL_EMG.zip RDI-9.6.0.1-DISK1.zip
set RDI_PRODUCT_INSTALL=C:\IBM\SDP96
set RUN_LOG_FILE=%RDI_INSTALL_FOLDER%\install_log%dt%.xml


rem echo Liset  "%RDI_REMOTE_FILES%"
rem exit /B

C:
IF EXIST %RDI_INSTALL_FOLDER% GOTO HAVE_INSTALL_FOLDER
echo Creating "%RDI_INSTALL_FOLDER%"
mkdir %RDI_INSTALL_FOLDER%
:HAVE_INSTALL_FOLDER
cd %RDI_INSTALL_FOLDER%

echo Using Remote Location: "%RDI_REMOTE_FOLDER%"
echo       Using IM Folder: "%USER_IM_FOLDER%"
echo  Using Install Folder: "%RDI_INSTALL_FOLDER%"

echo Create or Refresh Archives

robocopy %RDI_REMOTE_FOLDER% %RDI_INSTALL_FOLDER% %RDI_REMOTE_FILES% /MT:100
if %errorlevel% gtr 1 (
	echo ROBOCOPY Failed. rc "%errorlevel%"
	GOTO EXIT_1
)

IF NOT EXIST "C:\Program Files\7-Zip"\7z.exe GOTO NO_7ZIP

"C:\Program Files\7-Zip"\7z.exe x RDI_V9.6_CORE_PI_1_EVAL_EMG.zip  -aos -r -o%RDI_INSTALL_FOLDER% 
if %errorlevel% neq 0 (
	echo Unzip failure.  rc "%errorlevel%"
	goto EXIT_1
)
"C:\Program Files\7-Zip"\7z.exe x RDI_V9.6_CORE_PI_2_EVAL_EMG.zip  -aos -r -o%RDI_INSTALL_FOLDER% 
if %errorlevel% neq 0 (
	echo Unzip failure.  rc "%errorlevel%"
	goto EXIT_1
)

"C:\Program Files\7-Zip"\7z.exe x RDI-9.6.0.1-DISK1.zip  -aos -r -o%RDI_PATCH_FOLDER% 
if %errorlevel% neq 0 (
	echo Unzip failure.  rc "%errorlevel%"
	goto EXIT_1
)

GOTO UNZIP_COMPLETE
:NO_7ZIP
echo 7zip not found. Checking if the disk folders have been manually uncompressed.

:UNZIP_COMPLETE
echo Checking: %RDI_INSTALL_FOLDER%\disk1
IF NOT EXIST %RDI_INSTALL_FOLDER%\disk1 (
  echo Folder not found!
  echo          %RDI_INSTALL_FOLDER%\disk1
  echo You might need to uncompress the archive manually.
  echo Archive: %RDI_INSTALL_FOLDER%\RDI_V9.6_CORE_PI_1_EVAL_EMG.zip
  goto EXIT_1
)
echo Found: %RDI_INSTALL_FOLDER%\disk1

echo Checking: %RDI_INSTALL_FOLDER%\disk2
IF NOT EXIST %RDI_INSTALL_FOLDER%\disk2 (
  echo Folder not found!
  echo          %RDI_INSTALL_FOLDER%\disk2
  echo You might need to uncompress the archive manually.
  echo Archive: %RDI_INSTALL_FOLDER%\RDI_V9.6_CORE_PI_2_EVAL_EMG.zip
  goto EXIT_1
)
echo Found: %RDI_INSTALL_FOLDER%\disk2


echo Checking: %RDI_PATCH_FOLDER%\disk1
IF NOT EXIST %RDI_PATCH_FOLDER%\disk1 (
  echo Folder not found!
  echo          %RDI_PATCH_FOLDER%\disk1
  echo You might need to uncompress the archive manually.
  echo Archive: %RDI_INSTALL_FOLDER%\RDI-9.6.0.1-DISK1.zip
  goto EXIT_1
)
echo Found: %RDI_PATCH_FOLDER%\disk1


echo Running installation manager 

IF NOT EXIST %USER_IM_FOLDER%\eclipse\IBMIM.exe (
  echo Installation manager not found.
  echo %USER_IM_FOLDER%\eclipse\IBMIM.exe
  goto EXIT_1
)

rem %USER_IM_FOLDER%\eclipse\IBMIM.exe input %RDI_INSTALL_FOLDER%\%RDI_INSTALL_SCRIPT% -record %RDI_INSTALL_FOLDER%\install%dt%.xml -acceptLicense -skipInstall %RDI_INSTALL_FOLDER%\newinstall%dt% -log %RUN_LOG_FILE%
%USER_IM_FOLDER%\eclipse\IBMIM.exe input %RDI_INSTALL_FOLDER%\%RDI_INSTALL_SCRIPT% -acceptLicense -silent -log %RUN_LOG_FILE%
if %errorlevel% neq 0 (
  echo Installation manager failed. This script probably needs to be run as Administrator.
  IF EXIST %RUN_LOG_FILE% GOTO CHECK_ERROR_LOG
  goto EXIT_1
)

rem create new install script using -record and -skipInstall
rem we can build update recordings by using the same agentDataLocation folder argument.
rem %USER_IM_FOLDER%\eclipse\IBMIM.exe input %RDI_INSTALL_FOLDER%\install.xml -record %RDI_INSTALL_FOLDER%\install%dt%.xml -acceptLicense    -skipInstall %RDI_INSTALL_FOLDER%\newinstall%dt% -log %RUN_LOG_FILE%

:ECLIPSE_INI

Echo Replacing %RDI_PRODUCT_INSTALL%\eclipse.ini with the version from %RDI_REMOTE_FOLDER%\eclipse.ini
robocopy %RDI_REMOTE_FOLDER% %RDI_PRODUCT_INSTALL% eclipse.ini /MT:100
if %errorlevel% gtr 1 (
	echo copy of eclipse.ini failed. rc "%errorlevel%"
	goto EXIT_1
)


:CHECK_ERROR_LOG

echo Install Finished. Checking error log for errors.
rem Check If the error log contains anything other than the default warning.
FC /lb1 /0 %RDI_REMOTE_FOLDER%\install_log_warningonly.xml %RUN_LOG_FILE% >NUL 2>&1
if %errorlevel% neq 0 GOTO HAVE_ERRORS_IN_LOG
del %RUN_LOG_FILE%
echo =================================================================
echo Install Complete %dt%. No Errors Found.
echo =================================================================
goto EXIT_0

:HAVE_ERRORS_IN_LOG
echo =================================================================
echo Check Log for errors "%RUN_LOG_FILE%"
echo =================================================================
type %RUN_LOG_FILE%

:EXIT_1
echo Exit With Failure
echo =================================================================
pause
exit /b 1

:EXIT_0
echo =========================end=====================================
pause
exit /b