@echo off :: EDEN Installer Script Library (_instlib.cmd), version 2.1.03 :: 26 Aug 2003 :: WINDOWS NT/2000 Edition :: justin.f.mercier@boeing.com ::::::::::::::::::::::::::::::::::: :: SCRIPT FUNCTION CALL RECEPTOR :: ::::::::::::::::::::::::::::::::::: :: Preamble - Check to see if a procedure was called, if not exit nicely. :: Executes the specified specified in argument 1, shifts the args, and calls the function. @set RET= @if not "%ECHO%"=="" echo %ECHO% if {%1}=={} ( echo Script Library ^(%0^) Version %LIBVERSION% echo Called with no arguments, no procedure to run! pause goto :EOF ) :: Parse called procedure from args and shift arguments set _PROC=%1 shift /0 goto %_PROC% ::::::::::::::::::::::::::::::::::::::: :: END SCRIPT FUNCTION CALL RECEPTOR :: ::::::::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::: :: CALL FUNCTION makeSrcDir :: :::::::::::::::::::::::::::::: :: if SRCDIR is not specified in INI then generate it relative to the scriptpath :: assumes that %SCRIPTPATH% is realtive to %PACKAGE% :makeSrcDir set SRCDIR=%SCRIPTPATH%\.. pushd "%SRCDIR%" for /f "tokens=*" %%a in ('cd') do set SRCDIR=%%a %TRACE% defaulting src_dir %SRCDIR% popd goto :EOF :::::::::::::::::::::::::::::::::: :: END CALL FUNCTION makeSrcDir :: :::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::::::: :: CALL FUNCTION - setDateStamp :: :::::::::::::::::::::::::::::::::: :: called to set a generic datetime stamp :setDateStamp %TRACE% Called %LIBFILE% %* :: Grab date and time and set respective vars FOR /f "tokens=2-4 delims=/ " %%a in ('DATE/T') do SET sdate=%%c-%%a-%%b FOR /f "tokens=1-2 delims=: " %%a in ('TIME/T') do SET stime=%%a%%b if {%stime%} LEQ {999} set stime=0%stime% set datetime=%sdate%-%stime% goto :EOF :::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - setDateStamp :: :::::::::::::::::::::::::::::::::::::: ******************************************************************* ::::::::::::::::::::::::::::: :: CALL FUNCTION - OSCHECK :: ::::::::::::::::::::::::::::: :: Check to see if OS is NT based, and if so, detect which version. Otherwise return code 1. :OSCHECK %TRACE% Called %LIBFILE% %* setlocal & set RET= %TRACE% Checking OS... :: run silent version commands, the one that succeeds will set the NTREV variable ver | find "2000" >nul && (set NTREV=2000& set RET=0) ver | find "NT" >nul && (set NTREV=NT& set RET=0) ver | find "XP" >nul && (set NTREV=XP& set RET=0) :: if none of the version commands succeeded, then NTREV will be undefined. Return status 1 to the caller. if not defined NTREV ( %TRACE% Could not determine OS version. endlocal & set RET=1& set NTREV=UNKNOWN& goto :EOF ) :: Otherwise, one of the version commands worked, so return status 0 and NTREV to the caller. %TRACE% NT Release is %NTREV% :: Close local scope after passing necessary vars endlocal & set RET=%RET% & set NTREV=%NTREV% goto :EOF ::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - OSCHECK :: ::::::::::::::::::::::::::::::::: ******************************************************************* ::::::::::::::::::::::::::: :: CALL FUNCTION readINI :: ::::::::::::::::::::::::::: :readINI :: Read the configuration from the accompanying INI file and pass through FOR. :: All vars are processed and sent to the Variable Resolver to qualify all variables in values. :: For instance, LOG=%TEMP%\logfile.txt will be resolved to C:\TEMP\logfile.txt. %TRACE% Called %LIBFILE% %* if {%OUTMODE%} NEQ {silent} call :readINIdrawScreen :: Added so that INI entries with %SRCDIR% can resolve if SRCDIR is not defined in the INI if not defined SRCDIR call :makeSrcDir if not defined %INIFILE% ( %TRACE% ini file not defined.... attempting to default to edenrc.ini. set INIFILE=edenrc.ini ) if not exist "%INIFILE%" ( echo Required INI file ^(%INIFILE%^) could not be found.%OUTPUTDIRECT% echo The installer will exit. set RET=1&set STAGE1=ERROR& goto :EOF ) :: parse the INI, ignoring fields that begin with a colon, and using the equals sign as the the field delimiter for /f "eol=: tokens=1,2 delims==" %%a in (%INIFILE%) do set %%a=%%b& call :resolveVar %%a :: Check for absolutley required INI entries if not defined PACKAGE ( echo Mandatory %INIFILE% entry is missing for PACKAGE.%OUTPUTDIRECT% echo The installation cannot continue. set RET=1& goto :EOF ) if not defined PACKAGEVERSION ( echo Mandatory %INIFILE% entry is missing for PACKAGEVERSION.%OUTPUTDIRECT% echo The installation cannot continue. set RET=1& goto :EOF ) if not defined ROOTVAR ( echo Mandatory %INIFILE% entry is missing for ROOTVAR.%OUTPUTDIRECT% echo The installation cannot continue. set RET=1& goto :EOF ) :: Determine source installation directory if not defined in the INI file if not defined SRCDIR call :makeSrcDir if not defined PACKAGENAME ( if defined SERVICEPACKVERSION ( if {%SERVICEPACKVERSION%} NEQ {NONE} ( set PACKAGENAME=%PACKAGE% %PACKAGEVERSION% %SERVICEPACKVERSION% ) else ( set PACKAGENAME=%PACKAGE% %PACKAGEVERSION% ) ) else ( set PACKAGENAME=%PACKAGE% %PACKAGEVERSION% ) ) title %TITLE% - %PACKAGENAME% set RET=0& set STAGE1=OK& goto :EOF :::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - readINIdrawScreen :: :::::::::::::::::::::::::::::::::::::::::: :: draw the interactive screen :readINIdrawScreen %CLS% %cout% EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGE%%OUTPUTDIRECT% %cout% SOURCE: --UNDETERMINED--%OUTPUTDIRECT% %cout% TARGET: --UNDETERMINED--%OUTPUTDIRECT% %cout%. %cout% [STAGE 1] -- READ INSTALLATION CONFIGURATION FILE --%OUTPUTDIRECT% color 1F %cout%. %cout%. %cout%. %cout%. %cout%. %cout%. %cout% The installer is reading the configuration file and preparing the installation. %cout% Please wait.... goto :EOF :::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - readINIdrawScreen :: :::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::: :: END CALL FUNCTION readINI :: ::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::: :: CALL FUNCTION resolveVar :: :::::::::::::::::::::::::::::: :: takes a variable name passed as argument 1 and expands any variables in it value :: thus if VAR1=%TEMP% it would be expanded to VAR1=C:\TEMP :resolveVar %TRACE% Called %0 %* :: Make sure that the for loop that called this didn't set SRCDIR to null, :: which may cause recursion errors on following vars which depend on it. :: if SRCDIR is null, set it and exit before local scope declared if {%1} EQU {SRCDIR} ( if not defined SRCDIR ( call :makeSrcDir set RET=0& goto :EOF echo on ) ) :: otherwise setlocal scope and process each var :: it first checks to make sure that a var was passed as arg1 :: it then checks to see if it is a set variable (within the script's scope) :: it then sets varname to be equal to the variable name and sets :: varToResolve to be it's value. :: it then sends it through a for loop that sets it repeatedly until the :: value is expanded (i.e. it is the same two loops in a row) :: each loop is counted and it will abort if 100 loops are reached, which would :: be an amazing circumstance. setlocal & set RET= if {%1}=={} ( %TRACE% %0: No var passed to resolve. endlocal & set RET=1& goto :EOF ) if not defined %1 ( %TRACE% %0: Received %1 but no value passed to resolve endlocal & set RET=1& goto :EOF ) set varname=%1 set varToResolve=%%%1%% set count=0 :loop if {%count%} EQU {100} ( echo %0 could not recurse %varname%, reached 100 loops %OUTPUTDIRECT% endlocal & set RET=1& goto :EOF ) set IsVarRecursed=%varToResolve% %TRACE% Processing %1 with value %IsVarRecursed%. for /f "tokens=*" %%I in ('echo %varToResolve%') do set varToResolve=%%I %TRACE% %1 recursed as %varToResolve%. if "%varToResolve%" NEQ "%IsVarRecursed%" ( set /a count+=1 goto :loop ) ELSE ( %TRACE% %1 processed as %varToResolve%. endlocal & set %varname%=%varToResolve%& set RET=0& echo %ECHO%& goto :EOF ) :: Should have exitted via a loop branch, but this is put here to avoid inadvertant bleed over into next function. endlocal & set RET=1& goto :EOF :::::::::::::::::::::::::::::::::: :: END CALL FUNCTION resolveVar :: :::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::::: :: CALL FUNCTION - detectEDGE :: :::::::::::::::::::::::::::::::: :: Check for EDGE_HOME to see if EDGE is installed :: Modified to handle situations where EDGE_HOME is set but EDGE is not installed. :detectEDGE %TRACE% Called %LIBFILE% %* setlocal & set RET= %TRACE% Checking for EDGE... :: if we are in interactive mode then draw a menu if {%OUTMODE%} NEQ {silent} ( %CLS% echo EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME%%OUTPUTDIRECT% echo SOURCE: --%SRCDIR%\%PACKAGE%--%OUTPUTDIRECT% echo TARGET: --UNDETERMINED--%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo [STAGE 2] -- VERIFY EDGE/BATTLESCAPE INSTALLATION --%OUTPUTDIRECT% color 1F echo.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% ) :: check to see if required EDGE_HOME is defined, if not call NOEDGE :: check to see if Edge is installed where it should be, if not call NOEDGE if NOT DEFINED EDGE_HOME ( set ENIREASON=1 call :NOEDGE endlocal & set RET=1& goto :EOF ) ELSE ( if NOT EXIST "%EDGE_HOME%" ( set ENIREASON=2 call :NOEDGE endlocal & set RET=1& goto :EOF ) ) :: Otherwise EDGE is installed so carry on my wayward son echo BattleScape detected in %EDGE_HOME%%OUTPUTDIRECT% set STAGE2=VERIFIED endlocal & set RET=0& set STAGE2=%STAGE2%& goto :EOF ::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - NOEDGE :: ::::::::::::::::::::::::::::::: :: reports missing EDGE installation and exits :NOEDGE %TRACE% called %* color c0 echo ***ERROR: BattleScape does not appear to be installed!%OUTPUTDIRECT% if ENIREASON == "1" ( set ENIEXPLAIN=Required EDGE_HOME variable not set. ) ELSE ( set ENIEXPLAIN=Required EDGE_HOME variable set but the path does not exist. ) echo.%OUTPUTDIRECT% %TRACE% **CRITICAL ERROR in proc %0 echo The %PACKAGE% installation was aborted because BattleScape was not%OUTPUTDIRECT% echo detected on this system. Please install BattleScape and/or%OUTPUTDIRECT% echo verify that the system variable EDGE_HOME is set to the correct%OUTPUTDIRECT% echo BattleScape installation directory.%OUTPUTDIRECT% if {%OUTMODE%} NEQ {silent} echo Press any key to exit installation...& pause >nul set RET=1& goto :EOF ::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - NOEDGE :: ::::::::::::::::::::::::::::::::::: :: we shouldn't get here as we should have branched, added to debug script flow echo reached end of function %LIBFILE% %* without taking an expected branch!%OUTPUTDIRECT% pause endlocal & set RET=1& goto :EOF :::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - detectEDGE :: :::::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::::: :: CALL FUNCTION - detectEden :: :::::::::::::::::::::::::::::::: :: Check for ROOTVAR (i.e. EDEN_ROOT) to see if the package is already installed :: Modified to handle situations where ROOTVAR is set but the EDEN package is not installed. :detectEden if {%OUTMODE%} NEQ {silent} call :detectEdenDrawScreen %TRACE% Called %LIBFILE% %* %TRACE% Checking for %PACKAGE% :: ROOTVAR should have been specified in the INI, if not default to EDEN_ROOT if not defined ROOTVAR set ROOTVAR=EDEN_ROOT :: Otherwise if the value of ROOTVAR (i.e. EDEN_ROOT) is defined then check to see :: if ROOTDIR is set. If not, set it to the value of ROOTVAR and send it to the resolveVar :: to expand it to the full path in the ROOT variable. Once done run it through :: detectEdenCheckRootDir to see if the path in fact exists. If it does, set PREVIOUS to YES :: otherwise set it to NO which is critical when the installer itself is called. :: If ROOTDIR was defined in INI then check to see if matches the path of the existing install. :: If it does, actually verify that it is there by checking for the EXE. if defined %ROOTVAR% ( if not defined ROOTDIR ( set ROOTDIR=%%%ROOTVAR%%% call :resolveVar ROOTDIR call :detectEdenCheckRootDir ) ELSE ( call :checkPreviousAgainstINISpecified if defined PREVNOTMATCH ( set PREVIOUS=NO set PREVNOTMACH= goto :EOF ) ELSE ( if exist "%ROOTDIR%"\bin\%PACKAGE%.exe ( set PREVIOUS=YES set PREVIOUS_ROOT=%ROOTDIR% echo Previous %PACKAGE% installation detected:%OUTPUTDIRECT% echo %ROOTDIR%\bin\%PACKAGE%.exe.%OUTPUTDIRECT% ) ELSE ( set PREVIOUS=NO %TRACE% %PACKAGE%.exe not found in %ROOTDIR%\bin\, assuming no prior installation. ) ) ) ) ELSE ( %TRACE% %ROOTVAR% not defined. Assuming no previous installation. set PREVIOUS=NO ) set RET=0& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - detectEdenDrawScreen :: ::::::::::::::::::::::::::::::::::::::::::::: :: draw the interactive screen :detectEdenDrawScreen %CLS% %cout% EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGE%%OUTPUTDIRECT% %cout% SOURCE: --%SRCDIR%--%OUTPUTDIRECT% %cout% TARGET: --UNDETERMINED--%OUTPUTDIRECT% %cout%. %cout% [STAGE 3] -- DETECT EXISTING INSTALLATIONS --%OUTPUTDIRECT% color 1F %cout%. %cout%. %cout%. %cout%. %cout%. %cout%. %cout% The installer is detecting any previous installations. %cout% Please wait.... %cout%. goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - detectEdendrawScreen :: ::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - detectEdenCheckRootDir :: ::::::::::::::::::::::::::::::::::::::::::::::: :: Break loop to force var expansion of ROOTDIR and check its validity :detectEdenCheckRootDir %TRACE% Called %* %TRACE% checking rootdir, it is %ROOTDIR%. if defined ROOTDIR ( if exist "%ROOTDIR%" ( set PREVIOUS_ROOT=%ROOTDIR% set PREVIOUS=YES ) ELSE ( set PREVIOUS=NO set %ROOTVAR%= set ROOTDIR= ) ) ELSE ( set PREVIOUS=NO set %ROOTVAR%= ) %TRACE% :0 - previous is %PREVIOUS% goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - detectEdenCheckRootDir :: ::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - checkPreviousAgainstINISpecified :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Check to see if an alternate install path other than the existing installation is specified :checkPreviousAgainstINISpecified set PROOTDIR=%%%ROOTVAR%%% call :resolveVar PROOTDIR if {"%PROOTDIR%"} NEQ {"%ROOTDIR%"} ( echo.%OUTPUTDIRECT% echo Previous installation found in:%OUTPUTDIRECT% echo -----%PROOTDIR%%OUTPUTDIRECT% echo which does not match the specified installation path:%OUTPUTDIRECT% echo -----%ROOTDIR%%OUTPUTDIRECT% echo The previous installation will be left intact but %ROOTVAR%%OUTPUTDIRECT% echo will be reset to point to the new installation.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% if {%OUTMODE%} NEQ {silent} echo Press any key to continue installation...& pause >nul set PREVNOTMATCH=NO ) set RET=0& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - checkPreviousAgainstINISpecified :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: we shouldn't get here as we should have branched, added to debug script flow echo reached end of function %LIBFILE% %* without taking an expected branch!%OUTPUTDIRECT% pause endlocal & set RET=1& goto :EOF :::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - detectEden :: :::::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::::: :: CALL FUNCTION - getVersion :: :::::::::::::::::::::::::::::::: :: Check to see what version of ICSAS is already installed :getVersion setlocal & pushd %ROOTDIR%\bin if exist %VERSIONFILE% ( for /f "eol=: tokens=1,2 delims==" %%a in (%VERSIONFILE%) do set %%a=%%b& call :resolveVar %%a ) ELSE ( %TRACE% %VERSIONFILE% not found. Assuming a version earlier than ICSAS 2.3.3 SP1. %cout% The version file was not found in the previous installation. %cout% Assuming an earlier release. ) if not defined VERSIONINSTALLED ( %TRACE% VERSIONINSTALLED not found in %VERSIONFILE%. endlocal & popd & goto :EOF ) if not defined SERVICEPACKINSTALLED ( %TRACE% SERVICEPACKINSTALLED not found in %VERSIONFILE%. endlocal & popd & goto :EOF ) endlocal & popd & set VERSIONINSTALLED=%VERSIONINSTALLED%& set SERVICEPACKINSTALLED=%SERVICEPACKINSTALLED%& goto :EOF :::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - getVersion :: :::::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::::::: :: CALL FUNCTION - checkVersion :: :::::::::::::::::::::::::::::::::: :: Check to ensure that the minimum version requirements are met :checkVersion if not defined VERSIONMINIMUM ( %TRACE% no miminum version specified in the ini file, no version checking necessary. set RET=0& goto :EOF ) else ( if {%VERSIONMINIMUM%} EQU {NONE} ( %TRACE% no miminum version specified in the ini file, no version checking necessary. call :checkForNewerOrSameVersion set RET=0& goto :EOF ) ) if {%PREVIOUS%} EQU {NO} ( if {%VERSIONMINIMUM%} NEQ {NONE} ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo The minimum %PACKAGE% version required to install this distribution is: %VERSIONMINIMUM%%OUTPUTDIRECT% echo However no existinv version of ICSAS was detected on this system.%OUTPUTDIRECT% %cout%. echo The installation will be aborted.%OUTPUTDIRECT% echo Please verify your version and rerun the installer in interactive mode.%OUTPUTDIRECT% set RET=1& goto :EOF ) ) if not defined VERSIONINSTALLED ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo The minimum %PACKAGE% version required to install this distribution is: %VERSIONMINIMUM%%OUTPUTDIRECT% echo However the version of your existing installation can not be determined.%OUTPUTDIRECT% if {%OUTMODE%} EQU {silent} ( echo The installation will be aborted.%OUTPUTDIRECT% echo Please verify your version and rerun the installer in interactive mode.%OUTPUTDIRECT% set RET=1& goto :EOF ) echo. echo If you are certain that you are are running at least echo. echo %PACKAGE% %VERSIONMINIMUM% echo. echo then you can choose to continue. Otherwise you should abort the installation echo as installing this distribution may lead to an unusable installation. echo. echo. echo Press any key to continue with the installation or CTRL-C to exit.&pause >nul set RET=0& goto :EOF ) else ( call :checkForNewerOrSameVersion if "%VERSIONMINIMUM%" GTR "%VERSIONINSTALLED%" ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo The minimum %PACKAGE% version required to install this distribution is: %VERSIONMINIMUM%%OUTPUTDIRECT% echo However the version of your existing installation is: %VERSIONINSTALLED%%OUTPUTDIRECT% %cout%. echo The installation will be aborted.%OUTPUTDIRECT% set RET=1& goto :EOF ) else ( if "%VERSIONMINIMUM%" LSS "%VERSIONINSTALLED%" ( set RET=0& goto :EOF ) ) ) if not defined SERVICEPACKMINIMUM ( %TRACE% no miminum service pack specified in the ini file, no version checking necessary. set RET=0& goto :EOF ) else ( if {%SERVICEPACKMIMIMUM%} EQU {NONE} ( %TRACE% no miminum service pack specified in the ini file, no version checking necessary. set RET=0& goto :EOF ) ) if "%VERSIONINSTALLED%" GTR "%VERSIONMINIMUM%" ( set RET=0& goto :EOF ) if not defined SERVICEPACKINSTALLED ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo The minimum %PACKAGE% %PACKAGEVERSION% service pack required to install this distribution is: %SERVICEPACKMINIMUM%%OUTPUTDIRECT% echo However the service pack of your existing installation can not be determined.%OUTPUTDIRECT% if {%OUTMODE%} EQU {silent} ( echo The xinstallation will be aborted.%OUTPUTDIRECT% echo Please verify your version and rerun the installer in interactive mode.%OUTPUTDIRECT% set RET=1& goto :EOF ) echo. echo If you are certain that you are are running at least echo. echo Service Pack: %SERVICEPACKMINIMUM% echo. echo then you can choose to continue. echo. echo Otherwise you should abort the installation as installing this distribution on an earlier version echo may lead to an unusable installation. echo. echo. echo Press any key to continue with the installation or CTRL-C to exit.&pause >nul set RET=0& goto :EOF ) else ( if "%SERVICEPACKINSTALLED%" GTR "%SERVICEPACKVERSION%" ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo You are attempting to install:%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo Service Pack %SERVICEPACKVERSION%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo which is earlier than your current installation:%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo Service Pack %SERVICEPACKINSTALLED%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% if {%OUTMODE%} NEQ {silent} ( echo You can still proceed with this installation and echo back up the existing version. echo. echo. echo Press any key to continue or CTRL-C to abort. pause >nul ) else ( echo The installation was aborted.%OUTPUTDIRECT% echo Rerun the installer in interactive mode if you%OUTPUTDIRECT% echo wish to install the older version.%OUTPUTDIRECT% set RET=1& goto :EOF ) ) if "%SERVICEPACKMINIMUM%" GTR "%SERVICEPACKINSTALLED%" ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo The minimum %PACKAGE% %PACKAGEVERSION% service pack required%OUTPUTDIRECT% echo to install this distribution is: %SERVICEPACKMINIMUM%%OUTPUTDIRECT% %cout%. echo However the service pack of your existing installation is: %SERVICEPACKINSTALLED%%OUTPUTDIRECT% echo The installation will be aborted.%OUTPUTDIRECT% set RET=1& goto :EOF ) ) set RET=0& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - checkForNewerOrSameVersion :: ::::::::::::::::::::::::::::::::::::::::::::::::::: :: Checks to see if the version already installed is the same or newer than this release :checkForNewerOrSameVersion if "%VERSIONINSTALLED%" GTR "%PACKAGEVERSION%" ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo You are attempting to install:%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo %PACKAGE% %PACKAGEVERSION%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo which is earlier than your current installation:%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo %PACKAGE% %VERSIONINSTALLED%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% if {%OUTMODE%} NEQ {silent} ( echo You can still proceed with this installation and echo back up the existing version. echo. echo. echo Press any key to continue or CTRL-C to abort. pause >nul ) else ( echo The installation was aborted.%OUTPUTDIRECT% echo Rerun the installer in interactive mode if you%OUTPUTDIRECT% echo wish to install the older version.%OUTPUTDIRECT% set RET=1& goto :EOF ) ) if {%VERSIONINSTALLED%} EQU {%PACKAGEVERSION%} ( if {%SERVICEPACKINSTALLED%} EQU {%SERVICEPACKVERSION%} ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo You are attempting to install:%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo %PACKAGE% %PACKAGEVERSION% %SERVICEPACKVERSION%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo which is the same as your current installation:%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo %PACKAGE% %VERSIONINSTALLED% %SERVICEPACKINSTALLED%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% if {%OUTMODE%} NEQ {silent} ( echo You can still proceed with this installation and echo back up the existing version. echo. echo. echo Press any key to continue or CTRL-C to abort. pause >nul ) else ( echo The installation was aborted.%OUTPUTDIRECT% echo Rerun the installer in interactive mode if you%OUTPUTDIRECT% echo wish to install the older version.%OUTPUTDIRECT% set RET=1& goto :EOF ) ) else ( if "%SERVICEPACKINSTALLED%" GTR "%SERVICEPACKVERSION%" ( if {%OUTMODE%} NEQ {silent} cls %cout% *********** W A R N I N G *********** %cout%. color c0 echo You are attempting to install:%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo Service Pack %SERVICEPACKVERSION%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo which is earlier than your current installation:%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo Service Pack %SERVICEPACKINSTALLED%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% if {%OUTMODE%} NEQ {silent} ( echo You can still proceed with this installation and echo back up the existing version. echo. echo. echo Press any key to continue or CTRL-C to abort. pause >nul ) else ( echo The installation was aborted.%OUTPUTDIRECT% echo Rerun the installer in interactive mode if you%OUTPUTDIRECT% echo wish to install the older version.%OUTPUTDIRECT% set RET=1& goto :EOF ) ) ) ) goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - checkForNewerOrSameVersion :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - checkVersion :: :::::::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::::: :: CALL FUNCTION - setVersion :: :::::::::::::::::::::::::::::::: :: Set the version information in the VERSIONFILE placed in the application's root directory :setVersion setlocal & pushd %ROOTDIR%\bin if defined PACKAGE ( if not defined VERSIONFILE set VERSIONFILE=%PACKAGE%.version ) else ( if not defined VERSIONFILE set VERSIONFILE=edenapp.version ) if not defined PACKAGEVERSION ( %TRACE% PACKAGEVERSION not set, can not create version file. set RET=1& goto :EOF ) if not defined SERVICEPACKVERSION ( %TRACE% SERVICEPACKVERSION not set, assuming it is NONE. set SERVICEPACKVERSION=NONE ) if not exist "%SRCDIR%\%PACKAGE%\bin\version" ( echo VERSIONINSTALLED=%PACKAGEVERSION%> %VERSIONFILE% echo SERVICEPACKINSTALLED=%SERVICEPACKVERSION%>> %VERSIONFILE% ) endlocal & popd & set RET=0& goto :EOF :::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - setVersion :: :::::::::::::::::::::::::::::::::::: ******************************************************************* ::::::::::::::::::::::::::::::::::::::: :: CALL FUNCTION - 2000silentinstall :: ::::::::::::::::::::::::::::::::::::::: :: Silent Installation proc for WIN2K :2000silentinstall :: ENABLEDELAYEDEXPANSION is particular to WIN2K, and allows variables to be expanded as interpreted :: vice when each line of input is read setlocal ENABLEDELAYEDEXPANSION :: If SRCDIR is not defined in INI then call function that will set it if not defined SRCDIR call :makeSrcDir :: if a previous installation was detected in the detectEden function then PREVIOUS will be set to YES. :: If this is the case then the script will cd/pushd into it and extract the build date of the EXE file. :: it will then create a 'stamp' from this date and append it to an archived directory before overwriting :: the installation. :: If no previous installation was detected by detectEden, then PREVIOUS will be NO. In this case then :: the installer will check to see if ROOTDIR was set in the INI. If it was not defined then it will :: set ROOTDIR to be relative to EDGE_HOME. It then creates the directory and proceeds to the installer. if {%PREVIOUS%} EQU {YES} ( if {%PACKAGETYPE%} EQU {SERVICEPACK} ( if not defined VERSIONINSTALLED ( pushd "%PREVIOUS_ROOT%"\bin for /f "usebackq" %%a in (`dir /TW ^| findstr /i %PACKAGE%.exe`) do set STAMP=%%a popd if defined STAMP (set STAMP=!STAMP:/=-!) ELSE (set STAMP=.backup) set STAMP=!STAMP!.pre%SERVICEPACKVERSION% ) else ( if {%SERVICEPACKINSTALLED%} EQU {NONE} ( set STAMP=-%VERSIONINSTALLED%.base ) else ( set STAMP=-%VERSIONINSTALLED%.%SERVICEPACKINSTALLED% ) ) if not exist "%PREVIOUS_ROOT%!STAMP!" ( xcopy /R /E /Q /Y /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP!>nul echo Previous installation archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%!STAMP!%OUTPUTDIRECT% ) ELSE ( echo Current installation already archived as: >> %LOG% echo %PREVIOUS_ROOT%!STAMP! >> %LOG% echo The archive will be overwritten. >> %LOG% xcopy /R /E /Q /Y /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP!>nul ) set %ROOTVAR%=%PREVIOUS_ROOT% xcopy /R /E /Q /Y /H "%SRCDIR%\%PACKAGE%" "%ROOTDIR%" >nul || (echo error installing %PACKAGE% & endlocal & goto :EOF & set STAGE4=ERROR) endlocal& set RET=0& set STAGE4=SERVICE PACK INSTALLED& goto :EOF ) else ( if not defined VERSIONINSTALLED ( pushd "%PREVIOUS_ROOT%"\bin for /f "usebackq" %%a in (`dir /TW ^| findstr /i %PACKAGE%.exe`) do set STAMP=%%a popd if defined STAMP (set STAMP=.!STAMP:/=-!) ELSE (set STAMP=.backup) ) else ( if {%SERVICEPACKINSTALLED%} NEQ {NONE} ( set STAMP=-%VERSIONINSTALLED%%SERVICEPACKINSTALLED% ) else ( set STAMP=-%VERSIONINSTALLED%.base ) ) if not exist "%PREVIOUS_ROOT%!STAMP!" ( xcopy /R /E /Q /Y /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP!>nul echo Previous installation archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%!STAMP!%OUTPUTDIRECT% ) ELSE ( echo Current installation already archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%!STAMP!%OUTPUTDIRECT% echo The archive will be overwritten.%OUTPUTDIRECT% xcopy /R /E /Q /Y /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP!>nul ) set %ROOTVAR%=%PREVIOUS_ROOT% set STAGE4=ARCHIVE / UPGRADE INSTALLATION ) ) ELSE ( set STAGE4=NEW INSTALL if not defined ROOTDIR ( set TARGETDIR=%EDGE_HOME%\..\Icsas if NOT EXIST "!TARGETDIR!" mkdir "!TARGETDIR!" pushd "!TARGETDIR!" set ROOTDIR=!CD! popd ) if not defined ROOTDIR ( echo.%OUTPUTDIRECT% echo **CRITICAL ERROR in proc %0%OUTPUTDIRECT% echo There was a problem determining the %PACKAGE% installation path.%OUTPUTDIRECT% echo ROOTDIR could not be resolved: %STAGE4%%OUTPUTDIRECT% endlocal & set RET=1& goto :EOF ) if not exist "!ROOTDIR!" mkdir "!ROOTDIR!" ) :: echo settings to log echo Source is %SRCDIR%.%OUTPUTDIRECT% echo Target is %ROOTDIR%.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% :: Install the files from the source to target installation directory. if defined ROOTDIR ( if not exist "%ROOTDIR%" mkdir "%ROOTDIR%" ) ELSE ( echo ROOTDIR could not be defined...exiting. endlocal & set RET=1& goto :EOF ) xcopy /R /E /Q /Y /H "%SRCDIR%\%PACKAGE%" "%ROOTDIR%" >nul || (echo error installing %PACKAGE% & endlocal & goto :EOF & set STAGE4=ERROR) echo %PACKAGE% installed to "%ROOTDIR%"%OUTPUTDIRECT% endlocal & set STAGE4=%STAGE4%& set RET=0& set %ROOTVAR%=%ROOTDIR%& set ROOTDIR=%ROOTDIR%& goto :EOF :: just in case the above fails goto :EOF ::::::::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - 2000silentinstall :: ::::::::::::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::::::::::::: :: CALL FUNCTION - 2000verboseinstall :: :::::::::::::::::::::::::::::::::::::::: :: Interactive Installation menu for WIN2K :2000verboseinstall :: ENABLEDELAYEDEXPANSION is particular to WIN2K, and allows variables to be expanded as interpreted\ :: vice when each line of input is read setlocal ENABLEDELAYEDEXPANSION :: If SRCDIR is not defined in INI then call function that will set it if not defined SRCDIR call :makeSrcDir :: check to see if detectEden detected a functional existing install and act appropriately if {%PREVIOUS%} == {YES} ( goto :upgradeMenu ) ELSE ( goto :installNew ) :::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - upgradeMenu :: :::::::::::::::::::::::::::::::::::: :: interactive menu with upgrade installation options :upgradeMenu %CLS% echo EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% echo SOURCE: --%SRCDIR%\%PACKAGE%-- echo TARGET: --%ROOTDIR%-- echo. echo [STAGE 4] -- INSTALL %PACKAGENAME% PROGRAM FILES -- echo. echo. echo. color 1F if {%PACKAGETYPE%} EQU {SERVICEPACK} ( if {%SERVICEPACKINSTALLED%} EQU {NONE} ( set PREVIOUSVERSION=%PACKAGE% %VERSIONINSTALLED% ) else ( set PREVIOUSVERSION=%PACKAGE% %VERSIONINSTALLED% %SERVICEPACKINSTALLED% ) echo ****************** --^> WORKING ^<-- ****************** echo !PREVIOUSVERSION! found in: echo --%PREVIOUS_ROOT%-- echo. echo Applying Service Pack %SERVICEPACKVERSION%... if not defined VERSIONINSTALLED ( pushd "%PREVIOUS_ROOT%"\bin for /f "usebackq" %%a in (`dir /TW ^| findstr /i %PACKAGE%.exe`) do set STAMP=%%a popd if defined STAMP (set STAMP=!STAMP:/=-!) ELSE (set STAMP=.backup) set STAMP=!STAMP!.pre%SERVICEPACKVERSION% ) else ( if {%SERVICEPACKINSTALLED%} EQU {NONE} ( set STAMP=-%VERSIONINSTALLED%.base ) else ( set STAMP=-%VERSIONINSTALLED%.%SERVICEPACKINSTALLED% ) ) if not exist "%PREVIOUS_ROOT%.!STAMP!" ( echo. echo Archiving previous %PACKAGE% installation.... xcopy /R /E /Q /Y /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP!>nul echo Previous installation archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%!STAMP!%OUTPUTDIRECT% ) ELSE ( echo Current installation already archived as: >> %LOG% echo %PREVIOUS_ROOT%!STAMP! >> %LOG% echo The archive will be overwritten. >> %LOG% echo Archiving previous %PACKAGE% installation.... xcopy /R /E /Q /Y /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP!>nul ) set %ROOTVAR%=%PREVIOUS_ROOT% xcopy /R /E /Q /Y /H "%SRCDIR%\%PACKAGE%" "%ROOTDIR%" >nul || (echo error installing %PACKAGE% & endlocal & goto :EOF & set STAGE4=ERROR) echo. echo Service Pack %SERVICEPACKVERSION% installed. endlocal& set RET=0& set STAGE4=SERVICE PACK INSTALLED& goto :EOF ) else ( echo ****************** --^> WARNING ^<-- ****************** echo A previous installation of %PACKAGE% was detected in: echo --%PREVIOUS_ROOT%-- echo. echo Please enter 1 through 5 to indicate the action to take: echo. echo 1 - Upgrade the previous installation echo 2 - Archive and upgrade the previous installation echo 3 - Overwrite the previous installation echo 4 - Archive and overwrite the previous installation echo 5 - Abort the installation echo. :: this set command is particular to WIN2K and sets the variable from command input set /P ANSWER= echo Previous %PACKAGE% install detected in %PREVIOUS_ROOT%. User selects !ANSWER!.>> %LOG% :: hidden option for testing, skips the package install and moves on if !ANSWER! EQU 143 ( endlocal & set RET=0& goto :EOF ) :: answer handling... checks to make sure the answer is greater than zero and less than five :: otherwise it will force another input if not !ANSWER! GTR 0 ( echo Invalid Answer. Please select 1, 2, 3, 4, or 5. echo Press ENTER to try again. & pause >nul goto upgradeMenu ) if not !ANSWER! LEQ 5 ( echo Invalid Answer. Please select 1, 2, 3, 4, or 5. echo Press ENTER to try again. & pause >nul goto upgradeMenu ) rem if we got this far, then an appropriate response was entered. rem if 1, then upgrade (overwrite), so do nothing and allow the install to happen rem if 2, then copy the existing installation folder with a datestamp suffix rem if 3, delete the previous installation and reinstall rem if 4, then rename the existing installation folder with a datestamp suffix and reinstall rem if 5, Abort and exit if !ANSWER! EQU 1 ( set STAGE4=UPGRADE EXISTING INSTALLATION call :upgradeRefreshScreen ) if !ANSWER! EQU 2 ( :: we're archiving, so determine the build date of the .exe and archive the existing install. set STAGE4=ARCHIVE AND UPGRADE call :upgradeRefreshScreen if not defined VERSIONINSTALLED ( pushd "%PREVIOUS_ROOT%"\bin for /f "usebackq" %%a in (`dir /TW ^| findstr /i %PACKAGE%.exe`) do set STAMP=%%a popd if defined STAMP (set STAMP=.!STAMP:/=-!) ELSE (set STAMP=.backup) ) else ( if {%SERVICEPACKINSTALLED%} NEQ {NONE} ( set STAMP=-%VERSIONINSTALLED%%SERVICEPACKINSTALLED% ) else ( set STAMP=-%VERSIONINSTALLED%.base ) ) if not exist "%PREVIOUS_ROOT%!STAMP!" ( echo. echo Archiving previous %PACKAGE% installation.... xcopy /R /E /Q /Y /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP!>nul echo Previous installation archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%!STAMP!%OUTPUTDIRECT% ) ELSE ( echo Current installation already archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%!STAMP!%OUTPUTDIRECT% echo The archive will be overwritten.%OUTPUTDIRECT% echo Archiving previous %PACKAGE% installation.... xcopy /R /E /Q /Y /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP!>nul ) set %ROOTVAR%=%PREVIOUS_ROOT% call :upgradeRefreshScreen ) if !ANSWER! EQU 3 ( :: we're overwriting, so blow away the original install. if "%ROOTDIR%" == "%PREVIOUS_ROOT%" ( rd /s /q "%PREVIOUS_ROOT%" mkdir "%ROOTDIR%" ) set STAGE4=REINSTALLATION call :upgradeRefreshScreen ) if !ANSWER! EQU 4 ( :: we're archiving before reinstalling, so get the build stamp of the .exe and rename the existing folder. if not defined VERSIONINSTALLED ( pushd "%PREVIOUS_ROOT%"\bin for /f "usebackq" %%a in (`dir /TW ^| findstr /i %PACKAGE%.exe`) do set STAMP=%%a popd if defined STAMP (set STAMP=.!STAMP:/=-!) ELSE (set STAMP=.backup) ) else ( if {%SERVICEPACKINSTALLED%} NEQ {NONE} ( set STAMP=-%VERSIONINSTALLED%%SERVICEPACKINSTALLED% ) else ( set STAMP=-%VERSIONINSTALLED%.base ) ) if not exist "%PREVIOUS_ROOT%!STAMP!" ( move "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%"!STAMP! >nul echo. echo Previous installation archived as: echo %PREVIOUS_ROOT%.!STAMP! echo Previous installation archived as %PREVIOUS_DBC_ROOT%!STAMP!>> %LOG% ) ELSE ( echo Current installation already archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%.!STAMP!%OUTPUTDIRECT% echo The archive will be overwritten.%OUTPUTDIRECT% echo Archiving previous %PACKAGE% installation.... echo. rmdir /S /Q "%PREVIOUS_ROOT%".!STAMP! || echo could not remove previous backup "%PREVIOUS_ROOT%".!STAMP!" move /Y "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%".!STAMP!>nul || echo Could not make archive "%PREVIOUS_ROOT%"%OUTPUTDIRECT% if {%OUTMODE%} NEQ {silent} (echo Done. Press any key to continue to %PACKAGE% installation...& pause >nul) ) set STAGE4=ARCHIVE/REINSTALL INSTALLATION call :upgradeRefreshScreen ) if !ANSWER! EQU 5 ( set STAGE4=ABORTED call :upgradeRefreshScreen %TRACE% Installation aborted in proc %0 at user's request. echo Installation aborted at user's request.>>%LOG% endlocal & set RET=1& set STAGE4=%STAGE4%& goto :EOF ) ) :: Now that the above functions have prepped by archiving or deleting as necessary,\ :: install the files from the source to target installation directory. echo Installing %PACKAGENAME% program files.... if defined ROOTDIR ( if not exist "%ROOTDIR%" mkdir "%ROOTDIR%" ) ELSE ( echo ROOTDIR could not be defined...exiting. endlocal & set RET=1& goto :EOF ) xcopy /R /E /Q /Y /H "%SRCDIR%\%PACKAGE%" "%ROOTDIR%" >nul || (echo error installing %PACKAGE% & endlocal & goto :EOF & set STAGE4=ERROR) echo Program files installed. echo. echo %PACKAGE% installed to "%ROOTDIR%">> "%LOG%" endlocal & set RET=0& set STAGE4=%STAGE4%& set %ROOTVAR%=%ROOTDIR%& set ROOTDIR=%ROOTDIR%& goto :EOF :::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - upgradeMenu :: :::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - installNew :: ::::::::::::::::::::::::::::::::::: :: verbose installation if no previous installation detected :installNew %TRACE% called %* :: this is a bit superfluous as PREVIOUS must be NO if we are here, but always better to be safe than sorry if {%PREVIOUS%} == {NO} ( set STAGE4=NEW INSTALL ) ELSE ( echo In function %0 but PREVIOUS is not NO... any existing installations will be overwritten.%OUTPUTDIRECT% ) :: determine the installation path if not specified in the INI. :: If ROOT wasn't in the INI, make it relative to EDGE :: ENABLEDELAYEDEXPANSION should be set by the caller before this is called! if not defined ROOTDIR ( set TARGETDIR=%EDGE_HOME%\..\Icsas if NOT EXIST "!TARGETDIR!" mkdir "!TARGETDIR!" pushd "!TARGETDIR!" set ROOTDIR=!CD! popd ) if not defined ROOTDIR ( echo.%OUTPUTDIRECT% echo **CRITICAL ERROR in proc %0%OUTPUTDIRECT% echo There was a problem determining the %PACKAGE% installation path.%OUTPUTDIRECT% echo ROOTDIR could not be resolved: %STAGE4%%OUTPUTDIRECT% endlocal & set RET=1& goto :EOF ) if not exist "%ROOTDIR%" mkdir "%ROOTDIR%" :: Now that the above checks are complete, draw the interactive screen %CLS% echo EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% echo SOURCE: --%SRCDIR%\%PACKAGE%-- echo TARGET: --%ROOTDIR%-- echo. echo [STAGE 4] -- INSTALL %PACKAGENAME% PROGRAM FILES -- color 1F echo. echo. echo. echo. echo. echo. echo Now prepared to install %PACKAGE%. echo Source is %SRCDIR%. echo Target is %ROOTDIR%. echo. if {%OUTMODE%} NEQ {silent} echo Press any key to install or CTRL-C to abort...& pause >nul :: Install package to target directory %CLS% echo EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% echo SOURCE: --%SRCDIR%-- echo TARGET: --%ROOTDIR%-- echo. echo [STAGE 4] -- INSTALL %PACKAGENAME% PROGRAM FILES -- color 1F echo. echo. echo. echo. echo. echo. :: Go ahead and install if defined ROOTDIR ( if not exist "%ROOTDIR%" mkdir "%ROOTDIR%" ) ELSE ( echo ROOTDIR could not be defined...exiting. endlocal & set RET=1& goto :EOF ) echo Installing %PACKAGENAME% program files.... xcopy /R /E /Q /Y /H "%SRCDIR%\%PACKAGE%" "%ROOTDIR%" >nul || (echo error installing %PACKAGE% & endlocal & goto :EOF & set STAGE4=ERROR) echo Program files installed. echo. echo %PACKAGE% installed to "%ROOTDIR%">> "%LOG%" set STAGE4=INSTALLED endlocal & set RET=0& set STAGE4=%STAGE4%& set %ROOTVAR%=%ROOTDIR%& set ROOTDIR=%ROOTDIR%& goto :EOF ::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - installNew :: ::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - upgradeRefreshScreen :: ::::::::::::::::::::::::::::::::::::::::::::: :: Simple call that refreshes the screen once a user had made an upgrade path choice :upgradeRefreshScreen %CLS% echo EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% echo SOURCE: --%SRCDIR%\%PACKAGE%-- echo TARGET: --%ROOTDIR%-- echo. echo [STAGE 4] -- INSTALL %PACKAGENAME% PROGRAM FILES -- echo. echo. echo. color 1F echo ****************** --^> WARNING ^<-- ****************** echo A previous installation of %PACKAGE% was detected in: echo --%PREVIOUS_ROOT%-- echo. echo Your Choice: %STAGE4% echo. goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - upgradeRefreshScreen :: ::::::::::::::::::::::::::::::::::::::::::::::::: :: if we get this far, there is something wrong as we should have exitted through a branch echo reached end of %0 ???? endlocal & set RET=1& goto :EOF ::::::::::::::::::::::::::::::::::::::: :: END FUNCTION - 2000verboseinstall :: ::::::::::::::::::::::::::::::::::::::: ******************************************************************* ::::::::::::::::::::::::::::::::::::: :: CALL FUNCTION - NTsilentinstall :: ::::::::::::::::::::::::::::::::::::: :: Silent Installation proc for WINNT :NTsilentinstall if not defined ROOTDIR call :ntSilentMakeTargetDir if not defined %ROOTVAR% set %ROOTVAR%=%ROOTDIR% setlocal :: This should have been handled already in detectEden but this is just to be sure if not defined PREVIOUS (set PREVIOUS=NO) :: If SRCDIR is not defined in INI then call function that will set it if not defined SRCDIR call %LIBFILE% :makeSrcDir :: check to see if detectEden detected a functional existing install and act appropriately if {%PREVIOUS%} EQU {YES} (goto ntSilentInstallPreviousYes) ELSE (goto ntSilentInstallPreviousNo) ::::::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntSilentInstallPreviousYes :: ::::::::::::::::::::::::::::::::::::::::::::::::::: :: silently archive and upgrade an existing installation :ntSilentInstallPreviousYes if not defined VERSIONINSTALLED ( pushd "%PREVIOUS_ROOT%"\bin for /f "usebackq" %%a in (`dir /TW ^| findstr /i %PACKAGE%.exe`) do call :ntSilentMakestamp %%a popd ) else ( if {%SERVICEPACKINSTALLED%} NEQ {NONE} ( set STAMP=-%VERSIONINSTALLED%%SERVICEPACKINSTALLED% ) else ( set STAMP=-%VERSIONINSTALLED%.base ) ) if not exist "%PREVIOUS_ROOT%.%STAMP%" ( xcopy /R /E /Q /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%".%STAMP%>nul echo Previous installation archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%.%STAMP%%OUTPUTDIRECT% echo Previous installation archived as %PREVIOUS_ROOT%.%STAMP%%OUTPUTDIRECT% ) ELSE ( echo Current installation already archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%.%STAMP% %OUTPUTDIRECT% echo The archive will be overwritten.%OUTPUTDIRECT% xcopy /R /E /Q /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%".%STAMP%>nul ) set STAGE4=ARCHIVE / UPGRADE INSTALLATION call :ntSilentExecInstall || (endlocal & set RET=1& goto :EOF) endlocal & set RET=0& set STAGE4=%STAGE4%& goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntSilentInstallPreviousNo :: :::::::::::::::::::::::::::::::::::::::::::::::::: :: silently install a new installation :ntSilentInstallPreviousNo %TRACE% Called %0 %* set STAGE4=NEW INSTALL if not defined ROOTDIR ( echo.%OUTPUTDIRECT% echo **CRITICAL ERROR in proc %0%OUTPUTDIRECT% echo There was a problem determining the %PACKAGE% installation path.%OUTPUTDIRECT% echo ROOTDIR could not be resolved: %STAGE4%%OUTPUTDIRECT% endlocal & set RET=1& goto :EOF ) call :ntSilentExecInstall || (set RET=1& goto :EOF) endlocal & set RET=0& set STAGE4=%STAGE4%& goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - ntSilentInstallPreviousNo :: :::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntSilentExecInstall :: :::::::::::::::::::::::::::::::::::::::::::: :: Execute the silent install :ntSilentExecInstall :: make sure that ROOTDIR is ready if defined ROOTDIR ( if not exist "%ROOTDIR%" mkdir "%ROOTDIR%" ) ELSE ( echo ROOTDIR could not be defined...exiting. endlocal & set RET=1& goto :EOF ) :: echo settings to log. echo Source is %SRCDIR%.%OUTPUTDIRECT% echo Target is %ROOTDIR%.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% xcopy /R /E /Q /H "%SRCDIR%\%PACKAGE%" "%ROOTDIR%" >nul || (endlocal & %cout% error installing %PACKAGE% & goto :EOF & set STAGE4=ERROR) echo %PACKAGE% installed to "%ROOTDIR%"%OUTPUTDIRECT% set STAGE4=INSTALLED set RET=0& set %ROOTVAR%=%ROOTDIR%& set STAGE4=%STAGE4%& goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - ntSilentExecInstall :: :::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntSilentMakestamp :: :::::::::::::::::::::::::::::::::::::::::: :ntSilentMakestamp %TRACE% Called %LIBFILE% %* set STAMP=%1 if defined STAMP (set STAMP=.%STAMP:/=-%) ELSE (set STAMP=.backup) goto :EOF :::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - ntSilentMakestamp :: :::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntSilentMakeTargetDir :: :::::::::::::::::::::::::::::::::::::::::::::: :ntSilentMakeTargetDir setlocal set TARGETDIR=%EDGE_HOME%\..\Icsas if not exist "%TARGETDIR%" mkdir "%TARGETDIR%" pushd %TARGETDIR% for /f "tokens=*" %%a in ('cd') do set RESETTARGETDIR=%%a set ROOTDIR=%RESETTARGETDIR% popd endlocal & set ROOTDIR=%ROOTDIR%& goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - ntSilentMakeTargetDir :: :::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - NTsilentinstall :: ::::::::::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::::::::::: :: CALL FUNCTION - NTverboseinstall :: :::::::::::::::::::::::::::::::::::::: :: Interactive Installation menu for NT :NTverboseinstall if not defined SRCDIR call :makeSrcDir if not defined ROOTDIR call :ntVerboseMakeTargetDir %CLS% echo EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% echo SOURCE: --%SRCDIR%-- echo TARGET: --%ROOTDIR%-- echo. echo [STAGE 4] -- INSTALL %PACKAGENAME% PROGRAM FILES -- echo. echo. echo. color 1F if {%PREVIOUS%} == {YES} ( goto :NTupgradeMenu ) ELSE ( goto :NTinstallNew ) :::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - NTupgradeMenu :: :::::::::::::::::::::::::::::::::::::: :: perform an interactive archive and upgrade :NTupgradeMenu %TRACE% Called %* set STAGE4=ARCHIVE / UPGRADE INSTALLATION setlocal echo **** WARNING **** echo A previous installation of %PACKAGE% was detected in: echo -%PREVIOUS_ROOT% echo. if not defined VERSIONINSTALLED ( pushd "%PREVIOUS_ROOT%"\bin for /f "usebackq" %%a in (`dir /TW ^| findstr /i %PACKAGE%.exe`) do call :ntVerboseMakestamp %%a popd ) else ( if {%SERVICEPACKINSTALLED%} NEQ {NONE} ( set STAMP=-%VERSIONINSTALLED%%SERVICEPACKINSTALLED% ) else ( set STAMP=-%VERSIONINSTALLED%.base ) ) if not exist "%PREVIOUS_ROOT%.%STAMP%" ( echo Archiving previous installation.... xcopy /R /E /Q /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%".%STAMP%>nul echo Previous installation archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%.%STAMP%%OUTPUTDIRECT% echo Previous installation archived as %PREVIOUS_ROOT%.%STAMP%%OUTPUTDIRECT% ) ELSE ( echo Current installation already archived as:%OUTPUTDIRECT% echo %PREVIOUS_ROOT%.%STAMP%%OUTPUTDIRECT% echo The archive is being overwritten...%OUTPUTDIRECT% xcopy /R /E /Q /H /I "%PREVIOUS_ROOT%" "%PREVIOUS_ROOT%".%STAMP%>nul ) endlocal set %ROOTVAR%=%ROOTDIR% if {%OUTMODE%} NEQ {silent} echo Press a key to continue with the installation...& pause >nul call :ntVerboseExecInstall || (set RET=1& goto :EOF) set RET=0& set STAGE4=%STAGE4%& goto :EOF :::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - NTupgradeMenu :: :::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntInstallNew :: ::::::::::::::::::::::::::::::::::::: :: perform an interactive new installation :ntInstallNew %TRACE% Called %* set STAGE4=NEW INSTALL if not defined ROOTVAR set ROOTVAR=EDEN_ROOT :: if not defined ROOTDIR call :ntVerboseMakeTargetDir if not defined ROOTDIR ( echo.%OUTPUTDIRECT% echo **CRITICAL ERROR in proc %0%OUTPUTDIRECT% echo There was a problem determining the %PACKAGE% installation path.%OUTPUTDIRECT% echo ROOTDIR could not be resolved: %STAGE4%%OUTPUTDIRECT% endlocal & set RET=1& goto :EOF ) call :ntVerboseExecInstall || (set RET=1& goto :EOF) set RET=0& set STAGE4=%STAGE4%& goto :EOF ::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - ntInstallNew :: ::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntVerboseExecInstall :: ::::::::::::::::::::::::::::::::::::::::::::: :: interactive install engine for NT :ntVerboseExecInstall if not exist "%ROOTDIR%" mkdir "%ROOTDIR%" :: echo settings to log. if defined ROOTDIR ( if not exist "%ROOTDIR%" mkdir "%ROOTDIR%" ) ELSE ( echo ROOTDIR could not be defined...exiting. endlocal & set RET=1& goto :EOF ) echo Source is %SRCDIR%.%OUTPUTDIRECT% echo Target is %ROOTDIR%.%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo Installing %PACKAGENAME% program files... xcopy /R /E /Q /H "%SRCDIR%\%PACKAGE%" "%ROOTDIR%" >nul || (%cout% error installing %PACKAGE% & endlocal & goto :EOF & set STAGE4=ERROR) echo %PACKAGE% installed to "%ROOTDIR%"%OUTPUTDIRECT% set RET=0& set %ROOTVAR%=%ROOTDIR%& set STAGE4=%STAGE4%& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - ntVerboseExecInstall :: ::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntVerboseMakestamp:: :::::::::::::::::::::::::::::::::::::::::: :: helps make stamp for NT verbose install archivals :ntVerboseMakestamp %TRACE% Called %LIBFILE% %* set STAMP=%1 if defined STAMP (set STAMP=%STAMP:/=-%) ELSE (set STAMP=backup) goto :EOF :::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - ntVerboseMakestamp:: :::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - ntVerboseMakeTargetDir :: ::::::::::::::::::::::::::::::::::::::::::::::: :: makes target directories id rootdir is not defined :ntVerboseMakeTargetDir setlocal set TARGETDIR=%EDGE_HOME%\..\Icsas if not exist "%TARGETDIR%" mkdir "%TARGETDIR%" pushd %TARGETDIR% for /f "tokens=*" %%a in ('cd') do set RESETTARGETDIR=%%a set ROOTDIR=%RESETTARGETDIR% popd endlocal & set ROOTDIR=%ROOTDIR%& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - ntVerboseMakeTargetDir :: ::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - NTverboseinstall :: :::::::::::::::::::::::::::::::::::::::::: ::**************************************************************************** ::::::::::::::::::::::::::::: :: CALL FUNCTION - setVars :: ::::::::::::::::::::::::::::: :: Permanently register system variables specified in SETVAR :setvars :set the local functions's variable scope setlocal & set RET= %TRACE% Called %LIBFILE% %* :: call the function that draws the screen if not in silent mode if {%OUTMODE%} NEQ {silent} call :setVarsDrawScreen :: all variables will be written to this file and called later by regedit /s if not defined SETVAR ( %TRACE% %0 %*: SETVAR not defined.%OUTPUTDIRECT% echo No variables have been specified to be set in your environment.%OUTPUTDIRECT% if not defined PREVIOUS_ROOT ( echo %ROOTVAR% and EDGE_EXTERN_API_PORT must be set manually.%OUTPUTDIRECT% ) endlocal & set RET=0& set STAGE5=NONE SPECIFIED& goto :EOF ) set VARFILE=%TEMP%\install%PACKAGE%_env.reg echo REGEDIT4> "%VARFILE%" echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment]>> "%VARFILE%" echo The following system environment variables will be set:%OUTPUTDIRECT% %cout%. :: call each variable in SETVAR and send it to the SETVAR resolver (like resolveVar but a bit more specialized) for %%a in (%SETVAR%) do set RET=& call :GetPermanentVarValue %%a :: Configure dual display parameters of DUALDISPLAY is YES if defined DUALDISPLAY ( if "%DUALDISPLAY%" == "YES" ( if not defined EDGE_3D_UPPER_LEFT_X ( echo Could not read EDGE_3D_UPPER_LEFT_X from INI file.%OUTPUTDIRECT% set COULDNOTSETDUALDISPLAY=1 ) if not defined EDGE_3D_UPPER_LEFT_Y ( echo Could not read EDGE_3D_UPPER_LEFT_Y from INI file.%OUTPUTDIRECT% set COULDNOTSETDUALDISPLAY=1 ) if not defined EDGE_3D_WINDOW_WIDTH ( echo Could not read EDGE_3D_WINDOW_WIDTH from INI file.%OUTPUTDIRECT% set COULDNOTSETDUALDISPLAY=1 ) if not defined EDGE_3D_WINDOW_HEIGHT ( echo Could not read EDGE_3D_WINDOW_HEIGHT from INI file.%OUTPUTDIRECT% set COULDNOTSETDUALDISPLAY=1 ) call :setDualDisplayVars ) ) :: check to see if it is WIN2K and in verbose mode, which will offer the ability to abort and continue :: If WINNT it will offer the ability to hit CTRL-C which will abort the entire install if {%NTREV%} NEQ {NT} ( if {%OUTMODE%} NEQ {silent} ( call :setVarsUserOptionVersose2000 ) ) :: if the following statements are true then setVarsUserOptionVersose2000 was executed so exit if {%NTREV%} NEQ {NT} ( if {%OUTMODE%} NEQ {silent} ( endlocal & set RET=0& set STAGE5=%STAGE5%& goto :EOF ) ) :: if we are here then we didn't take the WIN2K verbose mode branch, so if we check to see if we are in NT verbose mode :: and offer to abort the script before kludging the registry if {%OUTMODE%} NEQ {silent} echo Press any key to set these variables, or CTRL-C to abort...& pause >nul :: OK, we must have been given the go ahead or we are in silent mode regedit /s "%VARFILE%" || (set RET=1& set STAGE5=ERROR& endlocal & goto :EOF) :: regedit must have succeeded so set the STAGE variable set STAGE5=INSTALLED :: woohoo, Marge! we're done with stage 4! endlocal & set RET=0& set STAGE5=%STAGE5%& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - setVarsUserOptionVersose2000 :: ::::::::::::::::::::::::::::::::::::::::::::::::::::: :: If WIN2K verbose mode, this presents the variables that will be installed and offers a chance to abort :setVarsUserOptionVersose2000 :: ENABLEDELAYEDEXPANSION is particular to WIN2K, and allows variables to be expanded as interpreted\ :: vice when each line of input is read. We are now three levels deep in setlocal, (script, call, and subcall) :: so make sure we endlocal each appropriately! setlocal ENABLEDELAYEDEXPANSION echo. echo Enter 1 if you would like to proceed or 2 to abort. set /P VARIMPORTOPT= if "!VARIMPORTOPT!" == "1" ( :: User affirmed so install the temp reg file. regedit /s "%VARFILE%" || (endlocal & set RET=1& set STAGE5=ERROR& goto :EOF) endlocal & set RET=0& set STAGE5=INSTALLED goto :EOF ) if "!VARIMPORTOPT!" == "2" ( :: User declined so post warning color c0 call :setVarsDrawScreen echo *WARNING! You have opted not to import the required system variables. echo. echo Please consult your installation documentation and set the following variables: echo. echo. %SETVAR% echo. echo. echo. pause color 1f echo System variables not installed at user's request. >> %LOG% endlocal & set RET=0& set STAGE5=USER ABORTED& goto :EOF ) :: else an invalid answer must have been entered, so force another answer call :setVarsDrawScreen echo. echo. echo. echo Invalid Answer. Please select 1 or 2. echo Press any key to try again...& pause >nul endlocal& goto :setVarsUserOptionVersose2000 :: we shouldn't get here as we would have branched, but just in case endlocal & endlocal % set RET=1& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - setVarsUserOptionVersose2000 :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - GetPermanentVarValue :: ::::::::::::::::::::::::::::::::::::::::::::: :: called by setVars for loop to expand values in SETVAR variables' values, and then echo into the VARFILE :: argument 1 is the variable to process :GetPermanentVarValue ::%TRACE% Called :0 %* :: check to make sure that an argument was passed set VALUE= if {%1}=={} ( %TRACE% %0: No var passed to set in enviroment. set RET=1 goto :EOF ) :: check to make sure that the variable is set if not defined %1 ( %TRACE% %0: Received %1 but it is not set. Check the INI file. set RET=1 goto :EOF ) :: OK, the meat and potatoes... :: First we're going to ensure that a variable was passed and that it is defined. :: Then we're gonna set setPermaVarValue to be equal to the value of the passed variable. :: Then we're going to send it through a for loop to print its value which can then be :: echoed into the VARFILE and to the screen. set setPermaVarValue=%%%1%% %TRACE% Processing %1.... for /f "tokens=*" %%a in ('echo %setPermaVarValue%') do set VALUE=%%a|| set RET=1 if defined VALUE ( echo --^> VARIABLE: %1 %OUTPUTDIRECT% echo === SETTING : %VALUE:\=\\% %OUTPUTDIRECT% echo "%1"="%VALUE:\=\\%">> "%VARFILE%" || set RET=1 ) ELSE ( set RET=1 ) if {%RET%} EQU {1} %TRACE% could not permanently set %1 as %setPermaVarValue% in regfile. >>%LOG% set RET=0& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - GetPermanentVarValue :: ::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - setDualDisplayVars :: ::::::::::::::::::::::::::::::::::::::::::: :: Called to echo the EDGE_3D variables if DUALDISPLAY is on and all four variables are specified :setDualDisplayVars if not defined COULDNOTSETDUALDISPLAY ( echo "EDGE_3D_UPPER_LEFT_X"="%EDGE_3D_UPPER_LEFT_X%">> "%VARFILE%" echo "EDGE_3D_UPPER_LEFT_Y"="%EDGE_3D_UPPER_LEFT_Y%">> "%VARFILE%" echo "EDGE_3D_WINDOW_WIDTH"="%EDGE_3D_WINDOW_WIDTH%">> "%VARFILE%" echo "EDGE_3D_WINDOW_HEIGHT"="%EDGE_3D_WINDOW_HEIGHT%">> "%VARFILE%" ) ::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - setDualDisplayVars :: ::::::::::::::::::::::::::::::::::::::::::::::: set RET=0& goto :EOF :::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - setVarsDrawScreen :: :::::::::::::::::::::::::::::::::::::::::: :: simply draws the interactive screen header :setVarsDrawScreen %CLS% %cout% EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% %cout% SOURCE: --%SRCDIR%-- %cout% TARGET: --%ROOTDIR%-- %cout%. %cout% [STAGE 5] -- SET %PACKAGE% ENVIRONMENT VARIABLES -- %cout%. %cout%. goto :EOF :::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - setVarsDrawScreen :: :::::::::::::::::::::::::::::::::::::::::::::: :: if we got this far, something is really wrong as we should have exitted through a branch echo %0 reached end of script... ???? endlocal & set RET=1& goto :EOF ::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - setVars :: ::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::::: :: CALL FUNCTION - COMLAYER :: :::::::::::::::::::::::::::::: :: Installs the Classification Banner COM Layer DLL and ECO file :COMLAYER :: set function level local variable scope setlocal & set RET= %TRACE% Called %LIBFILE% %* :: call function to draw the interactive screen if {%OUTMODE%} NEQ {silent} call :comLayerDrawScreen :: check to make sure that packages were specified for install if not defined COMLAYER ( %TRACE% COMLAYER not defined... skipping %cout% No COM Layers configured for installation. endlocal& set STAGE6=NO LAYERS INCLUDED set RET=0& goto :EOF ) :: initialize loop variables to count successes against total packages set totalcount=0 set successcount=0 :: parse the package names from SUPPORTDATA and send to the installer for %%a in (%COMLAYER%) do call :comLayerInstallHandle %%a :: set report based on number of packages installed vs specified set STAGE6=%successcount% OF %totalcount% INSTALLED endlocal & set RET=0& set STAGE6=%STAGE6%& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - comLayerInstallHandle :: ::::::::::::::::::::::::::::::::::::::::::::::::: :: install engine for support data packages :comLayerInstallHandle %TRACE% Called %* :: increment the total counter set /a totalcount+=1 :: set function level local variable scope setlocal & set RET= :: check to make sure a package was sent in arg1 if {%1}=={} ( %TRACE% %0: No support data passed to install. endlocal & set RET=1& goto :EOF ) :: check to make sure array variables exist. if not defined %1_DLLNAME ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_DLLSOURCE ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_DLLDEST ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_ECONAME ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_ECOSOURCE ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_ECODEST ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) :: set local _DLLNAME placeholder to value of specified array variable and resolve set COMLAYER_DLLNAME=%%%1_DLLNAME%% call :resolveVar COMLAYER_DLLNAME :: set local _DLLSOURCE placeholder to value of specified array variable and resolve set COMLAYER_DLLSOURCE=%%%1_DLLSOURCE%% call :resolveVar COMLAYER_DLLSOURCE :: set local _DLLDEST placeholder to value of specified array variable and resolve set COMLAYER_DLLDEST=%%%1_DLLDEST%% call :resolveVar COMLAYER_DLLDEST :: set local _ECONAME placeholder to value of specified array variable and resolve set COMLAYER_ECONAME=%%%1_ECONAME%% call :resolveVar COMLAYER_ECONAME :: set local _ECOSOURCE placeholder to value of specified array variable and resolve set COMLAYER_ECOSOURCE=%%%1_ECOSOURCE%% call :resolveVar COMLAYER_ECOSOURCE :: set local _ECODEST placeholder to value of specified array variable and resolve set COMLAYER_ECODEST=%%%1_ECODEST%% call :resolveVar COMLAYER_ECODEST call :comLayerSetDataArray %1 if {%RET%} EQU {1} ( %TRACE% At least one %1 data array variable was not set, resetting all variables to null for this run set COMLAYER_DATANAME= set COMLAYER_DATATYPE= set COMLAYER_DATASOURCE= set COMLAYER_DATADEST= set RET= ) ELSE ( %TRACE% all %1 data array variables were set set RET= ) :: verify that the specified source directory for the DLL exists if not exist "%COMLAYER_DLLSOURCE%" ( %TRACE% %0 Could not install %COMLAYER_DLLNAME%: Source directory does not exist. echo Could not install %COMLAYER_DLLNAME%: Source directory does not exist.%OUTPUTDIRECT% endlocal & set RET=1&goto :EOF ) :: checks to see if the DLL has already been installed if exist "%COMLAYER_DLLDEST%\%COMLAYER_DLLNAME%" ( %cout% Support package %COMLAYER_DLLNAME% already installed. It will be archived. %TRACE% Support package %COMLAYER_DLLNAME% already installed. It will be archived. call :comLayerArchiveDLL ) :: verify the destination directory exists if not exist "%COMLAYER_DLLDEST%" ( %TRACE% %0 creating destination directory "%COMLAYER_DLLDEST%" mkdir "%COMLAYER_DLLDEST%" || (endlocal & echo could not create destination directory "%COMLAYER_DLLDEST%" & set RET=1%OUTPUTDIRECT%) ) :: if the ECO destination is DESKTOP then figure out where that is if {"%COMLAYER_ECODEST%"} EQU {"DESKTOP"} ( if not defined ALLUSERSPROFILE ( if {%NTREV%} EQU {NT} ( %TRACE% %0 attempting to set %NTREV% all user profile set ALLUSERSPROFILE=%SYSTEMROOT%\Profiles\All Users ) if {%NTREV%} EQU {2000} ( %TRACE% %0 attempting to set %NTREV% all user profile set ALLUSERSPROFILE=%SYSTEMDRIVE%\Documents and Settings\All Users ) ) ) if {"%COMLAYER_ECODEST%"} EQU {"DESKTOP"} ( if defined ALLUSERSPROFILE ( if not exist "%ALLUSERSPROFILE%" ( %TRACE% %0 all users profile does not exist...skipping eco copy endlocal & set RET=1& echo Could not copy ECO file....%OUTPUTDIRECT%& goto :EOF ) ELSE ( set COMLAYER_ECODEST=%ALLUSERSPROFILE%\Desktop ) ) ELSE ( %TRACE% :0 could not set all users profile... skipping eco file endlocal & set RET=1& echo Could not copy ECO file....%OUTPUTDIRECT%& goto :EOF ) ) :: verify that the specified source directory for the ECO exists if not exist "%COMLAYER_ECOSOURCE%" ( %TRACE% %0 Could not install %COMLAYER_ECONAME%: Source directory does not exist. echo Could not install %COMLAYER_ECONAME%: Source directory does not exist.%OUTPUTDIRECT% endlocal & set RET=1&goto :EOF ) :: checks to see if the ECO has already been installed if exist "%COMLAYER_ECODEST%\%COMLAYER_ECONAME%" ( %cout% Support package %COMLAYER_ECONAME% already installed. It will be archived. %TRACE% Support package %COMLAYER_ECONAME% already installed. It will be archived. call :comLayerArchiveECO ) if not exist "%COMLAYER_ECODEST%" ( %TRACE% %0 creating destination directory "%COMLAYER_ECODEST%" mkdir "%COMLAYER_ECODEST%" || (endlocal & echo could not create destination directory "%COMLAYER_ECODEST%" & set RET=1%OUTPUTDIRECT%) ) :: execute the install %cout% Installing COM Layer %COMLAYER_DLLNAME%.... %TRACE% %0 attempting to install "%COMLAYER_DLLSOURCE%\%COMLAYER_DLLNAME%" to "%COMLAYER_DLLDEST%" xcopy /R /Q /H /C "%COMLAYER_DLLSOURCE%\%COMLAYER_DLLNAME%" "%COMLAYER_DLLDEST%" >nul || (endlocal & set RET=1& echo Could not copy %COMLAYER_DLLNAME%....%OUTPUTDIRECT%& goto :EOF) regsvr32 /s "%COMLAYER_DLLDEST%\%COMLAYER_DLLNAME%" || (del /F "%COMLAYER_DLLDEST%\%COMLAYER_DLLNAME%" & set RET=1& echo Could not register %COMLAYER_DLLNAME%....%OUTPUTDIRECT%) if {%RET%} NEQ {1} ( xcopy /R /Q /H /C "%COMLAYER_ECOSOURCE%\%COMLAYER_ECONAME%" "%COMLAYER_ECODEST%" >nul || (set RET=1& echo Could not copy %COMLAYER_ECONAME%....%OUTPUTDIRECT%) ) ELSE ( if exist "%COMLAYER_DLLDEST%\Backup of %COMLAYER_DLLNAME%-*" move "%COMLAYER_DLLDEST%\Backup of %COMLAYER_DLLNAME%-*" "%COMLAYER_DLLDEST%\%COMLAYER_DLLNAME%" >nul if exist "%COMLAYER_ECODEST%\Backup of %COMLAYER_ECONAME%-*" move "%COMLAYER_ECODEST%\Backup of %COMLAYER_ECONAME%-*" "%COMLAYER_ECODEST%\%COMLAYER_ECONAME%" >nul endlocal & goto :EOF ) %TRACE% %0 %COMLAYER_DLLNAME% registration successful. if defined COMLAYER_DATANAME call :comLayerInstallData if {%RET%} EQU {1} ( %TRACE% Could not install data for %1. Exitting this loop. endlocal & set RET=1& goto :EOF ) :: if we got this far then it must have installed so increment the success counter set /a successcount+=1 endlocal & set RET=0& set successcount=%successcount%& goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - comLayerInstallHandle :: :::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION comLayerSetDataArray :: ::::::::::::::::::::::::::::::::::::::::::: :: set optional COM Layer data file array variables :comLayerSetDataArray if not defined %1_DATANAME ( %TRACE% %0: Received %1 but required data array variables do not exist. set RET=1& goto :EOF ) ELSE ( set COMLAYER_DATANAME=%%%1_DATANAME%% call :resolveVar COMLAYER_DATANAME ) if not defined %1_DATATYPE ( %TRACE% %0: Received %1 but required data array variables do not exist. set RET=1& goto :EOF ) ELSE ( set COMLAYER_DATATYPE=%%%1_DATATYPE%% call :resolveVar COMLAYER_DATATYPE ) if not defined %1_DATASOURCE ( %TRACE% %0: Received %1 but required data array variables do not exist. set RET=1& goto :EOF ) ELSE ( set COMLAYER_DATASOURCE=%%%1_DATASOURCE%% call :resolveVar COMLAYER_DATASOURCE ) if not defined %1_DATADEST ( %TRACE% %0: Received %1 but required data array variables do not exist. set RET=1& goto :EOF ) ELSE ( set COMLAYER_DATADEST=%%%1_DATADEST%% call :resolveVar COMLAYER_DATADEST ) set RET=0& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION comLayerSetDataArray :: ::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::: :: CALL FUNCTION comLayerArchiveDLL :: :::::::::::::::::::::::::::::::::::::: :: called if the COM Layer DLL exists, and archives it :comLayerArchiveDLL setlocal & pushd "%COMLAYER_DLLDEST%" for /f %%a in ('dir /TW ^| findstr /i %COMLAYER_DLLNAME%') do set STAMP=%%a set STAMP=%STAMP:/=-% if exist "%COMLAYER_DLLNAME%-%STAMP%" del /F "%COMLAYER_DLLNAME%-%STAMP%" move %COMLAYER_DLLNAME% "Backup of %COMLAYER_DLLNAME%-%STAMP%" >nul endlocal & popd & set RET=0& goto :EOF :::::::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION comLayerArchiveDLL :: :::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::: :: CALL FUNCTION comLayerArchiveECO :: :::::::::::::::::::::::::::::::::::::: :: called if the COM Layer ECO exists, and archives it :comLayerArchiveECO setlocal & pushd "%COMLAYER_ECODEST%" for /f %%a in ('dir /TW ^| findstr /i "%COMLAYER_ECONAME%"') do set STAMP=%%a set STAMP=%STAMP:/=-% if exist "%COMLAYER_ECONAME%-%STAMP%" del /F "%COMLAYER_ECONAME%-%STAMP%" move %COMLAYER_ECONAME% "Backup of %COMLAYER_ECONAME%-%STAMP%" >nul endlocal & popd & set RET=0& goto :EOF :::::::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION comLayerArchiveECO :: :::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::: :: CALL FUNCTION comLayerInstallData :: ::::::::::::::::::::::::::::::::::::::: :: If COM Layer data was specified, install it :comLayerInstallData set RET= :: verify that the specified source directory for the support data exists if not exist "%COMLAYER_DATASOURCE%" ( %TRACE% %0 Could not install %COMLAYER_DATANAME%: Source directory does not exist. echo Could not install %COMLAYER_DATANAME%: Source directory does not exist.%OUTPUTDIRECT% set RET=1&goto :EOF ) :: checks to see if the support package has already been installed if exist "%COMLAYER_DATADEST%\%COMLAYER_DATANAME%" ( %cout% COM Layer data package %COMLAYER_DATANAME% already installed. It will be archived. %TRACE% COM Layer data package %COMLAYER_DATANAME% already installed. It will be archived. call :comLayerArchiveData if {%COMLAYER_DATATYPE%} EQU {DIRECTORY} ( %TRACE% %0 %COMLAYER_DATANAME% is a directory, trying to create it mkdir "%COMLAYER_DATADEST%\%COMLAYER_DATANAME%" set COMLAYER_DATADEST=%COMLAYER_DATADEST%\%COMLAYER_DATANAME% ) ) ELSE ( if {%COMLAYER_DATATYPE%} EQU {DIRECTORY} ( %TRACE% %0 %COMLAYER_DATANAME% is a directory, trying to create it mkdir "%COMLAYER_DATADEST%\%COMLAYER_DATANAME%" set COMLAYER_DATADEST=%COMLAYER_DATADEST%\%COMLAYER_DATANAME% ) ) :: execute the install %cout% Installing COM Layer support package %COMLAYER_DATANAME%.... %TRACE% %0 attempting to install "%COMLAYER_DATASOURCE%\%COMLAYER_DATANAME%" to "%COMLAYER_DATADEST%" xcopy /R /Q /H /C /E "%COMLAYER_DATASOURCE%\%COMLAYER_DATANAME%" "%COMLAYER_DATADEST%" >nul || (set RET=1& echo Could not copy %COMLAYER_DATANAME%....%OUTPUTDIRECT%& goto :EOF) %TRACE% %0 %COMLAYER_DATANAME% install successful set RET=0& goto :EOF ::::::::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION comLayerInstallData :: ::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::: :: CALL FUNCTION comLayerArchiveData :: ::::::::::::::::::::::::::::::::::::::: :: called if the COM Layer ECO exists, and archives it :comLayerArchiveData setlocal & pushd "%COMLAYER_DATADEST%" for /f %%a in ('dir /TW ^| findstr /i "%COMLAYER_DATANAME%"') do set STAMP=%%a set STAMP=%STAMP:/=-% if exist "%COMLAYER_DATANAME%-%STAMP%" del /F "%COMLAYER_DATANAME%-%STAMP%" move %COMLAYER_DATANAME% %COMLAYER_DATANAME%.%STAMP% >nul endlocal & popd & set RET=0& goto :EOF ::::::::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION comLayerArchiveData :: ::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - comLayerDrawScreen :: ::::::::::::::::::::::::::::::::::::::::::: :: draw the interactive screen for the support data installer :comLayerDrawScreen %CLS% %cout% EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% %cout% SOURCE: --%SRCDIR%-- %cout% TARGET: --%ROOTDIR%-- %cout%. %cout% [STAGE 6] -- INSTALL OPTIONAL COM LAYERS -- %cout%. %cout%. goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - comLayerDrawScreen :: ::::::::::::::::::::::::::::::::::::::::::::::: :: if we got this far, something is really wrong as we should have exitted through a branch echo %0 reached end of script... ???? endlocal & set RET=1& goto :EOF :::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - COMLAYER :: :::::::::::::::::::::::::::::::::: ::**************************************************************************** ::::::::::::::::::::::::::::::::: :: CALL FUNCTION - supportData :: ::::::::::::::::::::::::::::::::: :: Installs specified SUPPORTDATA packages as defined in the INI file :supportData :: set function level local variable scope setlocal & set RET= %TRACE% Called %LIBFILE% %* :: call function to draw the interactive screen if {%OUTMODE%} NEQ {silent} call :supportDataDrawScreen :: check to make sure that packages were specified for install if not defined SUPPORTDATA ( %TRACE% SUPPORTDATA not defined... skipping %cout% No Support Data configured for installation. endlocal& set STAGE7=NO DATA INCLUDED set RET=0& goto :EOF if /i {%OUTMODE%} NEQ {silent} pause ) :: initialize loop variables to count successes against total packages set totalcount=0 set successcount=0 :: parse the package names from SUPPORTDATA and send to the installer for %%a in (%SUPPORTDATA%) do call :supportDataInstallHandle %%a :: set report based on number of packages installed vs specified set STAGE7=%successcount% OF %totalcount% INSTALLED endlocal & set RET=0& set STAGE7=%STAGE7%& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - supportDataInstallHandle :: ::::::::::::::::::::::::::::::::::::::::::::::::: :: install engine for support data packages :supportDataInstallHandle %TRACE% Called %* :: increment the total counter set /a totalcount+=1 :: set function level local variable scope setlocal & set RET= :: check to make sure a package was sent in arg1 if {%1}=={} ( %TRACE% %0: No support data passed to install. endlocal & set RET=1& goto :EOF ) :: check to make sure array variables exist. if not defined %1_NAME ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_TYPE ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_SOURCE ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_DEST ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) :: set local _NAME placeholder to value of specified array variable and resolve set SUPTDATA_NAME=%%%1_NAME%% call :resolveVar SUPTDATA_NAME :: set local _TYPE placeholder to value of specified array variable and resolve set SUPTDATA_TYPE=%%%1_TYPE%% call :resolveVar SUPTDATA_TYPE :: set local _SOURCE placeholder to value of specified array variable and resolve set SUPTDATA_SOURCE=%%%1_SOURCE%% call :resolveVar SUPTDATA_SOURCE :: set local _DEST placeholder to value of specified array variable and resolve set SUPTDATA_DEST=%%%1_DEST%% call :resolveVar SUPTDATA_DEST :: verify that the specified source directory for the support data exists if not exist "%SUPTDATA_SOURCE%" ( %TRACE% %0 Could not install %SUPTDATE_NAME%: Source directory does not exist. echo Could not install %SUPTDATE_NAME%: Source directory does not exist.%OUTPUTDIRECT% endlocal & set RET=1&goto :EOF ) :: checks to see if the support package has already been installed if exist "%SUPTDATA_DEST%\%SUPTDATA_NAME%" ( %cout% Support package %SUPTDATA_NAME% already installed. %TRACE% Support package %SUPTDATA_NAME% already installed. endlocal & set RET=0& set /a successcount+=1& goto :EOF ) ELSE ( if {%SUPTDATA_TYPE%} EQU {DIRECTORY} ( %TRACE% %0 %SUPTDATA_NAME% is a directory, trying to create it mkdir "%SUPTDATA_DEST%\%SUPTDATA_NAME%" set SUPTDATA_DEST=%SUPTDATA_DEST%\%SUPTDATA_NAME% ) ) :: execute the install %cout% Installing support package %SUPTDATA_NAME%.... %TRACE% %0 attempting to install "%SUPTDATA_SOURCE%\%SUPTDATA_NAME%" to "%SUPTDATA_DEST%" xcopy /R /Q /H /C /E "%SUPTDATA_SOURCE%\%SUPTDATA_NAME%" "%SUPTDATA_DEST%" >nul || (endlocal & set RET=1& set STAGE6=DLL INSTALLED& echo Could not copy %SUPTDATE_NAME%....%OUTPUTDIRECT%& goto :EOF) %TRACE% %0 %SUPTDATA_NAME% install successful :: if we got this far then it must have installked so increment the success counter set /a successcount+=1 endlocal & set RET=0& set successcount=%successcount%& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - supportDataInstallHandle :: ::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - supportDataDrawScreen :: :::::::::::::::::::::::::::::::::::::::::::::: :: draw the interactive screen for the support data installer :supportDataDrawScreen %CLS% %cout% EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% %cout% SOURCE: --%SRCDIR%-- %cout% TARGET: --%ROOTDIR%-- %cout%. %cout% [STAGE 7] -- INSTALL OPTIONAL SUPPORT DATA -- %cout%. %cout%. goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - supportDataDrawScreen :: :::::::::::::::::::::::::::::::::::::::::::::::::: :: if we got this far, something is really wrong as we should have exitted through a branch echo %0 reached end of script... ???? endlocal & set RET=1& goto :EOF ::::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - supportData :: ::::::::::::::::::::::::::::::::::::: ******************************************************************* :::::::::::::::::::::::::::: :: CALL FUNCTION - setReg :: :::::::::::::::::::::::::::: :: Install INI specified registry settings :setReg :: set function level local variable scope setlocal & set RET= %TRACE% Called %LIBFILE% %* set REGFILE=%TEMP%\install%PACKAGE%_reg.reg echo REGEDIT4 > %REGFILE% echo. >> %REGFILE% :: call function to draw the interactive screen if {%OUTMODE%} NEQ {silent} call :setRegDrawScreen :: check to make sure that packages were specified for install if not defined SETREG ( %TRACE% SETREG not defined... skipping %cout% No registry keys or values configured for installation. endlocal& set STAGE8=NONE SPECIFIED set RET=0& goto :EOF if /i {%OUTMODE%} NEQ {silent} pause ) echo The following registry settings will be imported: %OUTPUTDIRECT% :: parse the package names from SUPPORTDATA and send to the installer for %%a in (%SETREG%) do call :setRegInstaller %%a if {%ATLEASTONEREG%} NEQ {1} ( echo.%OUTPUTDIRECT% echo NO REGISTRY SETTINGS MATCH THIS OS%OUTPUTDIRECT% endlocal & set STAGE8=NONE MATCH& set RET=0& goto :EOF ) :: check to see if it is WIN2K and in verbose mode, which will offer the ability to abort and continue :: If WINNT it will offer the ability to hit CTRL-C which will abort the entire install if {%NTREV%} NEQ {NT} ( if {%OUTMODE%} NEQ {silent} ( call :setRegUserOptionVersose2000 ) ) :: if the following statements are true then setVarsUserOptionVersose2000 was executed so exit if {%NTREV%} NEQ {NT} ( if {%OUTMODE%} NEQ {silent} ( endlocal & set RET=0& set STAGE8=%STAGE8%& goto :EOF ) ) :: if we are here then we didn't take the WIN2K verbose mode branch, so if we check to see if we are in NT verbose mode :: and offer to abort the script before kludging the registry :: OK, we must have been given the go ahead or we are in silent mode if /i {%OUTMODE%} NEQ {silent} echo Press any key to set these variables, or CTRL-C to abort...& pause >nul regedit /s "%REGFILE%" || (set RET=1& set STAGE8=ERROR& endlocal & goto :EOF) :: regedit must have succeeded so set the STAGE variable set STAGE8=INSTALLED :: woohoo, Marge! we're done with stage 8! endlocal & set RET=0& set STAGE8=%STAGE8%& goto :EOF ::::::::::::::::::::::::::::::::::::::::: :: SUB CALL FUNCTION - setRegInstaller :: ::::::::::::::::::::::::::::::::::::::::: :: Installer engine that calls the processor and creates the regfile :setRegInstaller %TRACE% Called %* setlocal & set RET= if {%1}=={} ( %TRACE% %0: No registry entry passed to install. endlocal & set RET=1& goto :EOF ) ELSE ( call :setRegProcessor %1 ) if {%RET%} EQU {1} goto :EOF echo [%REGISTRY_PATH%] >> %REGFILE% if defined REGISTRY_OS ( if {%NTREV%} NEQ {%REGISTRY_OS%} ( %TRACE% %REGISTRY_NAME% is specified for Windows %REGISTRY_OS% but this OS is %NTREV%. %TRACE% Installer will skip this entry. goto :EOF ) ) if {%REGISTRY_TYPE%} EQU {STRING} set REGISTRY_VALUE=%REGISTRY_VALUE:\=\\% if {%REGISTRY_TYPE%} EQU {BINARY} set REGISTRY_VALUE=%REGISTRY_VALUE: =,% if {%REGISTRY_TYPE%} EQU {STRING} ( %TRACE% Processing %REGISTRY_NAME% as a STRING value.... echo NAME : %REGISTRY_NAME%%OUTPUTDIRECT%& echo VALUE: ^(STRING^) %REGISTRY_VALUE%%OUTPUTDIRECT%& echo PATH : %REGISTRY_PATH%%OUTPUTDIRECT%&echo. %OUTPUTDIRECT% echo "%REGISTRY_NAME%"="%REGISTRY_VALUE%" >> %REGFILE% endlocal & set ATLEASTONEREG=1& set RET=0& goto :EOF ) if {%REGISTRY_TYPE%} EQU {DWORD} ( %TRACE% Processing %REGISTRY_NAME% as a DWORD value.... echo NAME : %REGISTRY_NAME%%OUTPUTDIRECT%& echo VALUE: ^(DWORD^) %REGISTRY_VALUE%%OUTPUTDIRECT%& echo PATH : %REGISTRY_PATH%%OUTPUTDIRECT%&echo. %OUTPUTDIRECT% echo "%REGISTRY_NAME%"=dword:%REGISTRY_VALUE% >> %REGFILE% endlocal & set ATLEASTONEREG=1& set RET=0& goto :EOF ) if {%REGISTRY_TYPE%} EQU {BINARY} ( %TRACE% Processing %REGISTRY_NAME% as a BINARY value.... echo NAME : %REGISTRY_NAME%%OUTPUTDIRECT%& echo VALUE: ^(BINARY^) %REGISTRY_VALUE%%OUTPUTDIRECT%& echo PATH : %REGISTRY_PATH%%OUTPUTDIRECT%&echo. %OUTPUTDIRECT% echo "%REGISTRY_NAME%"=hex:%REGISTRY_VALUE% >> %REGFILE% endlocal & set ATLEASTONEREG=1& set RET=0& goto :EOF ) :: We shouldn't get this far, but just in case endlocal & goto :EOF :::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - setRegInstaller :: :::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - setRegProcessor :: :::::::::::::::::::::::::::::::::::::::: :: registry array processor, creates each element for the installer :setRegProcessor %TRACE% Called %* set RET= :: check to make sure a package was sent in arg1 if {%1}=={} ( %TRACE% %0: No registry entry passed to process. endlocal & set RET=1& goto :EOF ) :: check to make sure array variables exist. if not defined %1_NAME ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_TYPE ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_VALUE ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) if not defined %1_PATH ( %TRACE% %0: Received %1 but required array variables do not exist. endlocal & set RET=1& goto :EOF ) :: set local _NAME placeholder to value of specified array variable and resolve set REGISTRY_NAME=%%%1_NAME%% call :resolveVar REGISTRY_NAME :: set local _TYPE placeholder to value of specified array variable and resolve set REGISTRY_TYPE=%%%1_TYPE%% call :resolveVar REGISTRY_TYPE :: set local _VALUE placeholder to value of specified array variable and resolve set REGISTRY_VALUE=%%%1_VALUE%% call :resolveVar REGISTRY_VALUE :: set local _PATH placeholder to value of specified array variable and resolve set REGISTRY_PATH=%%%1_PATH%% call :resolveVar REGISTRY_PATH :: set optional local _OS placeholder to value of specified array variable and resolve if defined %1_OS ( set REGISTRY_OS=%%%1_OS%% call :resolveVar REGISTRY_OS ) set RET=0& goto :EOF :::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - setRegProcessor :: :::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - setRegUserOptionVersose2000 :: ::::::::::::::::::::::::::::::::::::::::::::::::::::: :: If WIN2K verbose mode, this presents the variables that will be installed and offers a chance to abort :setRegUserOptionVersose2000 :: ENABLEDELAYEDEXPANSION is particular to WIN2K, and allows variables to be expanded as interpreted\ :: vice when each line of input is read. We are now three levels deep in setlocal, (script, call, and subcall) :: so make sure we endlocal each appropriately! setlocal ENABLEDELAYEDEXPANSION echo. echo Enter 1 if you would like to proceed or 2 to abort. set /P REGIMPORTOPT= if "!REGIMPORTOPT!" == "1" ( :: User affirmed so install the temp reg file. regedit /s "%REGFILE%" || (endlocal & set RET=1& set STAGE8=ERROR& goto :EOF) endlocal & set RET=0& set STAGE8=INSTALLED goto :EOF ) if "!REGIMPORTOPT!" == "2" ( :: User declined so post warning color c0 call :setRegDrawScreen echo *WARNING! You have opted not to set optional registry settings that may be echo required for some %PACKAGE% functions. echo. echo You may need to manually set the following: echo. echo. %SETREG% echo. echo. echo. pause color 1f echo System variables not installed at user's request. >> %LOG% endlocal & set RET=0& set STAGE8=USER ABORTED& goto :EOF ) :: else an invalid answer must have been entered, so force another answer call :setRegDrawScreen echo. echo. echo. echo Invalid Answer. Please select 1 or 2. echo Press any key to try again...& pause >nul endlocal& goto :setRegUserOptionVersose2000 :: we shouldn't get here as we would have branched, but just in case endlocal % set RET=1& goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - setRegUserOptionVersose2000 :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::: :: SUBCALL FUNCTION - setRegDrawScreen :: ::::::::::::::::::::::::::::::::::::::::: :: draw the interactive screen for the support data installer :setRegDrawScreen %CLS% %cout% EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGENAME% %cout% SOURCE: --%SRCDIR%-- %cout% TARGET: --%ROOTDIR%-- %cout%. %cout% [STAGE 8] -- INSTALL OPTIONAL REGISTRY SETTINGS -- %cout%. %cout%. goto :EOF ::::::::::::::::::::::::::::::::::::::::::::: :: END SUBCALL FUNCTION - setRegDrawScreen :: ::::::::::::::::::::::::::::::::::::::::::::: :: if we got this far, something is really wrong as we should have exitted through a branch echo %0 reached end of script... ???? endlocal & set RET=1& goto :EOF :::::::::::::::::::::::::::::::: :: END CALL FUNCTION - setReg :: :::::::::::::::::::::::::::::::: ******************************************************************* ::::::::::::::::::::::::::::::: :: CALL FUNCTION - endScreen :: ::::::::::::::::::::::::::::::: :: Configure Review screen and display installation results. :endScreen %CLS% %CLS% color 20 if {%OUTMODE%} NEQ {silent} ( echo EDEN Installation Utility %SCRIPTVERSION% - Installing %PACKAGE% echo SOURCE: --%SRCDIR%-- echo TARGET: --%ROOTDIR%-- echo. echo [REVIEW] -- INSTALLATION COMPLETE -- echo. ) echo.%OUTPUTDIRECT% echo STAGE 1 (Read Configuration File) : %STAGE1%%OUTPUTDIRECT% echo STAGE 2 (Verify EDGE Installation) : %STAGE2%%OUTPUTDIRECT% echo STAGE 3 (Detect Previous Installations) : %STAGE3%%OUTPUTDIRECT% echo STAGE 4 (Install Program Files) : %STAGE4%%OUTPUTDIRECT% echo STAGE 5 (Install Environment Variables) : %STAGE5%%OUTPUTDIRECT% echo STAGE 6 (Install COM Layers) : %STAGE6%%OUTPUTDIRECT% echo STAGE 7 (Install Support Data) : %STAGE7%%OUTPUTDIRECT% echo STAGE 8 (Set Optional Registry Settings) : %STAGE8%%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo The installation process is complete!%OUTPUTDIRECT% echo.%OUTPUTDIRECT% echo ******PLEASE REBOOT YOUR SYSTEM!******%OUTPUTDIRECT% echo.%OUTPUTDIRECT% if {%OUTMODE%} NEQ {silent} echo The Boeing Autometric %PACKAGE% team thanks you for using %PACKAGENAME%! & pause >nul set RET=0& goto :EOF ::::::::::::::::::::::::::::::::::: :: END CALL FUNCTION - endScreen :: ::::::::::::::::::::::::::::::::::: :: we should not be here, as we would have exitted through a lib path, but just in case endlocal & set RET=1& goto :EOF