3
votes

I have an Inno Setup script that creates an installer (FullInstall.exe, for example). The script contains several components, selected using types in the standard way, so that it currently has something like:

[Types]
Name: standard; Description: Standard installation
Name: dev; Description: Development installation
Name: disponly; Description: Display utility only
Name: custom; Description: Custom installation; Flags: iscustom

[Components]
Name: core; Description: Core files; Types: standard dev display custom; Flags: fixed
Name: exec; Description: Executive; Types: standard dev custom
Name: exec\debug; Description: Debugger; Types: dev custom
Name: display; Description: Display utility; Types: dev disponly custom

What I've been asked to do is to create an installer for the display utility only. I could create a batch file (DispInstall.bat) which just contained:

FullInstall /COMPONENTS="core,display"

However, this method requires a copy of FullInstall.exe in the same directory as DispInstall.bat, which isn't ideal. Is there a method of creating a DispInstall.exe file which behaves like FullInstall.exe with the disponly type selected, and without the user being able to change the type or component selection?

1

1 Answers

3
votes

You can use Inno Setup preprocessor to filter the .iss script to a desired subset only:

[Types]
#ifndef disponly
Name: standard; Description: Standard installation
Name: dev; Description: Development installation
#endif
Name: disponly; Description: Display utility only
#ifndef disponly
Name: custom; Description: Custom installation; Flags: iscustom
#endif

[Components]
#ifndef disponly
Name: core; Description: Core files; Types: standard dev display custom; Flags: fixed
Name: exec; Description: Executive; Types: standard dev custom
Name: exec\debug; Description: Debugger; Types: dev custom
#endif
Name: display; Description: Display utility; Types: dev disponly custom

And filter everything else that refers to the filtered types and components, the same way.


And then run Inno Setup compiler with /Ddisponly command-line switch to compile the subset version.


Or if you use Inno Setup GUI for the compilation, you can create disponly.iss like:

#define disponly
#include "FullInstall.iss"