Skip to content

Commit

Permalink
MSI: Set correct ruby path after copying files
Browse files Browse the repository at this point in the history
Althouth the original MSI installer generated by omnbus-td-agent allows
users to choose a folder to install, the installed fluentd command can't
be launched when the user chooses non-default folder since nobody
settles the ruby path embedded in the command.
This patch addresses this issue by running `gem pristine` as a post
install action.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
  • Loading branch information
ashie committed Mar 26, 2020
1 parent b2aa298 commit c3dfc08
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions td-agent/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ class BuildTask
task :win_batch_files do
ensure_directory(staging_bindir)
cp("msi/td-agent-prompt.bat", td_agent_staging_dir)
cp("msi/td-agent-post-install.bat", staging_bindir)
cp("msi/td-agent.bat", staging_bindir)
cp("msi/td-agent-gem.bat", staging_bindir)
end
Expand Down
9 changes: 9 additions & 0 deletions td-agent/msi/source.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,14 @@
<WixVariable Id="WixUIInfoIco" Value="assets\icon.ico" />
<WixVariable Id="WixUINewIco" Value="assets\icon.ico" />
<WixVariable Id="WixUIUpIco" Value="assets\icon.ico" />

<!-- Settle paths in executables generated by RubyGems -->
<CustomAction Id="PostInstall"
ExeCommand="[PROJECTLOCATION]bin\td-agent-post-install.bat"
Directory="PROJECTLOCATION" Execute="deferred" Return="check"/>
<InstallExecuteSequence>
<Custom Action="PostInstall" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>

</Product>
</Wix>
5 changes: 5 additions & 0 deletions td-agent/msi/td-agent-post-install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
title Td-agent post install script
if not "%~dp0" == "C:\opt\td-agent\bin\" (
%~dp0gem pristine --only-executables --all
)

0 comments on commit c3dfc08

Please sign in to comment.