Franki
Franki

Reputation: 13

Default components for silent installation with Inno Setup

I'm developing an installation file in Inno setup. It has 3 different optional components to install when user selects 'custom'.

It works fine, but when /SILENT parameter is passed, no component is installed. I suppose because no component is checked.

...here is the code fragment related:

[Types]
Name: custom; Description: {cm:instCustom}; Flags: iscustom
Name: full; Description: {cm:instFull}

[Components]
Name: Programador; Description: {cm:cmpProgramador}; Types: full
Name: Usuario; Description: {cm:cmpUsuario}; Types: full
Name: Reporte; Description: {cm:cmpReporte}; Types: full

[Icons]
Name: {group}\{cm:cmpProgramador}; Filename: {app}\Programador\{#MyAppExeNameA}; Components: Programador
Name: {group}\{cm:cmpUsuario}; Filename: {app}\Usuario\{#MyAppExeNameB}; Components: Usuario
Name: {group}\{cm:cmpReporte}; Filename: {app}\Reporte\{#MyAppExeNameC}; Components: Reporte
Name: {group}\Desinstalar MIVES; Filename: {uninstallexe}

[Registry]
Root: HKCU; Subkey: Software\UPC; Flags: uninsdeletekey
Root: HKCU; Subkey: Software\UPC\MIVES
Root: HKLM; Subkey: Software\UPC; Flags: uninsdeletekey
Root: HKLM; Subkey: Software\UPC\MIVES
Root: HKLM; Subkey: Software\UPC\MIVES\Settings; ValueType: string; ValueName: InstallPath; ValueData: {app}

; file association depens of the components selected
Root: HKCR; Subkey: .mip; ValueType: string; ValueData: mip_auto_file; Flags: uninsdeletekey; Components: Programador
Root: HKCR; Subkey: mip_auto_file; Flags: uninsdeletekey; Components: Programador
Root: HKCR; Subkey: mip_auto_file\shell\open\command; ValueType: expandsz; ValueData: {app}\Programador\{#MyAppExeNameA} %1; Components: Programador

Root: HKCR; Subkey: .miu; ValueType: string; ValueData: miu_auto_file; Flags: uninsdeletekey; Components: Usuario
Root: HKCR; Subkey: miu_auto_file; Flags: uninsdeletekey; Components: Usuario
Root: HKCR; Subkey: miu_auto_file\shell\open\command; ValueType: expandsz; ValueData: {app}\Usuario\{#MyAppExeNameB} %1; Components: Usuario

Root: HKCR; Subkey: .mir; ValueType: string; ValueData: mir_auto_file; Flags: uninsdeletekey; Components: Reporte
Root: HKCR; Subkey: mir_auto_file; Flags: uninsdeletekey; Components: Reporte
Root: HKCR; Subkey: mir_auto_file\shell\open\command; ValueType: expandsz; ValueData: {app}\Reporte\{#MyAppExeNameC} %1; Components: Reporte

[Files]
Source: {#MyAppExeNameA}; DestDir: {app}\Programador; Flags: promptifolder; Components: Programador
Source: {#MyAppExeNameB}; DestDir: {app}\Usuario; Flags: promptifolder; Components: Usuario
Source: {#MyAppExeNameC}; DestDir: {app}\Reporte; Flags: promptifolder; Components: Reporte

I need that one of the three components (component 'Usuario') was installed by default when the /silent or /verysilent parameter is passed.

I think I have to use Check: WizardSilent, but I don't know where. In fact, I tried adding the WizardSilent in Components section, but nothing happens:

[Components]
Name: Programador; Description: {cm:cmpProgramador}; Types: full
Name: Usuario; Description: {cm:cmpUsuario}; Types: full; Check: WizardSilent

Neither in the Files section:

[Files]
Source: {#MyAppExeNameB}; DestDir: {app}\Usuario; Flags: promptifolder; Components: Usuario; Check: WizardSilent

Here is what I need:

EDITED: I think I've found one solution, but I don't know if it is a good solution. Just added one new type including the WizardSilent check:

[Types]
Name: silent; Description: {cm:instCustom}; Check: WizardSilent
Name: custom; Description: {cm:instCustom}; Flags: iscustom
Name: full; Description: {cm:instFull}

And use it in the components section, component "Usuario" (the component I want to install by default in a silent installation):

[Components]
Name: Programador; Description: {cm:cmpProgramador}; Types: full
Name: Usuario; Description: {cm:cmpUsuario}; Types: full silent
Name: Reporte; Description: {cm:cmpReporte}; Types: full

Now, it works really as I want. But I don't like to have two types with the same description, unless only one is showed in the setup wizard.

Is it a good idea?

Thanks!

Upvotes: 0

Views: 2039

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202222

I believe your setup is conceptually wrong.

The silent installation should install whatever the typical/default/common installation is. Now it looks like the default installation is the "Full" installation, but you want the silent installation to behave differently. That does not seem right.

So you should have a default "Typical" installation type, with the "Usuario" component. Just like you have the "Silent" type now. But the "Typical" type will make sense even in an interactive installation.

[Types]
Name: typical; Description: "Typical"
Name: full; Description: "Full"
Name: custom; Description: "Custom"; Flags: iscustom

[Components]
Name: Programador; Description: "Programador"; Types: full
Name: Usuario; Description: "Usuario"; Types: full typical
Name: Reporte; Description: "Reporte"; Types: full

And anyway, the /SILENT should always be accompanied with /LOADINF or at least /COMPONENTS or /TYPE.


Your solution with "silent" type, while a hack, will work somewhat, because the Check: WizardSilent will hide this type in the interactive installation.


Btw, note that with mere /SILENT, when upgrading, the installer will use components selected in the previous (possibly interactive) installation.

Upvotes: 2

Related Questions