Skip to content

Commit

Permalink
Fixed installer UI (and writing installer keys)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickem committed May 24, 2017
1 parent 2db2360 commit 41d3cd5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 27 deletions.
5 changes: 5 additions & 0 deletions installers/installer-NSCP/properties.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
<!-- CONFIGURE THE PROGRAM -->
<Property Id="HELP_LINK">http://nsclient.org/nscp/</Property>
<Property Id="SERVICE_NAME">nscp</Property>

<!-- internal keys -->
<Property Id="KEY_NRPEMODE">SAFE</Property>


</Include>
22 changes: 11 additions & 11 deletions installers/ui/ConfigureDlg.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,47 @@
<UI>
<Dialog Id="ConfigureDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="allowed_hostsLabel" Type="Text" X="45" Y="50" Width="60" Height="15" TabSkip="no" Text="Allowed &amp;hosts:" />
<Control Id="allowed_hosts" Type="Edit" X="110" Y="50" Width="210" Height="15" Property="ALLOWED_HOSTS" Text="{255}" />
<Control Id="allowed_hosts" Type="Edit" X="110" Y="50" Width="210" Height="15" Property="KEY_ALLOWED_HOSTS" Text="{255}" />
<Control Id="nsclient_pwdLabel" Type="Text" X="45" Y="70" Width="60" Height="20" TabSkip="no" Text="Password:">
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
<Control Id="nsclient_pwdEdit" Type="Edit" X="110" Y="70" Width="210" Height="15" Property="NSCLIENT_PWD" Text="{255}">
<Control Id="nsclient_pwdEdit" Type="Edit" X="110" Y="70" Width="210" Height="15" Property="KEY_NSCLIENT_PWD" Text="{255}">
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
<Control Id="checkLabel" Type="GroupBox" X="45" Y="90" Width="280" Height="135" Text="Modules to load:">
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
<Control Id="checkPluginsLabel" Type="CheckBox" X="50" Y="100" Width="260" Height="15" Property="CONF_CHECKS" Text="Enable &amp;common check plugins" CheckBoxValue="1">
<Control Id="checkPluginsLabel" Type="CheckBox" X="50" Y="100" Width="260" Height="15" Property="KEY_CONF_CHECKS" Text="Enable &amp;common check plugins" CheckBoxValue="1">
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
<Control Id="checkNSClientLabel" Type="CheckBox" X="50" Y="115" Width="260" Height="15" Property="CONF_NSCLIENT" Text="Enable nsc&amp;lient server (check_nt)" CheckBoxValue="1">
<Control Id="checkNSClientLabel" Type="CheckBox" X="50" Y="115" Width="260" Height="15" Property="KEY_CONF_NSCLIENT" Text="Enable nsc&amp;lient server (check_nt)" CheckBoxValue="1">
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
<Control Id="checkNRPELabel" Type="CheckBox" X="50" Y="130" Width="260" Height="15" Property="CONF_NRPE" Text="Enable &amp;NRPE server (check_nrpe)" CheckBoxValue="1">
<Control Id="checkNRPELabel" Type="CheckBox" X="50" Y="130" Width="260" Height="15" Property="KEY_CONF_NRPE" Text="Enable &amp;NRPE server (check_nrpe)" CheckBoxValue="1">
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
<Control Type="RadioButtonGroup" Property="NRPEMODE" Id="setNRPEMode" Width="252" Height="45" X="68" Y="145">
<RadioButtonGroup Property="NRPEMODE">
<Control Type="RadioButtonGroup" Property="KEY_NRPEMODE" Id="setNRPEMode" Width="252" Height="45" X="68" Y="145">
<RadioButtonGroup Property="KEY_NRPEMODE">
<RadioButton Text="Insecure legacy mode (required by old check_nrpe)" Height="15" Value="LEGACY" Width="250" X="0" Y="0" />
<RadioButton Text="Safe mode (Use certificates for encryption but not authentication)" Height="15" Value="SAFE" Width="250" X="0" Y="15" />
<RadioButton Text="Secure (Use certificates for authentication)" Height="15" Value="SECURE" Width="250" X="0" Y="30" />
</RadioButtonGroup>
<Condition Action="enable">CONF_NRPE AND NOT MONITORING_TOOL = "OP5"</Condition>
<Condition Action="disable">NOT CONF_NRPE OR MONITORING_TOOL = "OP5"</Condition>
<Condition Action="enable">KEY_CONF_NRPE AND NOT MONITORING_TOOL = "OP5"</Condition>
<Condition Action="disable">NOT KEY_CONF_NRPE OR MONITORING_TOOL = "OP5"</Condition>
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
<Control Id="checkNSCALabel" Type="CheckBox" X="50" Y="190" Width="260" Height="15" Property="CONF_NSCA" Text="Enable N&amp;SCA client" CheckBoxValue="1">
<Control Id="checkNSCALabel" Type="CheckBox" X="50" Y="190" Width="260" Height="15" Property="KEY_CONF_NSCA" Text="Enable N&amp;SCA client" CheckBoxValue="1">
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
<Control Id="checkWEBLabel" Type="CheckBox" X="50" Y="205" Width="260" Height="15" Property="CONF_WEB" Text="Enable &amp;Web server" CheckBoxValue="1">
<Control Id="checkWEBLabel" Type="CheckBox" X="50" Y="205" Width="260" Height="15" Property="KEY_CONF_WEB" Text="Enable &amp;Web server" CheckBoxValue="1">
<Condition Action="show">NOT MONITORING_TOOL = "OP5" OR WixUI_InstallMode = "InstallCustom"</Condition>
<Condition Action="hide">MONITORING_TOOL = "OP5" AND NOT WixUI_InstallMode = "InstallCustom"</Condition>
</Control>
Expand Down
2 changes: 1 addition & 1 deletion installers/ui/InvalidConfigureationDlg.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Text>Reading the old configuration failed for some reason (se below). This is not as bad as it sounds since you already have a (hopefully) working configuration. So we will go ahead and use that one instead of allowing you to pick one here.</Text>
</Control>
<Control Id="HelpTextNew" Type="Text" X="45" Y="140" Width="260" Height="100" Hidden="no" Transparent="yes" NoPrefix="yes">
<Text>Problem was: [CONF_OLD_ERROR]</Text>
<Text>Problem was: [KEY_CONF_OLD_ERROR]</Text>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
</Control>
Expand Down
8 changes: 4 additions & 4 deletions installers/ui/SelectConfigurationDlg.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<ComboBox Property="CONFIGURATION_TYPE">
<ComboBox Property="KEY_CONFIGURATION_TYPE">
<ListItem Value="old://${exe-path}/nsc.ini" Text="Old 0.3.x Configuration (Program Files)" />
<ListItem Value="ini://${exe-path}/nsclient.ini" Text="INI file (Program files)" />
<ListItem Value="registry://HKEY_LOCAL_MACHINE/software/NSClient++" Text="Registry (HKLM)" />
</ComboBox>
<Dialog Id="SelectConfigurationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="WhichConfigOption" Type="ComboBox" X="45" Y="53" Width="260" Height="16" Property="CONFIGURATION_TYPE">
<Text>[CONFIGURATION_TYPE]</Text>
<Control Id="WhichConfigOption" Type="ComboBox" X="45" Y="53" Width="260" Height="16" Property="KEY_CONFIGURATION_TYPE">
<Text>[KEY_CONFIGURATION_TYPE]</Text>
</Control>
<Control Id="generateConfig" Type="CheckBox" X="45" Y="73" Width="260" Height="15" Property="INSTALL_SAMPLE_CONFIG" Text="Install sample configuration" CheckBoxValue="1">
<Condition Action="enable">CONFIGURATION_TYPE = "ini://${exe-path}/nsclient.ini"</Condition>
<Condition Action="disable"><![CDATA[CONFIGURATION_TYPE <> "ini://${exe-path}/nsclient.ini" OR MONITORING_TOOL = "OP5"]]></Condition>
<Condition Action="disable"><![CDATA[KEY_CONFIGURATION_TYPE <> "ini://${exe-path}/nsclient.ini" OR MONITORING_TOOL = "OP5"]]></Condition>
</Control>
<Control Id="line" Type="Line" X="10" Y="105" Width="353" Height="10" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
Expand Down
19 changes: 9 additions & 10 deletions installers/ui/WixUI_MondoNSCP.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,20 @@ Patch dialog sequence:
<Publish Dialog="MonitoringToolDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">1</Publish>

<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="MonitoringToolDlg">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="InvalidConfigureationDlg" Order="4">CONF_HAS_ERRORS = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="ConfigureDlg" Order="2">CONF_CAN_CHANGE = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="InvalidConfigureationDlg" Order="4">KEY_CONF_HAS_ERRORS = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="ConfigureDlg" Order="2">KEY_CONF_CAN_CHANGE = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg" Order="1">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="InvalidConfigureationDlg" Order="4">CONF_HAS_ERRORS = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="InvalidConfigureationDlg" Order="4">KEY_CONF_HAS_ERRORS = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="SelectConfigurationDlg" Order="3">CONF_OLD_FOUND="0"</Publish>
<Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="ConfigureDlg" Order="2">CONF_CAN_CHANGE = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="ConfigureDlg" Order="2">KEY_CONF_CAN_CHANGE = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg" Order="1">1</Publish>

<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="3">1</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg" Order="4">CONF_CAN_CHANGE = "1"</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SelectConfigurationDlg" Order="5">CONF_OLD_FOUND="0"</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="InvalidConfigureationDlg" Order="6">CONF_HAS_ERRORS = "1"</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SelectConfigurationDlg" Order="4">KEY_CONF_CAN_CHANGE = "1"</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="InvalidConfigureationDlg" Order="5">KEY_CONF_HAS_ERRORS = "1"</Publish>

<Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
Expand All @@ -92,16 +91,16 @@ Patch dialog sequence:
<Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
<Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="3">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
<Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="4">WixUI_InstallMode = "Update"</Publish>
<Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SelectConfigurationDlg" Order="6">KEY_CONF_CAN_CHANGE = "1"</Publish>
<Publish Dialog="ConfigureDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="5">1</Publish>
<Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SelectConfigurationDlg" Order="6">CONF_OLD_FOUND="0"</Publish>

<!-- END: Modified to handle configuration dialog -->
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="3">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="4">WixUI_InstallMode = "Update"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfigureDlg" Order="5">CONF_OLD_FOUND="0" OR CONF_CAN_CHANGE="1"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InvalidConfigureationDlg" Order="6">CONF_HAS_ERRORS = "1"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfigureDlg" Order="5">KEY_CONF_CAN_CHANGE = "1"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InvalidConfigureationDlg" Order="6">KEY_CONF_HAS_ERRORS = "1"</Publish>

<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

Expand Down
5 changes: 4 additions & 1 deletion libs/installer_lib/installer_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,12 @@ extern "C" UINT __stdcall ExecWriteConfig (MSIHANDLE hInstall) {
settings_manager::get_settings()->save();
if (boost::filesystem::exists(path))
h.logMessage(L"Size (005): " + strEx::xtos(boost::filesystem::file_size(path)));
} catch (installer_exception e) {
} catch (const installer_exception &e) {
h.errorMessage(L"Failed to write configuration: " + e.what());
return ERROR_INSTALL_FAILURE;
} catch (const std::exception &e) {
h.errorMessage(L"Failed to write configuration: " + utf8::to_unicode(e.what()));
return ERROR_INSTALL_FAILURE;
} catch (...) {
h.errorMessage(L"Failed to write configuration: <UNKNOWN EXCEPTION>");
return ERROR_INSTALL_FAILURE;
Expand Down

0 comments on commit 41d3cd5

Please sign in to comment.