Difference between revisions of "Rational Developer Silent Install doInstallationManager.bat"

From MidrangeWiki
Jump to: navigation, search
Line 29: Line 29:
 
set IM_INSTALL_FOLDER="C:\Software\RationalDeveloper\InstallationManager"
 
set IM_INSTALL_FOLDER="C:\Software\RationalDeveloper\InstallationManager"
 
set IM_PRODUCT_INSTALL="C:\IBM\Installation Manager"
 
set IM_PRODUCT_INSTALL="C:\IBM\Installation Manager"
set IM_REMOTE_FOLDER="\\gofs\Departments\Programming\Downloads\RDi RDp Editors\RDi 9.x\RDI_9.6"
+
set IM_REMOTE_FOLDER="\\<servername>\Departments\Programming\Downloads\RDi RDp Editors\RDi 9.x\RDI_9.6"
 
set IM_REMOTE_FILES=%IM_VERSION%.zip
 
set IM_REMOTE_FILES=%IM_VERSION%.zip
  

Revision as of 23:44, 20 February 2018

@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 Installation Manager Install %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
    )

set USER_IM_FOLDER=%1
IF ERRORLEVEL 1 (
	set USER_IM_FOLDER="C:\IBM\Installation Manager"
) else if "%USER_IM_FOLDER%"=="" (
	set USER_IM_FOLDER="C:\IBM\Installation Manager"
)
set IM_VERSION=agent.installer.win32.win32.x86_64_1.8.7001.20170920_1141
set IM_ARCHIVE=%IM_VERSION%.zip
REM set IM_INSTALL_FOLDER=C:\Software\RationalDeveloper\InstallationManager\%IM_VERSION%
set IM_INSTALL_FOLDER="C:\Software\RationalDeveloper\InstallationManager"
set IM_PRODUCT_INSTALL="C:\IBM\Installation Manager"
set IM_REMOTE_FOLDER="\\<servername>\Departments\Programming\Downloads\RDi RDp Editors\RDi 9.x\RDI_9.6"
set IM_REMOTE_FILES=%IM_VERSION%.zip

set RUN_LOG_FILE=%IM_INSTALL_FOLDER%\install_log%dt%.xml


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

IF EXIST %IM_INSTALL_FOLDER%\%IM_VERSION% GOTO HAVE_INSTALL_FOLDER_VERSION
echo Creating "%IM_INSTALL_FOLDER%\%IM_VERSION%"
mkdir %IM_INSTALL_FOLDER%\%IM_VERSION%
:HAVE_INSTALL_FOLDER_VERSION


echo Using Remote Location: "%IM_REMOTE_FOLDER%"
echo  Using Install Folder: "%IM_INSTALL_FOLDER%"

echo Create or Refresh Archives

robocopy %IM_REMOTE_FOLDER% %IM_INSTALL_FOLDER% %IM_ARCHIVE% /MT:100
if %errorlevel% gtr 1 (
	echo ROBOCOPY Failed. rc "%errorlevel%"
	GOTO EXIT_1
)
echo Copy Complete

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

"C:\Program Files\7-Zip"\7z.exe x %IM_ARCHIVE%  -aos -r -o%IM_INSTALL_FOLDER%\%IM_VERSION%
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 Installation Manager Installer. Log %RUN_LOG_FILE%

IF NOT EXIST %IM_INSTALL_FOLDER%\%IM_VERSION%\installc.exe (
  echo Installation manager Installer not found.
  echo %IM_INSTALL_FOLDER%\%IM_VERSION%\installc.exe
  goto EXIT_1
)

%IM_INSTALL_FOLDER%\%IM_VERSION%\installc.exe -log %RUN_LOG_FILE% -acceptLicense -installationDirectory %IM_PRODUCT_INSTALL%
if %errorlevel% neq 0 (
  echo Installation manager Install failed. This script probably needs to be run as Administrator.
  IF EXIST %RUN_LOG_FILE% goto HAVE_ERRORS_IN_LOG
  goto EXIT_1
)


:CHECK_ERROR_LOG

echo Install Finished. Checking error log for errors.
IF NOT EXIST %RUN_LOG_FILE% goto NO_ERRORS_FOUND

rem Check If the error log contains anything other than the default warning.
FC /lb1 /0 %IM_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%
:NO_ERRORS_FOUND
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