The "WrapInstall" Command |
The "repackaging" section of this documentation provides a fair range of details, links and options for creating an MSI from an "EXE" based installer (its an "exe to msi" converter if you like). This command provides a simple mechanism to wrap existing installers (one of these approaches).
This command can wrap a single EXE program or a whole CD's tree worth of files (setup.exe plus its associated files and directories). While what it is doing is simple the command itself and the available options are reasonably complex, also if you have a really difficult package you may need to perform the correct actions yourself rather than use this command.
Consider the need to use the "RunProcess.exe" command with a timeout, I recommend that you do this for any InstallShield setup.exe programs (cr.pware), see its "/k" parameter.
Parameters |
This command takes these parameters:
You can specify where the files are installed with the "InstallDir" parameter, otherwise this information is extracted from the "EXE" parameter (if not possible an error message is generated).
If the "CdImage" parameter was used then this is the install time name of the setup executable once installed.
This parameter must be supplied unless the EXE parameter begins with a directory key (for example "[DirKey]setup.exe"), in which case the setup program is assumed to be in the root directory (and "DirKey" specifies the root).
You will probably create a follow up task (possibly with "VbsCa) to check log files or registry to confirm success.
You will probably create a follow up task (possibly with "VbsCa) to wait for completion (read the products documentation) and then check log files or registry to confirm success.
You would definately wish to change this if you were using this command more than once in any msi to eliminate any confusion (the name of the wrapped produce wold generally be ideal).
If you do not supply this parameter but do supply the "UninstallKey" parameter then the defined uninstall process will be invoked (you will need to test to see if this is or can be "silent").
If you don't wish to uninstall the wrapped product (when uninstalling the wrapping msi) then you will probably want to:
If you do one of the above then you will probably also decide that the correct value for the "WRAPINST_HIDE_WRAPPED_PRODUCT" option is "N" (without the quotes!)..
You will probably create a follow up task (possibly with "VbsCa) to check log files or registry to confirm success.
You will probably create a follow up task (possibly with "VbsCa) to wait for completion (read the products documentation) and then check log files or registry to confirm success.
The "Watch Uninstall Keys" tool makes identification of this key relatively easy, once defined it allows (by default):
There will typically be a lot of standard actions at known fixed locations (which may however differ in sequence number or even order relative to one another with different templates). Click here for the default "InstallExecuteSequence" and "InstallUISequence" sequencing details.
Normally you try not to duplicate sequence numbers but it is probably OK to do so as long as you don't care which one executes first! One possible exception would be deferred custom actions where the custom action data needs to be setup before execution. You should get a validation message to indicate a duplicated number (note that validation can't know whether custom action conditions are mutually exclusive etc).
The sequencing information (see some default sequencing) can be supplied in a number of formats:
Basically you describe a range of valid values and whether you prefer the value to be chosen from the lower (default) or higher end.
The range should be specified in the format "lower - higher". Either value can be omitted, be specified as an integer such as "1000" or the name of an action such as "InstallFiles". The default value for the lower end is "1" and for the higher "32767" and leading and trailing spaces for each are stripped. The minimum and maximum values can be returned as the range is inclusive.
By default MAKEMSI will choose a number as close as possible to the lower end, if you wish it to be as high as possible then begin the specification string with "<".
Some Examples:
You should of course be aware of what your script does, for example if it moves a custom action that you have already sequenced other actions relative to then that would probably be "bad"!
Defines when the install takes place. You may wish to alter registry or ini files etc.
Options |
Please see the "options for commands" section of the manual.
#define? WRAPINST_SEQ_INSTALL StartServices-RegisterUser #define? WRAPINST_SEQ_UNINSTALL InstallInitialize-StopServices #define? WRAPINST_CONDITION_INSTALL <$CONDITION_INSTALL_ONLY> ;;You could add repair etc. #define? WRAPINST_CONDITION_UNINSTALL <$CONDITION_UNINSTALL_ONLY> ;;Make this "" if you don't want to ever uninstall (rare?) #define? WRAPINST_BASETYPE_INSTALL Deferred ;;Base CA attributes (install). You may need to add "SYSTEM". #define? WRAPINST_BASETYPE_UNINSTALL Deferred ;;Base CA attributes (uninstall). You may need to add "SYSTEM". #define? WRAPINST_HIDE_WRAPPED_PRODUCT Y ;;Don't show in ARP as wrapping product will uninstall #define? WRAPINST_(UN)INSTALL_VALIDATION Y #define? WRAPINST_INSTALL_VALIDATION <$WRAPINST_(UN)INSTALL_VALIDATION> #define? WRAPINST_UNINSTALL_VALIDATION <$WRAPINST_(UN)INSTALL_VALIDATION> #define? WRAPINST_UNINSTALL_VALIDATION_WAIT 0 ;;Some uninstalls are ASYNC with task returning before complete! If non-blank and non-zero then how many seconds do we wish to allow for the uninstall task to complete? #define? WRAPINST_CDIMAGE_COPYATTRIBUTES ;;See the "CopyAttributes" on the file command
EXAMPLE |
You should read the "InstallShield Version 7.00" section of the doco, then look at this example:
;---------------------------------------------------------------------------- ;--- "SETUP-I.ISS" points here! --------------------------------------------- ;---------------------------------------------------------------------------- <$DirectoryTree Key="PRODUCTDIR" Dir="c:\Program Files\WrappedProducGoesHere"> ;---------------------------------------------------------------------------- ;--- Install the CD-IMAGE here ---------------------------------------------- ;---------------------------------------------------------------------------- <$DirectoryTree Key="INSTALLDIR" Dir="[PRODUCTDIR]\MsiSource (wrapper)" CHANGE="\"> ;---------------------------------------------------------------------------- ;--- Set up the response file created with "setup.exe /r" (created in "c:\winnt" dir) --- ;---------------------------------------------------------------------------- #( #define AddResponseFile <$File Source="{$ISS}" Destination="[INSTALLDIR]\{$ISS}" Comment=^Response file for {$FOR} (renamed "setup.iss" file). Generated by manual {$FOR} of product using "setup.exe /r".^> <$SourceFile FileName="{$ISS}" HTML="Y"> #) <$AddResponseFile ISS="setup-I.iss" FOR="installation"> <$AddResponseFile ISS="setup-UI.iss" FOR="uninstallation"> ;---------------------------------------------------------------------------- ;--- Install InstallShield based Installer ---------------------------------- ;---------------------------------------------------------------------------- #( <$WrapInstall ;--- Where is the CD Image? ----------------------------------------- CdImage=".\CD-IMAGE" ;--- INSTALL -------------------------------------------------------- EXE="[INSTALLDIR]setup.exe" Args='/s /f1"[INSTALLDIR]setup-I.iss" /f2"[INSTALLDIR]setup-I-<$ProductVersion>.log"' ;--- UNINSTALL ------------------------------------------------------ UninstallExe="[INSTALLDIR]setup.exe" UninstallArgs='/s /f1"[INSTALLDIR]setup-UI.iss" /f2"[INSTALLDIR]setup-UI-<$ProductVersion>.log"' ;--- VALIDATION ----------------------------------------------------- UninstallKey="{149511F11-4375-4557-5541-8F9217A15480}" > #)