The Cfgconfig.xml file is used to execute a set of commands before and after starting an automatic update using Cfg.exe, which is contained in the AutoUpdate folder next to the product installation folder.
To create Cfgconfig.xml, open a standard text editor.
The set of commands is specified in the sections:
Section | Brief description |
<Start> | It determines timeout for completing update. |
<Before> | It executes a set of commands before automatic update. |
<After> | It executes a set of commands after automatic update. |
<Cfg> | It supports custom shortcuts configured on Cfg.exe. |
<File> | It determines actions to be executed with file. |
<Var> | It creates system environment variables and user environment variables. |
<Log> | It installs the MSI file and get the log file. |
<Msi> | It determines actions with previously installed releases and checks integrity of files. |
NOTE. The file structure must start with the <Start> section. The rest of the sections must be located inside. Any section, except for <Start>, may be a subsection of the <Before> or <After> sections.
It determines timeout for completing update.
The section is a container for the <Before>, <After> sections. It can contain the following attribute:
Attribute | Description |
Timeout | It determines the timeout for completing update of Foresight Analytics Platform. If the update is not completed when the time has elapsed (for example, it hangs up), it is forced to stop and then Foresight Analytics Platform is started. The value is set in seconds. Default value is 20 minutes. Set this attribute to "-1" to set unlimited timeout. |
The example of specifying an attribute:
<Start Timeout="7200">
...
</Start>
The estimated time of update completion is two hours.
It executes a set of commands before automatic update.
The section is a container for all sections, except for the <Start> section, and does not contain any attributes.
It executes a set of commands after automatic update.
The section is a container for all sections, except for the <Start> section, and does not contain any attributes.
It supports custom shortcuts configured on Cfg.exe. For custom shortcuts to work, copy new Cfg.exe to the current release folder.
The section can contain the following attribute:
Attribute | Description |
Copy | It determines whether the file is copied:
|
The example of attribute use:
<Start>
<After>
<Cfg Copy="1"/>
</After>
</Start>
After a new version is installed, a folder of previous release is created, where the Cfg.exe new file is placed.
It determines actions to be executed with file.
The section can contain the following attributes and subsections:
Attributes/subsections | Description |
Path | File name. It is possible to use the substitutions shown in the table below as well as the system and user variables: %AllUsersProfile%, %AppData%, %CommonProgramFiles%, %HomeDrive%, %SystemDrive%, %HomePath%, %UserProfile%, %WinDir%, %SystemRoot%. |
Args | Command line arguments. It is possible to use the substitutions shown in the table below as well as the system and user variables: %AllUsersProfile%, %AppData%, %CommonProgramFiles%, %HomeDrive%, %SystemDrive%, %HomePath%, %UserProfile%, %WinDir%, %SystemRoot%. |
Copy | It determines whether the file is copied:
|
NoExec | It determines whether the file can be accessed for execution:
|
NoDb | It determines whether the database can be accessed for writing:
|
NoTemp | It determines whether the update file is copied to a temporary folder:
NOTE. To ensure proper execution of commands from Cfgconfig.xml, all files used during their execution must be specified in the Cfgconfig.xml file. Files with the NoDb="1" attribute will not be copied, if the NoTemp="0" attribute has not been determined. |
<Code> | Return code handling. The subsection can contain the following attributes:
|
<FileCondition> | It determines settings according to file presence and version. This subsection is optional. It enables the user to check file presence and file version. When the file is present, it enables the user to redetermine file settings specified in the <File> section, for example, Path, Args, Copy, NoExec, and so on. The operation redetermined for the source file is executed after checking all conditions listed in the <File> section. If the Path attribute is redetermined, but its value is empty, the file specified in the <File> section is not installed. The subsection can contain the following attributes:
|
<OsCondition> | It determines file settings for a specific operating system and platform. The subsection is optional. It allows to redetermine the attributes: Path, Args, Copy, NoExec and other attributes of the <File> section. The operation redetermined for the source file is executed after checking all conditions listed in the <File> section. If the Path attribute is redetermined, but its value is empty, the file specified in the <File> section is not installed. The subsection can contain the following attributes:
|
<RegistryCondition> | It determines settings according to existence and value of key in the registry. This subsection is optional. It determines file configuration depending on key availability in the registry and its value. If the key is found and its value matches the one specified in KeyValue, settings, (for example, Path) are taken from this element. If KeyPath and KeyName are set, the availability of this key is checked. When KeyName and KeyValue are not specified, only registry key availability is checked. In the <RegistryCondition> subsection the <File> attributes such as Path, Args, Copy, NoExec, and so on can be redetermined. The operation redetermined for the source file is executed after checking all conditions listed in the <File> section. If the Path attribute is redetermined, but its value is empty, the file specified in the <File> section is not installed. The subsection can contain the following attributes:
|
The table contains values for the OsName, OsVersion attributes:
Operating System | MajorVersion | MinorVersion | OsName |
Windows 10 | 10 | 0 | Win10 |
Windows Server 2012 | 6 | 2 | WinServer2012 |
Windows Server 2012 R2 | 6 | 3 | WinServer2012R2 |
Windows Server 2016 | 10 | 0 | WinServer2016 |
Windows Server 2019 | 10 | 0 | WinServer2019 |
The table contains substitutions, which can be used as values of the Path, Args, FileName attributes to specify system directories and platform installation directories:
Substitution | Description |
#INSTALLDIR# | Installation directory (path) of Foresight Analytics Platform. For example, for 64-bit Windows OS: C:\Program Files\Foresight\. |
#SYSTEM32DIR# | Directory (path) to the system32 system folder. The #SYSTEM32DIR# substitution returns the %windir%\system32 value. |
For example, to use the <RegistryCondition>, <OsCondition> subsections, the Microsoft .NET Framework 4.5.2 distribution file (NDP452-KB2901907-x86-x64-AllOS-ENU.exe) must be contained in the update folder.
<Start Timeout="-1">
<Before>
<File Path="NDP452-KB2901907-x86-x64-AllOS-ENU.exe" Args="/passive /promptrestart /showrmui">
<RegistryCondition KeyPath="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" KeyName="Release" Cmp="GEQ" KeyValue="379893" Path=""/>
<RegistryCondition IsDefault="True" />
<OsCondition OsVersion="6.2"/>
<OsCondition OsVersion="6.3"/>
<OsCondition OsVersion="10.0"/>
</File>
</Before>
</Start>
Before installing Foresight Analytics Platform the system checks the key in the registry:
If the registry contains the entry and the version specified in the entry is later or matches the checked version (Cmp, KeyValue), the distribution file is not started (Path="").
If there is no entry or the entry exists but it contains the version that is earlier than the checked one, the distribution file is started and the installation is started (IsDefault="True").
The file is started only in checked Windows versions:
Windows 10.
Windows Server 2012.
Windows Server 2012 R2.
Windows Server 2016.
Windows Server 2019.
After executing the example using the <RegistryCondition>, <OsCondition> subsections, the vc_redist.x86.exe and VCRedistLauncher.exe distribution files must be contained in the update folder.
<Start Timeout="-1">
<Before>
<File Path="vc_redist.x86.exe" NoExec="1"/>
<File Path="VCRedistLauncher.exe" Args="/install /passive /norestart">
<FileCondition FileName="#SYSTEM32DIR#\mfc140.dll" VersionMask="14.0.24212" Cmp="GEQ" Path=""/>
<FileCondition IsDefault="True"/>
<OsCondition OsVersion="6.2"/>
<OsCondition OsVersion="6.3"/>
<OsCondition OsVersion="10.0"/>
</File>
</Before>
</Start>
Before installing Foresight Analytics Platform, availability of the mfc140.dll file will be checked:
If the file exists and its version is later or matches the checked version (Cmp, VersionMask), the distribution file is not started (Path="").
If the file does not exist or its version is earlier than the checked version, the VCRedistLauncher.exe file is started.
The file is started only in checked Windows versions:
Windows 10.
Windows Server 2012.
Windows Server 2012 R2.
Windows Server 2016.
Windows Server 2019.
The example of using the <Code> subsection:
<Start>
<Before>
<File Path="cmd.exe" Args="/C">
<Return>
<Code Value="0" Message="Success" Break="N" />
<Code Value="-1" Message="Fail" Break="Y" />
</Return>
</File>
</Before>
<After>
<File Path="cmd.exe" Args="/C" />
</After>
</Start>
To update, run the command line with the specified parameter depending on the return code:
Update will be aborted.
Update will be resumed. After the update the command line is run with the specified parameter.
To execute the example using the <RegistryCondition>, <OsCondition> subsections, the msxml6_x64.exe and msxml6_x86.exe distribution files must be contained in the update folder.
<Start>
<Before>
<File Path="msxml6_x86.exe">
<FileCondition FileName="%systemroot%\system32\msxml6r.dll" Cmp="GEQ" VersionMask="6.*" Path="" />
<FileCondition IsDefault="True" />
<OsCondition Platform="x64" Path="msxml6_x64.exe" />
</File>
</Before>
</Start>
Before installing Foresight Analytics Platform the availability of the msxml6r.dl file is checked:
If the file is found and its version matches the specified one, the msxml6_x86.exe file is not started (Path="").
If the file is not found or its version does not match the specified one (Cmp, VersionMask), condition checking is started (OsCondition). Either msxml6_x86.exe or msxml6_x64.exe is started depending on whether the condition is satisfied.
The example of copying files by the specific path using the #INSTALLDIR# substitution:
<Start>
<After>
<File Path="my.dll" Args="#INSTALLDIR#\Analytics Platform 10.x" Copy="1" NoExec="1" />
<File Path="regsvr32.exe" Args="-s "#INSTALLDIR#\Analytics Platform 10.x\my.dll"" NoDb="1">
<Return>
<Code Value="-1" Break="Y" />
</Return>
</File>
</After>
</Start>
After the update is complete, the first <File> element copies the my.dll file from the update directory to the Foresight Analytics Platform directory (#INSTALLDIR#\Foresight Analytics Platform 10.x). The second <File> element registers the copied my.dll file and checks return code.
The example of installing application before updating. If Microsoft SQL Native Client is not installed on the computer, place the Cfgconfig.xml and the sqlncli.exe files in the update folder. The Cfgconfig.xml file must have the following structure:
<Start>
<Before>
<File Path="sqlncli.exe"/>
</Before>
</Start>
Microsoft SQL Native Client is installed before updating.
It creates system environment variables and user environment variables.
The section can contain the following attributes:
Attribute | Description |
Name | Environment variable name. |
IsUser | It determines whether variable is custom:
|
Val | Variable value. |
NOTE. All the system environment variables are added to the custom environment variables.
The example of setting values of system environment variables:
<Start>
<Before>
<Var Name="var_test" Val="var_val_test" />
</Before>
</Start>
Before updating, the var_test environment variable is created with the var_val_test value.
The example of setting custom environment variables:
<Start>
<Before>
<Var Name="var_test" IsUser="true" Val="var_val_test" />
</Before>
</Start>
Before updating, the var_test custom environment variable is created with the var_val_test value.
It installs the MSI file and get the log file.
The section can contain the following attributes:
Attribute | Description |
File | It determines the path to the log file. |
Mode | It determines the type of information to be stored in the log file. The attribute value may contain one or several values. For details see the specialized reference manuals (MSDN). |
Attrs | It determines frequency of the log buffer cleaning. For details see the specialized reference manuals (MSDN). |
The example of using the section:
<Start>
<After>
<Log File="C:\ppinstall.log" Mode="Warning|User|Info" Attrs="Append|FlushEachLine" />
</After>
</Start>
After updating an update execution log is created.
It determines actions with previously installed releases of Prognoz Platform and Foresight Analytics Platform and check integrity of executable files.
The section can contain the following attributes:
Attribute | Description |
RemoveMode | It determines whether to delete the previously installed releases of Prognoz Platform and Foresight Analytics Platform.
|
CheckControlSums | It determines whether each time Foresight Analytics Platform starts the integrity of executable files is checked, and file contents is compared with a standard:
|
The example of using the section:
<Start>
<Before>
<Msi RemoveMode="none" CheckControlSums="True"/>
</Before>
</Start>
All previously installed releases are kept, and the integrity check is run on the executable files.
To remove the specified release or help system, create the <After> section with the <File> subsection in the Cfgconfig.xm file and specify the Path and Args attributes:
<Start>
<After>
<File Path="msiexec.exe" Args='/qn /x {4B7BC2B5-F02D-4CBE-B177-06DCAA4704F1}' NoDb="1"/>
</After>
<Msi RemoveMode="none" />
</Start>
In this case when update is executed, all previously installed releases will be kept except for the 20th release, which was force deleted after updating.
The Args attribute can be determined using various arguments:
Args='/x {<GUID>}' - deletes the specified release or help system.
Args='/qn /x {<GUID>}' - deletes the specified release or help system in silent mode.
<GUID> is the code of Prognoz Platform or Foresight Analytics Platform for the specific release or help system to be deleted. If it is required to get release code, contact technical support by sending a request to support@fsight.ru or use technical support services, which are available after registration at the website.
To execute the set of commands, place the file to the update source. Available operations:
Setting values of system environment variables and user environment variables. This may be required to set the name of the license server (the LSFORCEHOST system environment variable). To do this, create the <Var> section.
NOTE. All the system environment variables are added to the custom environment variables.
Installing MSI file and getting log file. To do this, create the <Log> section.
Copying files using the specific path to use the #INSTALLDIR# substitution that returns a path with installed Foresight Analytics Platform. The example of using a substitution is given in the description of the <File> section.
Canceling deletion of previous versions or setting up deletion parameters for a specific release or help system. To do this, create the <Msi> section.
Specifying file installation settings, according to the platform and operating system, or depending on availability of the key and its value in the registry. To do this, use the <FileCondition>, <OsCondition>, <RegistryCondition> subsections in the <File> section.
See also: