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

From MidrangeWiki
Jump to: navigation, search
 
Line 125: Line 125:
 
Silent install XML script used by installer
 
Silent install XML script used by installer
 
<pre>
 
<pre>
 +
install.xml
 
<?xml version='1.0' encoding='UTF-8'?>
 
<?xml version='1.0' encoding='UTF-8'?>
 
<agent-input clean='true'>
 
<agent-input clean='true'>

Latest revision as of 15:48, 21 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>\[download_folder]"
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

Silent install XML script used by installer

install.xml
<?xml version='1.0' encoding='UTF-8'?>
<agent-input clean='true'>
  <variables>
	<variable name='sharedLocation' value='C:\IBM\SDPShared'/>
	<variable name='installLocation' value='C:\IBM\SDP96'/>
	<variable name='profile' value='IBM Software Delivery Platform_96'/>
  </variables>
  <server>
    <repository location='C:\Software\RationalDeveloper\RDI_V9.6.0.1'/>
    <repository location='\\gofs\Departments\Programming\Downloads\RDi RDp Editors\RDi 9.x\RDI_9.6\com.ibm.rational.developer.ibmi.rpgcobol.v96.pek.jar'/>
	<repository location='C:\Software\RationalDeveloper\RDI_V9.6'/>
  </server>
  <profile id='${profile}' installLocation='${installLocation}'>
    <data key='cic.selector.arch' value='x86_64'/>
  </profile>
  <install>
    <!-- IBM® Rational® Developer for i 9.6.0.1 -->
    <offering profile='${profile}' id='com.ibm.rational.developer.ibmi.v96' version='9.6.1.20171205_1338' features='com.ibm.rdi.sdpcore,com.ibm.rdi.jre,com.ibm.rdi.rpgtools,com.ibm.rdi.rpgtools.egit'/>
	<offering id='com.ibm.rational.developer.ibmi.rpgcobol.v96.pek.offering' version='9.0.1.20171002_1405' features='main.feature'/>
  </install>
  <preference name='com.ibm.cic.common.core.preferences.eclipseCache' value='${sharedLocation}'/>
</agent-input>