Based on what I pick in Inno Setup, the installer should add an entry containing package name followed by ,
into config.ini
And extract the right premade config files (that are stored in the installer) needed for the few specific setups into the Config
folder.
There are plenty of programs like Chrome/Firefox which don't need any parameters or additional configs to install.
Desired config.ini
file syntax:
<package1>, <package2 /X /Y /Z>, <package 3> ...
Etc.
Where <packageX>
is a string value tied to the checkboxes in the installer selection menu.
After Inno Setup completes, it should run a batch file.
Bonus points: Again.. not only output the config.ini
, BUT also extract necessary premade configs set-up for the specific program into a folder C:/NKsetup/Config/
Add each each of your packages as a component to the Components
section. Then in the Files
section, you can choose what files get installed based on the components selected. For the packages list config file, you need to code that with use of the WizardIsComponentSelected
function.
[Setup]
DefaultDirName=C:\some\path
[Types]
Name: "custom"; Description: "-"; Flags: iscustom
[Components]
Name: "sqlserver"; Description: "Microsoft SQL server"
Name: "chrome"; Description: "Google Chrome"
Name: "firefox"; Description: "Mozilla Firefox"
[Files]
Source: "install.bat"; DestDir: "{app}"
Source: "common-config.ini"; DestDir: "{app}"
Source: "sqlserver-config.ini"; DestDir: "{app}"; Components: sqlserver
Source: "browsers-config.ini"; DestDir: "{app}"; Components: chrome firefox
[Run]
Filename: "{app}\install.bat"; StatusMsg: "Installing..."
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
ConfigPath: string;
Packages: string;
begin
if CurStep = ssPostInstall then
begin
if WizardIsComponentSelected('sqlserver') then
begin
Packages := Packages + ',sql-server-express /X /Y /Z';
end;
if WizardIsComponentSelected('chrome') then
begin
Packages := Packages + ',chrome';
end;
if WizardIsComponentSelected('firefox') then
begin
Packages := Packages + ',firefox';
end;
// Remove the leading comma
if Packages <> '' then
begin
Delete(Packages, 1, 1);
end;
ConfigPath := ExpandConstant('{app}\config.ini');
// This is not Unicode-safe
if not SaveStringToFile(ConfigPath, Packages, False) then
begin
Log(Format('Error saving packages to %s', [ConfigPath]));
end
else
begin
Log(Format('Packages saved to %s: %s', [ConfigPath, Packages]));
end;
end;
end;