Skip to content

Commit

Permalink
Merge branch 'release/1.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
dbernhard committed May 23, 2019
2 parents 7a75b6b + fbbbace commit 9513d2e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
26 changes: 16 additions & 10 deletions CA_ReadConfig/CustomAction.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
using System.IO;

namespace CA_ReadConfig
{
Expand All @@ -10,19 +8,27 @@ public class CustomActions
[CustomAction]
public static ActionResult ReadHost(Session session)
{
var config = GetConfig(session["CONFIG_FILE"]);

session["SERVICE_HOST"] = config.IniReadValue("default", "host");

return ActionResult.Success;
return ReturnConfigValue(ref session, "SERVICE_HOST", "default", "host");
}

[CustomAction]
public static ActionResult ReadPort(Session session)
{
var config = GetConfig(session["CONFIG_FILE"]);
return ReturnConfigValue(ref session, "SERVICE_PORT", "default", "port");
}

private static ActionResult ReturnConfigValue(ref Session session, string propertyToSet, string section, string key)
{
var path = session["CONFIG_FILE"];

// do nothing in case path is non existent
if (!File.Exists(path))
{
return ActionResult.Success;
}
var config = GetConfig(path);

session["SERVICE_PORT"] = config.IniReadValue("default", "port");
session[propertyToSet] = config.IniReadValue(section, key);

return ActionResult.Success;
}
Expand Down
6 changes: 3 additions & 3 deletions TikaServiceInstaller/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@
<CustomAction Id="ReplaceLOG_PATH" DllEntry="ReplaceBackslashWithFrontslash" BinaryKey="CA_InputValidation" />

<!-- Install the Service using CAQuietExec (so no cmd-window is shown) -->
<CustomAction Id="InstallTS" BinaryKey="WixCA" DllEntry="CAQuietExec" Impersonate="no" Execute="deferred" Return="check" />
<CustomAction Id="InstallTS" BinaryKey="WixCA" DllEntry="$(var.WixQuietExec)" Impersonate="no" Execute="deferred" Return="check" />
<SetProperty Id="InstallTS" Value="&quot;cmd&quot; /V /C &quot;set PRUNSRV_NAME=[PRUNSRV_NAME]&amp;&amp;set TIKA_LOGLEVEL=[TIKA_LOGLEVEL]&amp;&amp;set TIKA_LOG_PATH=[LOG_PATH]&amp;&amp;set TIKA_STARTUP_TYPE=[STARTUP_TYPE]&amp;&amp;&quot;[INSTALLFOLDER]install/install.bat&quot; [SERVICE_NAME]&quot;" Sequence="execute" Before="InstallTS" />

<!-- ignore return, because if the service is not running, it cannot be stopped -->
<CustomAction Id="StopTS" BinaryKey="WixCA" DllEntry="CAQuietExec" Impersonate="no" Execute="deferred" Return="ignore" />
<CustomAction Id="StopTS" BinaryKey="WixCA" DllEntry="$(var.WixQuietExec)" Impersonate="no" Execute="deferred" Return="check" />
<SetProperty Id="StopTS" Value="&quot;[INSTALLFOLDER]install/[PREVIOUS_PRUNSRV_NAME]&quot; //SS//[PREVIOUS_SERVICE_NAME]" Sequence="execute" Before="StopTS" />

<!-- uninstall the service as procrun service application (not windows service!) -->
<CustomAction Id="UninstallTSProcrun" BinaryKey="WixCA" DllEntry="CAQuietExec" Impersonate="no" Execute="deferred" Return="ignore" />
<CustomAction Id="UninstallTSProcrun" BinaryKey="WixCA" DllEntry="$(var.WixQuietExec)" Impersonate="no" Execute="deferred" Return="check" />
<SetProperty Id="UninstallTSProcrun" Value="&quot;[INSTALLFOLDER]install/[PREVIOUS_PRUNSRV_NAME]&quot; //DS//[PREVIOUS_SERVICE_NAME]" Sequence="execute" Before="UninstallTSProcrun" />
</Fragment>
</Wix>

0 comments on commit 9513d2e

Please sign in to comment.