8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:03:03 +01:00

Add script to test binary installer options

This commit is contained in:
Paul Reeves 2024-08-02 12:40:34 +02:00
parent e4fe559e80
commit 00c834c472
5 changed files with 1605 additions and 1112 deletions

View File

@ -1,116 +1,147 @@
Setup Command Line Parameters
# Setup Command Line Parameters
(Taken from InnoSetup Help v. 6.1.2 Deember 2020)
The Setup program accepts optional command line parameters. These can be useful to system administrators, and to other programs calling the Setup program.
/HELP, /?
**/HELP, /?**
Shows a summary of this information. Ignored if the UseSetupLdr [Setup] section directive was set to no.
/SP-
**/SP-**
Disables the This will install... Do you wish to continue? prompt at the beginning of Setup. Of course, this will have no effect if the DisableStartupPrompt [Setup] section directive was set to yes.
/SILENT, /VERYSILENT
**/SILENT, /VERYSILENT**
Instructs Setup to be silent or very silent. When Setup is silent the wizard and the background window are not displayed but the installation progress window is. When a setup is very silent this installation progress window is not displayed. Everything else is normal so for example error messages during installation are displayed and the startup prompt is (if you haven't disabled it with DisableStartupPrompt or the '/SP-' command line option explained above).
If a restart is necessary and the '/NORESTART' command isn't used (see below) and Setup is silent, it will display a Reboot now? message box. If it's very silent it will reboot without asking.
/SUPPRESSMSGBOXES
**/SUPPRESSMSGBOXES**
Instructs Setup to suppress message boxes. Only has an effect when combined with '/SILENT' or '/VERYSILENT'.
The default response in situations where there's a choice is:
•Yes in a 'Keep newer file?' situation.
•No in a 'File exists, confirm overwrite.' situation.
•Abort in Abort/Retry situations.
•Cancel in Retry/Cancel situations.
•Yes (=continue) in a DiskSpaceWarning/DirExists/DirDoesntExist/NoUninstallWarning/ExitSetupMessage/ConfirmUninstall situation.
•Yes (=restart) in a FinishedRestartMessage/UninstalledAndNeedsRestart situation.
•The recommended choice in a PrivilegesRequiredOverridesAllowed=dialog situation.
- Yes in a 'Keep newer file?' situation.
- No in a 'File exists, confirm overwrite.' situation.
- Abort in Abort/Retry situations.
- Cancel in Retry/Cancel situations.
- Yes (=continue) in a DiskSpaceWarning/DirExists/DirDoesntExist/NoUninstallWarning/ExitSetupMessage/ConfirmUninstall situation.
- Yes (=restart) in a FinishedRestartMessage/UninstalledAndNeedsRestart situation.
- The recommended choice in a PrivilegesRequiredOverridesAllowed=dialog situation.
5 message boxes are not suppressible:
•The About Setup message box.
•The Exit Setup? message box.
•The FileNotInDir2 message box displayed when Setup requires a new disk to be inserted and the disk was not found.
•Any (error) message box displayed before Setup (or Uninstall) could read the command line parameters.
•Any task dialog or message box displayed by [Code] support functions TaskDialogMsgBox and MsgBox.
- The About Setup message box.
- The Exit Setup? message box.
- The FileNotInDir2 message box displayed when Setup requires a new disk to be inserted and the disk was not found.
- Any (error) message box displayed before Setup (or Uninstall) could read the command line parameters.
- Any task dialog or message box displayed by [Code] support functions TaskDialogMsgBox and MsgBox.
**/ALLUSERS**
/ALLUSERS
Instructs Setup to install in administrative install mode. Only has an effect when the [Setup] section directive PrivilegesRequiredOverridesAllowed allows the commandline override.
/CURRENTUSER
**/CURRENTUSER**
Instructs Setup to install in non administrative install mode. Only has an effect when the [Setup] section directive PrivilegesRequiredOverridesAllowed allows the commandline override.
/LOG
**/LOG**
Causes Setup to create a log file in the user's TEMP directory detailing file installation and [Run] actions taken during the installation process. This can be a helpful debugging aid. For example, if you suspect a file isn't being replaced when you believe it should be (or vice versa), the log file will tell you if the file was really skipped, and why.
The log file is created with a unique name based on the current date. (It will not overwrite or append to existing files.)
The information contained in the log file is technical in nature and therefore not intended to be understandable by end users. Nor is it designed to be machine-parsable; the format of the file is subject to change without notice.
/LOG="filename"
**/LOG="filename"**
Same as /LOG, except it allows you to specify a fixed path/filename to use for the log file. If a file with the specified name already exists it will be overwritten. If the file cannot be created, Setup will abort with an error message.
/NOCANCEL
**/NOCANCEL**
Prevents the user from cancelling during the installation process, by disabling the Cancel button and ignoring clicks on the close button. Useful along with '/SILENT' or '/VERYSILENT'.
/NORESTART
**/NORESTART**
Prevents Setup from restarting the system following a successful installation, or after a Preparing to Install failure that requests a restart. Typically used along with /SILENT or /VERYSILENT.
/RESTARTEXITCODE=exit code
**/RESTARTEXITCODE=exit code**
Specifies a custom exit code that Setup is to return when the system needs to be restarted following a successful installation. (By default, 0 is returned in this case.) Typically used along with /NORESTART. See also: Setup Exit Codes
/CLOSEAPPLICATIONS
**/CLOSEAPPLICATIONS**
Instructs Setup to close applications using files that need to be updated by Setup if possible.
/NOCLOSEAPPLICATIONS
**/NOCLOSEAPPLICATIONS**
Prevents Setup from closing applications using files that need to be updated by Setup. If /CLOSEAPPLICATIONS was also used, this command line parameter is ignored.
/FORCECLOSEAPPLICATIONS
**/FORCECLOSEAPPLICATIONS**
Instructs Setup to force close when closing applications.
/NOFORCECLOSEAPPLICATIONS
**/NOFORCECLOSEAPPLICATIONS**
Prevents Setup from force closing when closing applications. If /FORCECLOSEAPPLICATIONS was also used, this command line parameter is ignored.
/LOGCLOSEAPPLICATIONS
**/LOGCLOSEAPPLICATIONS**
Instructs Setup to create extra logging when closing applications for debugging purposes.
/RESTARTAPPLICATIONS
**/RESTARTAPPLICATIONS**
Instructs Setup to restart applications if possible.
/NORESTARTAPPLICATIONS
**/NORESTARTAPPLICATIONS**
Prevents Setup from restarting applications. If /RESTARTAPPLICATIONS was also used, this command line parameter is ignored.
/LOADINF="filename"
**/LOADINF="filename"**
Instructs Setup to load the settings from the specified file after having checked the command line. This file can be prepared using the '/SAVEINF=' command as explained below.
Don't forget to use quotes if the filename contains spaces.
/SAVEINF="filename"
**/SAVEINF="filename"**
Instructs Setup to save installation settings to the specified file.
Don't forget to use quotes if the filename contains spaces.
/LANG=language
**/LANG=language**
Specifies the language to use. language specifies the internal name of the language as specified in a [Languages] section entry.
When a valid /LANG parameter is used, the Select Language dialog will be suppressed.
/DIR="x:\dirname"
**/DIR="x:\dirname"**
Overrides the default directory name displayed on the Select Destination Location wizard page. A fully qualified pathname must be specified. May include an "expand:" prefix which instructs Setup to expand any constants in the name. For example: '/DIR=expand:{autopf}\My Program'.
/GROUP="folder name"
**/GROUP="folder name"**
Overrides the default folder name displayed on the Select Start Menu Folder wizard page. May include an "expand:" prefix, see '/DIR='. If the [Setup] section directive DisableProgramGroupPage was set to yes, this command line parameter is ignored.
/NOICONS
**/NOICONS**
Instructs Setup to initially check the Don't create a Start Menu folder check box on the Select Start Menu Folder wizard page.
/TYPE=type name
**/TYPE=type name**
Overrides the default setup type.
If the specified type exists and isn't a custom type, then any /COMPONENTS parameter will be ignored.
/COMPONENTS="comma separated list of component names"
**/COMPONENTS="comma separated list of component names"**
Overrides the default component settings. Using this command line parameter causes Setup to automatically select a custom type. If no custom type is defined, this parameter is ignored.
Only the specified components will be selected; the rest will be deselected.
@ -120,11 +151,21 @@ If a component name is prefixed with a "*" character, any child components will
This parameter does not change the state of components that include the fixed flag.
Example:
Deselect all components, then select the "help" and "plugins" components:
/COMPONENTS="help,plugins" Example:
```
/COMPONENTS="help,plugins"
```
Example:
Deselect all components, then select a parent component and all of its children with the exception of one:
/COMPONENTS="*parent,!parent\child"
/TASKS="comma separated list of task names"
```
/COMPONENTS="*parent,!parent\child" /TASKS="comma separated list of task names"
```
Specifies a list of tasks that should be initially selected.
Only the specified tasks will be selected; the rest will be deselected. Use the /MERGETASKS parameter instead if you want to keep the default set of tasks and only select/deselect some of them.
@ -132,21 +173,41 @@ Only the specified tasks will be selected; the rest will be deselected. Use the
If a task name is prefixed with a "*" character, any child tasks will be selected as well (except for those that include the dontinheritcheck flag). If a task name is prefixed with a "!" character, the task will be deselected.
Example:
Deselect all tasks, then select the "desktopicon" and "fileassoc" tasks:
/TASKS="desktopicon,fileassoc" Example:
```
/TASKS="desktopicon,fileassoc"
```
Example:
Deselect all tasks, then select a parent task and all of its children with the exception of one:
/TASKS="*parent,!parent\child"
/MERGETASKS="comma separated list of task names"
```
/TASKS="*parent,!parent\child" /MERGETASKS="comma separated list of task names"
```
Like the /TASKS parameter, except the specified tasks will be merged with the set of tasks that would have otherwise been selected by default.
If UsePreviousTasks is set to yes, the specified tasks will be selected/deselected after any previous tasks are restored.
Example:
Keep the default set of selected tasks, but additionally select the "desktopicon" and "fileassoc" tasks:
/MERGETASKS="desktopicon,fileassoc" Example:
```
/MERGETASKS="desktopicon,fileassoc"
```
Example:
Keep the default set of selected tasks, but deselect the "desktopicon" task:
/MERGETASKS="!desktopicon"
/PASSWORD=password
```
/MERGETASKS="!desktopicon" /PASSWORD=password
```
Specifies the password to use. If the [Setup] section directive Password was not set, this command line parameter is ignored.
When an invalid password is specified, this command line parameter is also ignored.

View File

@ -0,0 +1,297 @@
#region Helper functions #############
function spacer() {
param ( [string]$message )
if ( $message ) {
Write-Output ''
Write-Output "=================== $message ==================="
Write-Output ''
} else {
Write-Output '------------------------------------------------------------------------------------------'
}
}
function Pause( [string] $_msg = "Press any key to continue..." ) {
Set-PSDebug -Trace 2
$null = Read-Host $_msg
# Write-Host -NoNewline $Message
# $Ignore =
# 16, # Shift (left or right)
# 17, # Ctrl (left or right)
# 18, # Alt (left or right)
# 20, # Caps lock
# 91, # Windows key (left)
# 92, # Windows key (right)
# 93, # Menu key
# 144, # Num lock
# 145, # Scroll lock
# 166, # Back
# 167, # Forward
# 168, # Refresh
# 169, # Stop
# 170, # Search
# 171, # Favorites
# 172, # Start/Home
# 173, # Mute
# 174, # Volume Down
# 175, # Volume Up
# 176, # Next Track
# 177, # Previous Track
# 178, # Stop Media
# 179, # Play
# 180, # Mail
# 181, # Select Media
# 182, # Application 1
# 183 # Application 2
# While ($KeyInfo.VirtualKeyCode -Eq $Null -Or $Ignore -Contains $KeyInfo.VirtualKeyCode) {
# $KeyInfo = $Host.UI.RawUI.ReadKey("NoEcho, IncludeKeyDown")
# }
# Write-Host
Set-PSDebug -Trace 0
}
function RunTimeStamp() {
Get-Date -UFormat '%Y-%m-%d_%H-%M-%S'
}
<#
.SYNOPSIS
Shorten the prompt
.DESCRIPTION
The path to the test installer script can get too long
.PARAMETER reset
Restore the full path
#>
function prompt( [switch]$reset ) {
$local:identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$local:principal = [Security.Principal.WindowsPrincipal] $local:identity
$local:adminRole = [Security.Principal.WindowsBuiltInRole]::Administrator
$( if (Test-Path variable:/PSDebugContext) { '[DBG]: ' }
elseif ($principal.IsInRole($adminRole)) { '[ADMIN]: ' }
else { '' }
) + $( if ( $reset -eq $true ) {
'PS ' + $(Get-Location) + $( if ( $NestedPromptLevel -ge 1 ) { '>>' } ) + '> '
} else {
'FBIT ' + '> '
} )
}
function check_file_exists( [string]$_apath, [switch]$_isdir ) {
if ( $_isdir ) {
return ( (Test-Path -Path $_apath ) -ne "" )
} else {
return ( ( Test-Path -Path $_apath -PathType Leaf ) -ne "" )
}
}
function Invoke-Command ($_commandPath, $_commandArguments, $_commandTitle, $_outfile ) {
Try {
$local:pinfo = New-Object System.Diagnostics.ProcessStartInfo
$local:pinfo.FileName = "$_commandPath"
$local:pinfo.RedirectStandardError = $true
$local:pinfo.RedirectStandardOutput = $true
$local:pinfo.UseShellExecute = $false
$local:pinfo.Arguments = "$_commandArguments"
$global:p = New-Object System.Diagnostics.Process
$global:p.StartInfo = $pinfo
$global:p.Start() | Out-Null
$local:result_object = [pscustomobject]@{
commandTitle = $_commandTitle
stdout = $p.StandardOutput.ReadToEnd()
stderr = $p.StandardError.ReadToEnd()
ExitCode = $p.ExitCode
}
$global:p.WaitForExit()
if ( "$_outfile" -ne '' ) {
$local:result_object.stdout > $_outfile
} else {
Write-Verbose $local:result_object.stdout
}
return $local:result_object.ExitCode
} catch {
Write-Output $local:result_object.stderr
return $local:result_object.ExitCode
}
}
#endregion end of helper functions #############
<#
.SYNOPSIS
Indicate if the (non-)existence of a file is a good or a bad thing.
.DESCRIPTION
When installing Firebird we expect certain files to exist.
When uninstalling we do not expect files to exist.
.PARAMETER afile
The file to check for
.PARAMETER str_if_true
The string to output if file exists. Defaults to 'good'
.PARAMETER str_if_false
The string to output if the file does not exist
.PARAMETER status_true_is_fail
When installing set status_true_is_fail to false.
When uninstalling set status_true_is_fail to true.
.PARAMETER isdir
Set isdir if testing for a directory.
.EXAMPLE
An example
.NOTES
General notes
#>
function check_file_status( $afile, [boolean]$status_true_is_fail, [boolean]$isdir
, [string]$str_if_true = 'good', [string]$str_if_false = 'bad'
) {
Write-Debug "Entering function $($MyInvocation.MyCommand.Name)"
$local:retval = check_file_exists $afile $isdir
if ( $local:retval -eq $true ) {
Write-Output "$TAB $afile exists - $str_if_true"
} else {
Write-Output "$TAB $afile not found - $str_if_false"
}
if ( $status_true_is_fail -eq $true -and $local:retval -eq $true ) {
Write-Verbose "$TAB $status_true_is_fail -eq $true -and $local:retval -eq $true "
$ErrorCount += 1
}
if ( $status_true_is_fail -eq $false -and $local:retval -eq $false ) {
Write-Verbose "$TAB $status_true_is_fail -eq $true -and $local:retval -eq $true "
$ErrorCount += 1
}
Write-Debug "Leaving function $($MyInvocation.MyCommand.Name)"
}
function check_server_arch_configured() {
Write-Debug "Entering function $($MyInvocation.MyCommand.Name)"
if ( $global:classicserver ) { $local:str_to_test = 'servermode = classic' }
if ( $global:superclassic ) { $local:str_to_test = 'servermode = superclassic' }
if ( $global:superserver ) { $local:str_to_test = 'servermode = super' }
# FIXME What if the fb.conf does not exist?
$local:found = (Select-String -Path "$FIREBIRD/firebird.conf" -Pattern ^$local:str_to_test)
if ( ! $local:found.Length -gt 0 ) {
$ErrorCount += 1
Write-Verbose $TAB $local:str_to_test not set in $FIREBIRD/firebird.conf
}
Write-Debug "Leaving function $($MyInvocation.MyCommand.Name)"
}
<#
.SYNOPSIS
Compare two strings
.DESCRIPTION
Long description
.PARAMETER expected
The result expected
.PARAMETER actual
The actual result
.PARAMETER equals_is_true
Set True if the actual result should equal the expected result
Or Set True if actualt result should not equal the expected result
.NOTES
General notes
#>
function check_result ( [string]$expected, [string]$actual, [boolean]$equals_is_true) {
# Write-Verbose "if ( ($expected -eq $actual ) -and $equals_is_true ){ return $true }"
if ( ( "$expected" -eq "$actual" ) -and $equals_is_true ) { return $true }
# Write-Verbose "if ( ($expected -eq $actual ) -and !$equals_is_true ){ return $false }"
if ( ( "$expected" -eq "$actual" ) -and ! $equals_is_true ) { return $false }
# Write-Verbose "if ( ($expected -ne $actual ) -and $equals_is_true ){ return $false }"
if ( ( "$expected" -ne "$actual" ) -and $equals_is_true ) { return $false }
# Write-Verbose "if ( ($expected -ne $actual ) -and !$equals_is_true ){ return $true }"
if ( ( "$expected" -ne "$actual" ) -and ! $equals_is_true ) { return $true }
}
function check_file_output( $afile, $apattern ) {
$local:aretval = Select-String -Path $afile -Pattern $apattern -SimpleMatch -Quiet
return $local:aretval
}
function print_output( $astring, [boolean]$found, [boolean]$found_is_fail
, [string]$str_if_true = "GOOD", [string]$str_if_false = "BAD" ) {
# If we find the string (ie result is not empty)
if ( $found ) {
if ( $found_is_fail ) {
Write-Host -ForegroundColor Red "${TAB}$astring - $str_if_false"
$global:ErrorCount += 1
} else {
Write-Host -ForegroundColor Green "${TAB}$astring - $str_if_true"
}
# We did not find the string
} else {
if ( $found_is_fail ) {
Write-Host -ForegroundColor Green "${TAB}$astring - $str_if_true"
} else {
Write-Host -ForegroundColor Red "${TAB}$astring - $str_if_false"
$global:ErrorCount += 1
}
}
}
<#
.SYNOPSIS
Execute SQL via isql.exe
.NOTES
This function assumes that the script to execute exists in $env:Temp\infile.txt
and the output will be stored in $env:Temp\outfile.txt
#>
function Exec_SQL( [string]$db = "localhost:employee",
[string]$username = "sysdba", [string]$pw = "masterkey" ) {
# Always reset outfile otherwise output is appended.
Write-Output "" > $env:Temp\outfile.txt
$local:retval = Invoke-Command "$global:FIREBIRD\isql.exe" " -user $username -password $pw -z `
-i $env:Temp/infile.txt -o $env:Temp/outfile.txt -m -m2 $db"
}

View File

@ -1,106 +0,0 @@
Firebird Binary Installer Test Harness HELP (Designed with TABS=4 and console width=120)
fbit {PARAM [...]]
Parameters may be passed in any order except for one special case:
fbit CLEAN
will clean up from previous broken installs. CLEAN must the first parameter
and subsequent parameters are ignored. Note: - It will run silently.
By default fbit installs Firebird according to the parameters passed and then
immediately uninstalls it. A copy of the install is made, along with the install and uninstall logs.
REQUIREMENTS
============
The script will attempt to detect if the current cmd session has just built firebird.
If not you must set FBINST_EXEC in the environment prior to running this script.
Be sure to check :SET_GLOBAL_ENV for hard-coded settings
Some knowledge of InnoSetup will be useful. See %FIREBIRD%/doc/installation_scripted.txt for more info.
FBIT Specific Parameters
========================
Param Name Value Passed to fbit Comment
---------- -------------------- -------
HELP - Displays this screen
DRYRUN - Show what will be done. No changes are made
NOARCHIVE - Disables copying of install dir to %USERPROFILE%\fbit
Logs and inf files are always saved.
NOUNINSTALL - Disable automatic uninstall for this test run
SCRIPTED - Sets VERYSILENT, SP and NOMSG
TESTNAME NameOfTestRun Optional. No spaces allowed. Used for storing test run details.
The following parameters are set by default. They are unset automatically when a conflicting parameter is passed.
Default Param Default Value set by fbit Unset by
------------- ------------------------- ----------
INTERACTIVE True SCRIPTED
INSTALLTYPE ServerInstall CLIENT or DEVINST
SERVICE_TASK True APPTASK
SUPERSERVER True CLASSICSERVER or SUPERCLASSIC
Firebird Installer specific Parameters
======================================
Param Name Value passed to installer Action when set
---------- ------------------------- ---------------
COPYGDSLIB CopyFbClientAsGds32Task Copy fbclient to <SYS> and rename to gds32
FORCE FORCE Force installation
NOAUTOSTART NULL Does not set AutoStartTask
NOCOPYFBLIB - Does not copy fbclient to <SYS>
PASSWORD /SYSDBAPASSWORD=%ISC_PASSWORD% Changes SYSDBA password from masterkey
See :SET_GLOBAL_ENV
Installation Tasks
==================
Param Name Value passed to /TASKS Comment
------------- ---------------------- ---------------
APPTASK UseApplicationTask Will not install as a service
CLASSICSERVER UseClassicServerTask Will configure classic server
SUPERCLASSIC UseSuperClassicTask Will configure super classic
Installation Types
==================
Param Name Value passed to /TYPE Comment
------------ --------------------- -------
CLIENT ClientInstall Minimal working client install
DEVINST DeveloperInstall Everything but the server.
SERVER_INSTALL ServerInstall
Uninstallation
==============
Param Name Value passed to uninstaller Comment
-------------- --------------------------- -------
CLEAN CLEAN Completely remove the firebird install
Reset list of shared dll's in the registry
Assumes installed version of Firebird matches %FIREBIRD_BASE_VER% set in fbit script.
Generic InnoSetup parameters
============================
Param Name Value passed to installer Comment
---------- ------------------------- -------
NOMSG SUPPRESSMSGBOXES Suppress message boxes
NOCANCEL NOCANCEL Prevents user cancelling install
SILENT SILENT
SP SP- Disables the This will install... prompt
VERYSILENT VERYSILENT
Examples
========
o Run a scripted server install:
fbit SCRIPTED
o Clean up previous firebird install:
fbit CLEAN
o Test install of firebird client:
fbit SCRIPTED CLIENT
-------------------------- End of Fbit Help Screen ----------------------------------------

View File

@ -1,958 +0,0 @@
@setlocal enabledelayedexpansion
:: DEBUG is intended for setting echo on globally. Each sub-routine tests
:: for DEBUG and if set VERBOSE is set. As each sub-routine exits VERBOSE
:: unset.
:: Uncomment 'call SET_VERBOSE' where needed to turn on VERBOSE
:: NOTE - DEBUG and VERBOSE still need some work around the use of the @ prefix.
@set DEBUG=
@if not defined DEBUG @echo off
:: Use this to check UAC status
:: - 0x1 means UAC is on and user will be asked for permission
:: - 0x0 means that UAC is off and install/uninstall will run without asking for permission
:: - User with Admin rights is still recommended.
::reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUA | grep REG | cut -d" " -f 13
:: NOTE - This script is not intended as an example of best practice for a
:: scripted install of Firebird. It is designed to test almost all possible
:: scriptable combinations and is thus far more complicated than a typical
:: install script need be. However, it can be used for testing. Note that chosen
:: settings used for each test run are saved into an .inf file, along with a
:: log of the install run.
@goto :MAIN %*
@goto :EOF
::=======================================================
:SET_GLOBAL_ENV
@call :SET_VERBOSE_IF_DEBUG_ON
::@call :SET_VERBOSE
@if defined DEBUG @echo Entering %0
:: Uncomment this if the default command prompt takes up too much space
::@PROMPT=fbit_prompt$G
:: Set this to the location of the firebird installer you want to test.
::@set FBINST_EXEC=%USERPROFILE%\Desktop\Firebird-5.0.0.0000_x64.exe
:: if we have just built firebird we can test the install immediately
if defined FBBUILD_FILE_ID (
if defined FBBUILD_FILENAME_SUFFIX (
@set FBINST_EXEC=%FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%%FBBUILD_FILENAME_SUFFIX%.exe
) else (
@set FBINST_EXEC=%FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%.exe
)
) else (
rem FBINST_EXEC must point to the package we want to test...
if not defined FBINST_EXEC (
rem Set the actual path and filename here - or set it in the environment before running fbit.
set FBINST_EXEC=%USERPROFILE%\Desktop\Firebird-5.0.0.0000_0_x64_RC1.exe
)
)
:: This should be set dynamically, perhaps. But for now it is hard-coded.
@set FIREBIRD_BASE_VER=Firebird_5_0
:: It is possible that successive installs into the same directory may
:: generate different uninstallers but for now we hard code the default.
@set UNINSTALLEXE=unins000.exe
:: The log dir should probably be under %TEMP% (or something like that)
:: In any case we try to create it if it doesn't exist
@set FBINSTALLLOGDIR=%USERPROFILE%\fbit-tests\logs
:: We use this dir to store copies of each install for future comparison
:: Perhaps this should be under the User's dir?
@set FBINSTALLCOPYDIR=%USERPROFILE%\fbit-tests\install_archive
:: This is just the default root directory for all versions of firebird
@set FIREBIRDROOTDIR="%ProgramFiles%\Firebird"
:: This is the default click through install dir.
:: It is created by the installer if it does not exist.
@set FIREBIRD=%FIREBIRDROOTDIR%\%FIREBIRD_BASE_VER%
:: Set this to 1 if you want to see the generated final command in the screen
:: output. Innosetup stores it automatically in the log file so this is not
:: necessary in normal use. Displaying it also makes the screen output harder
:: to read.
@set SHOW_FINAL_CMD=
:: change as reqd
@if not defined ISC_PASSWORD (
@set ISC_PASSWORD="secret"
)
@set TAB= &
@if not defined DRYRUN (
if not exist %FBINSTALLLOGDIR% ( @mkdir %FBINSTALLLOGDIR% >nul 2>nul )
if not exist %FBINSTALLCOPYDIR% ( @mkdir %FBINSTALLCOPYDIR% >nul 2>nul )
)
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::====SET_GLOBAL_ENV============================================
::=======================================================
:GET_OPTS
@call :SET_VERBOSE_IF_DEBUG_ON
::@call :SET_VERBOSE
@if defined DEBUG @echo Entering %0
:: Automatically parse the commandline and place all valid options into ENV VARS
:: Courtesy of this link:
:: https://stackoverflow.com/questions/3973824/windows-bat-file-optional-argument-parsing
::@setlocal enabledelayedexpansion
:: NOTE 1: These variable names are case insensitive - we can pass CLEAN or
:: clean, for example.
:: NOTE 2: Variables with defaults are impossible to undefine via passing
:: parameters. They must be undefined in code.
:: NOTE 3: Most variables are flags. If a flag has a default it will take the
:: value of the next flag on the command line. For example
:: flag: flagwithdefault:1
:: and this order of params:
:: flagwithdefault flag
:: will end up as
:: flagwithdefault=flag
:: Basically all this means that these variables should not be passed to runtime:
:: INTERACTIVE INSTALL INSTALLTYPE SERVER_INSTALL SERVICE_TASK SUPERSERVER
set "options=APPTASK: CLASSICSERVER: CLEAN: CLIENT: CMD_PARAMS: COMPONENTS: COPYGDSLIB: DEVINST: DRYRUN: FINALCMD: FULL_CMD: FORCE: HELP: INTERACTIVE:1 INSTALL:1 INSTALLTYPE:ServerInstall NOARCHIVE: NOAUTOSTART: NOCANCEL: NOCOPYFBLIB: NOMSG: NOUNINSTALL: PASSWORD: RUN_TIMESTAMP: SCRIPTED: SERVER_INSTALL:1 SILENT: SP: SERVICE_TASK: SUPERCLASSIC: SUPERSERVER: TASK_LIST: TESTNAME:"" UNINSTALL: VERYSILENT: XRESULT:0"
@if defined VERBOSE @echo on
for %%O in (%options%) do (
for /f "tokens=1,* delims=:" %%A in ("%%O") do (
set "%%A=%%~B"
)
)
@if defined VERBOSE (
@call :PRINT_VARS
if NOT defined DEBUG pause
)
:loop
@if not "%~1"=="" (
set "test=!options:*%~1:=! "
if "!test!"=="!options! " (
echo Error: Invalid option %~1
) else if "!test:~0,1!"==" " (
set "%~1=1"
) else (
set "%~1=%~2"
shift
)
@if defined VERBOSE (
@set %1
if NOT defined DEBUG pause
)
shift
goto :loop
)
@if defined VERBOSE ( @call :PRINT_VARS )
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::=======================================================
::=======================================================
:SET_PARAMS
@call :SET_VERBOSE_IF_DEBUG_ON
@if defined DEBUG @echo Entering %0
::@call :SET_VERBOSE
:: Current possible install options (FB4 RC1)
:: [Types] - ServerInstall DeveloperInstall ClientInstall CustomInstall
:: [Components] - ServerComponent DevAdminComponent ClientComponent
:: [Tasks] - UseClassicServerTask UseSuperClassicTask UseSuperClassicTask\UseGuardianTask ^
:: UseSuperServerTask UseSuperServerTask\UseGuardianTask UseApplicationTask UseServiceTask ^
:: AutoStartTask CopyFbClientToSysTask CopyFbClientAsGds32Task
:: Defaults are
:: SetupType=serverinstall
:: Components=servercomponent,devadmincomponent,clientcomponent
:: Tasks=usesuperservertask,useservicetask,autostarttask,copyfbclienttosystask
:: InnoSetup can use MERGETASKS to add non-exclusive tasks to the default list.
:: For example:
:: MERGETASKS="UseSuperServerTask\UseGuardianTask,CopyFbClientAsGds32Task"
:: UNFORTUNATELY we can't negate tasks with ! if delayed variable expansion is
:: used so this option is not very useful to us.
::
:: Instead we use TASKS to entirely redefine the task list. For example:
:: TASKS="UseClassicServerTask,UseApplicationTask,CopyFbClientAsGds32Task"
:: There are other things we could test, maybe one day. See the installer help
:: dialogue or innosetup help for setup commandline params.
:: FBIT uses SCRIPTED to automatically set /SP- /VERYSILENT /SUPPRESSMSGBOXES
:: INTERACTIVE and SCRIPTED are incompatible. INTERACTIVE is default but the
:: variable is never tested.
@if defined SCRIPTED (
set VERYSILENT=VERYSILENT
set SP=SP-
set NOMSG=SUPPRESSMSGBOXES
set INTERACTIVE=
)
@if defined UNINSTALL (
set INSTALL=
@if defined CLEAN ( set CMD_PARAMS=!CMD_PARAMS! /CLEAN )
rem We now have everything we need for uninstall so jump to the end
goto :SET_CMD_PARAMS
)
:: Fix up any incompatible assignments :::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@if defined CLIENT (
set INSTALLTYPE=ClientInstall
set DEVINST=
set SERVER_INSTALL=
set TASK_LIST=
set SERVICE_TASK=
set CLASSICSERVER=
set SUPERCLASSIC=
set SUPERSERVER=
)
@if defined DEVINST (
set INSTALLTYPE=DeveloperInstall
set CLIENT=
set SERVER_INSTALL=
set TASK_LIST=
set SERVICE_TASK=
set CLASSICSERVER=
set SUPERCLASSIC=
set SUPERSERVER=
)
:: Theoretically this next line is redundant
@if defined SERVER_INSTALL (
set INSTALLTYPE=ServerInstall
set CLIENT=
set DEVINST=
@if defined CLASSICSERVER (
set SUPERSERVER=
set SUPERCLASSIC=
set TASK_LIST=UseClassicServerTask
) else (
@if defined SUPERCLASSIC (
set SUPERSERVER=
set CLASSICSERVER=
set TASK_LIST=UseSuperClassicTask
) else (
rem @if defined SUPERSERVER (
set SUPERCLASSIC=
set CLASSICSERVER=
set SUPERSERVER=1
set TASK_LIST=UseSuperServerTask
)
)
)
::@call :SET_VERBOSE
@call :PRINT_VARS In %0 - End of Fixup
:::::::::: End Fix Up incompatible assignments :::::::::::::::::::::::::::::::::
:: Now build our task list
:: At this stage, if TASK_LIST is not defined then we are not doing a server install
@if defined TASK_LIST (
if defined APPTASK (
set TASK_LIST=!TASK_LIST!,UseApplicationTask
set INSTALLTYPE=CustomInstall
) else (
set TASK_LIST=!TASK_LIST!,UseServiceTask
)
if NOT defined NOAUTOSTART (
set TASK_LIST=!TASK_LIST!,AutoStartTask
set INSTALLTYPE=CustomInstall
)
)
@if NOT defined NOCOPYFBLIB (
if not defined TASK_LIST (
set TASK_LIST=CopyFbClientToSysTask
) else (
set TASK_LIST=!TASK_LIST!,CopyFbClientToSysTask
)
set INSTALLTYPE=CustomInstall
)
@if defined COPYGDSLIB (
if not defined TASK_LIST (
set TASK_LIST=CopyFbClientAsGds32Task
) else (
set TASK_LIST=!TASK_LIST!,CopyFbClientAsGds32Task
)
set INSTALLTYPE=CustomInstall
)
@call :PRINT_VARS In %0 - End of set TASK_LIST
:SET_CMD_PARAMS
:: set up the CMD_PARAMS variable we will use
@if defined FORCE (set CMD_PARAMS=!CMD_PARAMS! /FORCE )
@if defined NOCANCEL (set CMD_PARAMS=!CMD_PARAMS! /NOCANCEL )
:: Setting PASSWORD is only relevant for a server install
@if defined PASSWORD (
if defined SERVER_INSTALL (
set SYSDBAPASSWORD=%ISC_PASSWORD%
set CMD_PARAMS=!CMD_PARAMS! /SYSDBAPASSWORD=%SYSDBAPASSWORD%
set INSTALLTYPE=CustomInstall
)
)
@if defined NOMSG set CMD_PARAMS=!CMD_PARAMS! /SUPPRESSMSGBOXES
@if defined SILENT set CMD_PARAMS=!CMD_PARAMS! /SILENT
@if defined SP set CMD_PARAMS=!CMD_PARAMS! /SP-
@if defined VERYSILENT set CMD_PARAMS=!CMD_PARAMS! /VERYSILENT
:: Setting CustomInstall clears the default COMPONENTS list so we
:: must define it manually
::echo INSTALLTYPE %INSTALLTYPE%
@if /I "%INSTALLTYPE%" == "CustomInstall" (
if defined CLIENT ( set COMPONENTS=ClientComponent)
if defined DEVINST ( set COMPONENTS=DevAdminComponent,ClientComponent)
if defined SERVER_INSTALL ( set COMPONENTS=ServerComponent,DevAdminComponent,ClientComponent)
) else (
set COMPONENTS=ServerComponent,DevAdminComponent,ClientComponent
)
@if defined INSTALL (
if defined TASK_LIST (
set FULL_CMD=/TYPE=!INSTALLTYPE! /TASKS="!TASK_LIST!" /COMPONENTS="!COMPONENTS!" !CMD_PARAMS!
) else (
set FULL_CMD=/TYPE=!INSTALLTYPE! /COMPONENTS="!COMPONENTS!" !CMD_PARAMS!
)
) else (
set FULL_CMD=!CMD_PARAMS!
)
@call :PRINT_VARS In %0 - After setting COMPONENTS and FULL_CMD
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::===SET_PARAMS==========================================
::=======================================================
:PRINT_VARS
:: if a variable is not defined we don't print it, except for critical
:: variables such as FINALCMD that MUST be defined.
@if not defined VERBOSE goto :EOF
@if not "%~1" == "" ( echo %* )
@echo Variables set during script execution are:
@set ADIRNAME 2>nul
@set APPTASK 2>nul
@set CLASSICSERVER 2>nul
@set CLEAN 2>nul
@set CLIENT 2>nul
@set CMD_PARAMS 2>nul
@set COMPONENTS 2>nul
@set COPYGDSLIB 2>nul
@set DEVINST 2>nul
@set DRYRUN 2>nul
@set FBINST_EXEC 2>nul
@set FIREBIRD 2>nul
@set FINALCMD 2>nul
@set FULL_CMD 2>nul
@set FORCE 2>nul
@set INTERACTIVE 2>nul
@set INSTALL 2>nul
@set ISC_USER 2>nul
@set ISC_PASSWORD 2>nul
@set MERGE_TASKS 2>nul
@set NOARCHIVE= 2>nul
@set NOAUTOSTART 2>nul
@set NOCANCEL 2>nul
@set NOCOPYFBLIB 2>nul
@set NOMSG 2>nul
@set NOUNINSTALL 2>nul
@set PASSWORD 2>nul
@set RUN_TIMESTAMP 2>nul
@set SCRIPTED 2>nul
@set SERVER_INSTALL 2>nul
@set SERVICE_TASK 2>nul
@set SILENT 2>nul
@set SP 2>nul
@set SUPERCLASSIC 2>nul
@set SUPERSERVER 2>nul
@set TASK_LIST 2>nul
@set TESTNAME 2>nul
@set UNINSTALL 2>nul
@set VERYSILENT 2>nul
@echo.
@if NOT defined DEBUG pause
@goto :EOF
::=======================================================
::=======================================================
:RUN_INSTALLER
@echo.
@echo.
@call :SET_VERBOSE_IF_DEBUG_ON
@if defined DEBUG @echo Entering %~0 %*
@call :CHECK_ENV
@if defined _err ( goto :EOF)
@call :GET_OPTS %*
@call :SET_PARAMS %*
::@call :SET_VERBOSE
@if defined VERBOSE @echo FULL_CMD is %FULL_CMD%
@if defined VERBOSE ( if NOT defined DEBUG pause )
@call :TIMESTAMP
@if defined DEBUG echo After call TIMESTAMP
@set RUN_TIMESTAMP=%TIMESTAMP%
@set INSTALL_TIMESTAMP=%TIMESTAMP%
@if defined DEBUG echo Before set FINALCMD
@set FINALCMD=%FBINST_EXEC% %FULL_CMD% /DIR=%FIREBIRD% /LOG=%FBINSTALLLOGDIR%\install%RUN_TIMESTAMP%.log /SAVEINF=%FBINSTALLLOGDIR%\install%RUN_TIMESTAMP%-saved.inf
@if defined DEBUG echo After set FINALCMD
@if defined DRYRUN (
@echo DRYRUN - Not executing call %FINALCMD%
) else (
@if defined DEBUG @echo DRYRUN not set
@if defined SHOW_FINAL_CMD (@echo Executing %FINALCMD%)
@call %FINALCMD%
@if ERRORLEVEL 1 (
rem @echo Calling %FBINST_EXEC% failed with %ERRORLEVEL%
set _err=%ERRORLEVEL%
@call :ISS_ERROR %_err% %FBINST_EXEC% %FULL_CMD%
set /A XRESULT+=1
@goto :EOF
) else (
@echo Calling %FBINST_EXEC%......................SUCCESS!
)
@echo.
@echo Now checking system state...
@if defined SERVER_INSTALL (
call :CHECKSERVICECONFIGURED
call :CHECKSERVICEINSTALLED
)
@if not defined NOCOPYFBLIB (
call :CHECKFILEEXISTS c:\windows\system32\fbclient.dll good bad err_is_fail
) else (
call :CHECKFILEEXISTS c:\windows\system32\fbclient.dll bad good no_err_is_fail
)
@if not defined COPYGDSLIB (
call :CHECKFILEEXISTS c:\windows\system32\gds32.dll bad good no_err_is_fail
) else (
call :CHECKFILEEXISTS c:\windows\system32\gds32.dll good bad err_is_fail
)
@echo Calling COPY_INSTALL
@call :COPY_INSTALL
@echo.
)
@echo.
@echo %0 completed with %XRESULT% errors
@set XRESULT=0
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@echo.
@echo.
@goto :EOF
::===RUN_INSTALLER=================================
::=========================================================
:RUN_UNINSTALLER
@echo.
@echo.
@call :SET_VERBOSE_IF_DEBUG_ON
::@call :SET_VERBOSE
@if defined DEBUG @echo Entering %0 %*
@if defined NOUNINSTALL ( echo NOUNINSTALL set. Not running uninstaller & exit /b 1)
::@call :RESET_INSTALL_ENV
@call :GET_OPTS %* UNINSTALL
@call :SET_PARAMS
::@call :SET_VERBOSE
@if defined VERBOSE @echo on
@if defined VERBOSE @call :PRINT_VARS
@if defined VERBOSE @echo FULL_CMD is %FULL_CMD%
@if defined NOUNINSTALL (
@echo NOUNINSTALL was passed. Exiting %0.
@goto :EOF
)
@call :TIMESTAMP
@set RUN_TIMESTAMP=%TIMESTAMP%
@set FINALCMD=%FIREBIRD%\%UNINSTALLEXE% %FULL_CMD% /log=%FBINSTALLLOGDIR%\uninstall%RUN_TIMESTAMP%.log
@if defined VERBOSE ( if NOT defined DEBUG (pause) )
@if defined DRYRUN (
echo DRYRUN - Not executing call %FINALCMD%
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@echo.
@echo.
goto :EOF
)
@if defined SHOW_FINAL_CMD @echo Executing %FINALCMD%
@call %FINALCMD% 2>nul
if errorlevel 1 (
set _err=%ERRORLEVEL%
) else (
set _err=0
)
if %_err% GEQ 1 (
set _err=%ERRORLEVEL%
@call :ISS_ERROR %_err% %UNINSTALLEXE% %FULL_CMD%
set /A XRESULT+=1
) else (
echo Calling %FIREBIRD%\%UNINSTALLEXE% ................SUCCESS!
)
rem We need to give time to the uninstaller to clean up
rem If the install is interactive we need to close the final msg box first
rem If the install is scripted we need to pause a few seconds.
rem Change as required for your system.
if INTERACTIVE equ 1 (
echo Close the uninstaller dialog now!!!
timeout /t 10
) else (
timeout /t 3
)
echo.
echo Now checking system state...
@call :CHECKFILEEXISTS c:\windows\system32\fbclient.dll bad good no_err_is_fail
@call :CHECKFILEEXISTS c:\windows\system32\gds32.dll bad good no_err_is_fail
if defined CLEAN (
@call :CHECKSHAREDDLLS
@call :CHECKFILEEXISTS %FIREBIRD% bad good no_err_is_fail
)
echo.
@call :COPY_INSTALL
echo.
)
echo.
echo %0 completed with %XRESULT% errors
set XRESULT=0
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@echo.
@echo.
@goto :EOF
::====CLICK_THROUGH_UNINSTALL========================
::=====================================
:CHECKFILEEXISTS
@if defined DEBUG @echo Entering %0
@call :SET_VERBOSE_IF_DEBUG_ON
:: DIR returns an error if file not found and zero if file is returned so we
:: have to turn things around a bit if we want to test for a file that SHOULD
:: be removed. In that case no error is a bad sign!
::
:: This sub-routine takes four params
:: - %1 filename or dirname to verify
:: - %2 - string for no error from dir. ie if we expect the file to exist
:: then pass GOOD. If we don't expect it then we pass BAD.
:: - %3 - string to output if DIR throws an error
:: - %4 - flag to indicate if 0 is an error or not
::@call :SET_VERBOSE
@if defined VERBOSE @echo on
@if defined VERBOSE @echo %*
dir %1 >nul 2>nul
@if errorlevel 1 (
set _err=%ERRORLEVEL%
) else (
set _err=0
)
@if %_err% EQU 0 (
@echo %TAB% %1 exists - %2 !
) else (
@echo %TAB% %1 not found - %3 !
)
@if "%4"=="err_is_fail" (
if %_err% GTR 0 (
set /A XRESULT+=1
@echo XRESULT++
)
)
@if "%4"=="no_err_is_fail" (
if %_err% EQU 0 (
set /A XRESULT+=1
@echo XRESULT++
)
)
@call :RESET_ERRORLEVEL
@call :UNSET_VERBOSE
@if defined DEBUG @echo Leaving %0
@goto :EOF
::===CHECKFILEEXISTS==================================
::=====================================
:CHECKSHAREDDLLS
@if defined DEBUG @echo Entering %0
@call :SET_VERBOSE_IF_DEBUG_ON
@reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs > %TEMP%\shareddlls.txt
::@grep --ignore-case --count firebird %TEMP%\shareddlls.txt > %TEMP%\shareddllscount.txt
type %TEMP%\shareddlls.txt | find /C /I "firebird" > %TEMP%\shareddllscount.txt
set /p SHAREDDLLSCOUNT= < %TEMP%\shareddllscount.txt
@if NOT defined DEBUG del /q %TEMP%\shareddll*.txt
@if %SHAREDDLLSCOUNT% GTR 0 (
@echo %TAB% Oops - residue in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs
set /A XRESULT+=1
@echo XRESULT++
)
@call :RESET_ERRORLEVEL
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::===CHECKSHAREDDLLS===================
::=====================================
:CHECKSERVICECONFIGURED
@if defined DEBUG @echo Entering %0
@call :SET_VERBOSE_IF_DEBUG_ON
:: Add test for server arch set in firebird.conf
if defined CLASSICSERVER ( set STR_TO_TEST="servermode = classic" )
if defined SUPERCLASSIC ( set STR_TO_TEST="servermode = superclassic" )
if defined SUPERSERVER ( set STR_TO_TEST="servermode = super" )
call :CHECKSTRING %STR_TO_TEST% %FIREBIRD%\\firebird.conf
if ERRORLEVEL 1 (
@echo %TAB% %STR_TO_TEST% not set in %FIREBIRD%\\firebird.conf
set /A XRESULT+=1
@echo XRESULT++
)
@call :RESET_ERRORLEVEL
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::===CHECKSERVICECONFIGURED===================
::=====================================
:CHECKSERVICEINSTALLED
@if defined DEBUG @echo Entering %0
@call :SET_VERBOSE_IF_DEBUG_ON
%FIREBIRD%\\instsvc.exe q
@call :RESET_ERRORLEVEL
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::===CHECKSERVICEINSTALLED===================
::=====================================
:COPY_INSTALL
@call :SET_VERBOSE_IF_DEBUG_ON
@if defined DEBUG @echo Entering %0
::@call :SET_VERBOSE
@if defined VERBOSE @echo on
:: ADIRNAME should normally be set during install and persist for uninstall
@if not defined ADIRNAME (
@if defined INSTALL_TIMESTAMP (
@if defined TESTNAME (
@set ADIRNAME=%FBINSTALLCOPYDIR%\%FIREBIRD_BASE_VER%_%INSTALLTYPE%_%TESTNAME%_%INSTALL_TIMESTAMP%
) else (
@set ADIRNAME=%FBINSTALLCOPYDIR%\%FIREBIRD_BASE_VER%_%INSTALLTYPE%_%INSTALL_TIMESTAMP%
)
) else (
@set ADIRNAME=%FBINSTALLCOPYDIR%\%FIREBIRD_BASE_VER%_Uninstall_%RUN_TIMESTAMP%
)
)
@if defined verbose @echo ADIRNAME is %ADIRNAME%
@mkdir %ADIRNAME% 2>nul
@if defined INSTALL (
@if not defined NOARCHIVE (
@echo %TAB% Copying Install to %ADIRNAME%
@xcopy /e /i /y %FIREBIRD% %ADIRNAME% > nul
@if errorlevel 1 (
@echo ERROR Failure executing xcopy /e /i /y %FIREBIRD% %ADIRNAME%
)
)
@copy %FBINSTALLLOGDIR%\install%RUN_TIMESTAMP%-saved.inf %ADIRNAME%\install-saved.inf > nul
@copy %FBINSTALLLOGDIR%\install%RUN_TIMESTAMP%.log %ADIRNAME%\install.log > nul
) else (
@echo %TAB% Copying uninstall log to %ADIRNAME%
@copy %FBINSTALLLOGDIR%\uninstall%RUN_TIMESTAMP%.log %ADIRNAME%\uninstall.log > nul
)
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::===COPY_INSTALL======================
::=====================================
:CHECK_ENV
:: TODO - add more checks for the environment declared in SET_GLOBAL_ENV
if not exist %FBINST_EXEC% (
echo %~0 failed
echo Cannot find %FBINST_EXEC%
echo Check the setting of FBINST_EXEC
set _err=1
exit /b %_err%
)
goto :EOF
::===CHECK_ENV=========================
::=====================================
:RESET_ERRORLEVEL
:: ERRORLEVEL is an internal variable. We can see its value with
:: 'echo %ERRORLEVEL%' but if we try to reset its value with
:: SET ERRORLEVEL=0 we just create an env var called ERRORLEVEL which will
:: not have the same value as the internal ERRORLEVEL. We have to execute an
:: arbitrary command that cannot fail if we want to really reset the internal
:: variable.
@set _err=
@ver > nul
@goto :EOF
::===RESET_ERRORLEVEL==================
::=====================================
:SET_VERBOSE_IF_DEBUG_ON
:: The script is designed to allow turning VERBOSE on at the sub-routine level
:: If we set DEBUG globally then we should turn on VERBOSE automatically when
:: we enter a sub-routine
@if defined DEBUG (
@set VERBOSE=1
@echo on
)
@goto :EOF
::===SET_VERBOSE_IF_DEBUG_ON================
::=====================================
:SET_VERBOSE
@set VERBOSE=1
@echo on
@goto :EOF
::===SET_VERBOSE================
::=====================================
:UNSET_VERBOSE
:: Unset VERBOSE before exiting each sub-routine.
:: and force echo off
@if NOT defined DEBUG (
@set VERBOSE=
@echo off
)
@goto :EOF
::===UNSET_VERBOSE================
::=====================================
:HELP
@echo off
@echo.
@more /e /t4 %~d0%~p0fbit-help.txt
@echo.
goto :EOF
::===HELP==============================
::=====================================
:ISS_ERROR
@echo.
@echo InnoSetup ErrorCode %1 from calling %~2 %~3 %~4 %~5 %~6 %~7 %~8 %~9
@echo.
@if "%1"=="1" (
@echo Setup failed to initialize.
@echo.
@goto :EOF
)
@if "%1"=="2" (
@echo The user clicked Cancel in the wizard before the actual installation
@echo started, or chose 'No' on the opening 'This will install...' message box.
@echo.
@goto :EOF
)
@if "%1" == "3" (
@echo A fatal error occurred while preparing to move to the next
@echo installation phase (for example, from displaying the pre-installation
@echo wizard pages to the actual installation process). This should never
@echo happen except under the most unusual of circumstances, such as
@echo running out of memory or Windows resources.
@echo.
@goto :EOF
)
@if "%1" == "4" (
@echo A fatal error occurred during the actual installation process.
@echo.
@goto :EOF
)
@if "%1" == "5" (
@echo The user clicked Cancel during the actual installation process,
@echo or chose Abort at an Abort-Retry-Ignore box.
@echo.
@goto :EOF
)
@if "%1" == "6" (
@echo The Setup process was forcefully terminated by the debugger
@echo (Run | Terminate was used in the Compiler IDE).
@echo.
@goto :EOF
)
@if "%1" == "7" (
@echo The Preparing to Install stage determined that Setup cannot proceed
@echo with installation. (First introduced in Inno Setup 5.4.1.)
@echo.
@goto :EOF
)
@if "%1" == "8" (
@echo The Preparing to Install stage determined that Setup cannot proceed
@echo with installation, and that the system needs to be restarted in
@echo order to correct the problem. (First introduced in Inno Setup 5.4.1.)
@echo.
@goto :EOF
)
@echo.
@goto :EOF
::======================================
::==============================================================================
:: GENERIC SUPPORT ROUTINES FROM HERE TO END ==================================
::==============================================================================
::=====================================
:CHECKSTRING
@if defined DEBUG @echo Entering %0
@call :SET_VERBOSE_IF_DEBUG_ON
::@if defined VERBOSE echo %0 - %*
for %%v in ( %* ) do (
if /I "%%v"=="" ( @goto :EOF )
)
:: === NOTE ====
:: We use the /x flag here for an exact match!
@if defined VERBOSE echo calling findstr /x /c:%1 /i %2
:: findstr /x /c:"servermode = superclassic" /i Firebird_4_0\firebird.conf
findstr /x /c:%1 /i %2
@call :RESET_ERRORLEVEL
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::===CHECKSTRING===================
::=====================================
:GET_DATE
@if NOT defined DEBUG @echo off
@echo. | date | FIND "(mm" > NUL
@if errorlevel 1 ((set MD=0) & call :ParseDate DD MM) else ((set MD=1) & call :ParseDate MM DD)
@goto :EOF
:ParseDate
@for /f "tokens=1-3 delims=/.- " %%a in ("%DATE%") do (
@set %1=%%a
@set %2=%%b
@set YYYY=%%c
@goto:EOF)
::=====================================
::=====================================
:GET_TIME
@if NOT defined DEBUG @echo off
@for /f "tokens=1-4 delims=:. " %%a in ("%TIME%") do (
@set hh=%%a
@set nn=%%b
@set ss=%%c
@set ms=%%d
@goto :EOF)
::=====================================
::=====================================
:CLEAR_DT_VARS
@if NOT defined DEBUG @echo off
@set MM=
@set DD=
@set YYYY=
@set hh=
@set nn=
@set ss=
@set ms=
@if defined DEBUG @echo Leaving CLEAR_DT_VARS
@goto :EOF
::=====================================
::=====================================
:TIMESTAMP
@call :GET_DATE
@call :GET_TIME
@set TIMESTAMP=%YYYY%%MM%%DD%%hh%%nn%%ss%
@if defined DEBUG (@echo Timestamp set to %TIMESTAMP%)
@call :CLEAR_DT_VARS
@goto :EOF
::=====================================
::==============================================================================
:: MAIN is always the last routine
::==============================================================================
::=====================================
:MAIN
@if defined DEBUG @echo Entering %0 %*
@call :SET_GLOBAL_ENV
@if /I "%1"=="help" (
@call :HELP
@goto :EOF
)
:: sometimes it is useful to just tidy up!
@if /I "%1"=="clean" (
@set NOUNINSTALL=
call :RUN_UNINSTALLER SCRIPTED CLEAN
goto :EOF
)
@call :RUN_INSTALLER %*
@if defined _err ( echo _err is %_err% - quitting. && @goto :EOF)
@call :RUN_UNINSTALLER %*
@if defined DEBUG @echo Leaving %0
@call :UNSET_VERBOSE
@goto :EOF
::===MAIN==============================
:: NOTHING BEYOND THIS POINT===========
:EOF

File diff suppressed because it is too large Load Diff