Embedding other installers: Difference between revisions
(Started tutorial) |
(Catagorized page) |
||
Line 33: | Line 33: | ||
[[Category:Code Examples]] | |||
[[Category:Tutorials]] | [[Category:Tutorials]] |
Revision as of 09:26, 1 January 2007
Oftentimes one runs an installer that contains installers for other programs. For example, I wrote an application for a client that has a pocket PC component. The installer I wrote for them also installs Active Sync, the .NET CF Version 2 redistributable, and ntbackup being many of the machines run XP home edition. This page demonstrates how to do this.
An example
Rather than lecture theory first, lets jump right in with an example snippet. This demonstrates 2 techniques, prompting the user for permission and checking for the existence of a file to determine whether to install an msi.
; These are the programs that are needed by ACME Suite. Section -Prerequisites SetOutPath $INSTDIR\Prerequisites MessageBox MB_YESNO "Install Microsoft ActiveSync?" /SD IDYES IDNO endActiveSync File "..\Prerequisites\ActiveSyncSetup.exe" ExecWait "$INSTDIR\Prerequisites\ActiveSyncSetup.exe" Goto endActiveSync endActiveSync: MessageBox MB_YESNO "Install the Microsft .NET Compact Framework 2.0 Redistributable?" /SD IDYES IDNO endNetCF File "..\Prerequisites\NETCFSetupv2.msi" ExecWait '"msiexec" /i "$INSTDIR\Prerequisites\NETCFSetupv2.msi"' endNetCF: IfFileExists $SYSDIR\ntbackup.exe endNtBackup beginNtBackup Goto endNtBackup beginNtBackup: MessageBox MB_OK "Your system does not appear to have ntbackup installed.$\n$\nPress Ok to install it." File "..\Prerequisites\ntbackup.msi" ExecWait '"msiexec" /i "$INSTDIR\Prerequisites\ntbackup.msi"' endNtBackup: SectionEnd
Now for theory
The process is simple. Copy the file over and execute it. Use ExecWait to pause your installer until the embedded installer is finished. In theory you could capture the return value of the installer and react to it. I've yet to explore this avenue. In the example above the installers were MSI's and not exes so I have to execute the installers withmsiexec /i <installer.msi>.