使用Inno Setup进行静默安装的默认组件

时间:2016-07-27 18:50:57

标签: inno-setup

我在Inno设置中开发安装文件。 当用户选择' custom'

时,它有3个不同的可选组件可供安装

它工作正常,但是当传递/SILENT参数时,没有安装任何组件。我想是因为没有检查任何组件。

...这里是相关的代码片段:

[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

我需要在传递/silent/verysilent参数时默认安装三个组件之一(组件' Usuario')。

我想我必须使用Check: WizardSilent,但我不知道在哪里。事实上,我尝试在WizardSilent部分添加Components,但没有任何反应:

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

Files部分:

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

这就是我需要的:

  • MIVES_211.exe /SP- /verysilent>>>安装" Usuario"默认情况下为组件(静默模式,没有/components参数)
  • MIVES_211.exe /SP- /silent /components=Reporte>>>仅安装"报告"组件(静默模式和components参数)
  • MIVES_211.exe /SP- /silent /components=Usuario,Reporte>>>安装" Usuario"和"报告"组件(静默模式和components参数)

编辑: 我想我找到了一个解决方案,但我不知道这是不是一个好的解决方案。刚添加了一种新类型,包括WizardSilent支票:

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

并在组件部分,组件" Usuario"中使用它。 (我想在静默安装中默认安装的组件):

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

现在,它真的像我想要的那样工作。但是我不希望有两种类型具有相同的描述,除非在设置向导中只显示一种类型。

这是个好主意吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

我相信您的设置在概念上是错误的。

静默安装应该安装典型/默认/常见安装。现在看起来默认安装是“完整”安装,但您希望静默安装的行为不同。这似乎不对。

所以你应该有一个默认的“典型”安装类型,带有“Usuario”组件。就像你现在有“沉默”类型一样。但即使在交互式安装中,“典型”类型也会有意义。

<asp:PostBackTrigger ControlID ="btnOderhelp" />

无论如何,[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 应始终伴随/SILENT或至少/LOADINF/COMPONENTS

您的解决方案采用“静默”类型,而黑客攻击会稍微有效,因为/TYPE会在交互式安装中隐藏此类型。

顺便说一句,请注意,仅仅Check: WizardSilent,升级时,安装程​​序将使用之前(可能是交互式)安装中选择的组件。

相关问题