-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
msi: keep fluentdopt when previous options is set
* It will be overridden when install path has changed. * If fluentdopt is empty, set default value * If install path is same, do not change it. Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
fluent-package/msi/assets/fluent-package-post-fluentdwinsvc.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'fileutils' | ||
require "win32/service" | ||
require "win32/registry" | ||
require "optparse" | ||
include Win32 | ||
|
||
install_dir = "#{ARGV[0]}" | ||
|
||
default_fluentdwinsvc = "-c '#{install_dir}\etc\fluent\fluentd.conf' -o '#{install_dir}\fluentd.log'" | ||
registory_key = "SYSTEM\\CurrentControlSet\\Services\\fluentdwinsvc" | ||
|
||
Win32::Registry::HKEY_LOCAL_MACHINE.open(registory_key, Win32::Registry::KEY_ALL_ACCESS) do |reg| | ||
unless reg['fluentdopt', Win32::Registry::REG_SZ].empty? | ||
# Rewrite obsolete path | ||
previous_fluentdopt = reg['fluentdopt', Win32::Registry::REG_SZ] | ||
unless previous_fluentdopt.include?(install_dir) | ||
# When only install path has changed, override it | ||
puts("fluentdwinsvc: reset fluentdopt configuration because install path (#{install_dir}) of fluent-package has changed") | ||
reg['fluentdopt', Win32::Registry::REG_SZ] = default_fluentdwinsvc | ||
else | ||
puts("fluentdwinsvc: fluentdopt configuration was kept because install path (#{install_dir}) of fluent-package was not changed") | ||
end | ||
else | ||
# Set default configuration | ||
puts("fluentdwinsvc: reset to default fluentdopt configuration") | ||
reg['fluentdopt', Win32::Registry::REG_SZ] = default_fluentdwinsvc | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters