-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
msi: set modified environment variable FLUENT_PACKAGE_TOPDIR #533
Conversation
Oops, unexpectedly failed.
|
I noticed that Instead, this https://github.com/fluent/fluentd/blob/d5685ada81ac89a35a79965f1e94bbe5952a5d3a/lib/fluent/winsvc.rb#L43-L48 So, I think we need the system environmental variable. This would be the reason why the backslash characters in |
I'll revert the previous commit. |
fluent-package/msi/source.wxs
Outdated
<CustomAction Id="ModifyDirSepForFluentPackageTopdir" | ||
Script="vbscript"> | ||
<![CDATA[ | ||
pathvalue = Session.Property("FLUENTPROJECTLOCATION") | ||
newValue = Replace(pathvalue, "\\", "/") | ||
Session.Property("FLUENTPROJECTLOCATION") = newValue | ||
shellObject = CreateObject("WScript.Shell") | ||
systemEnv = objShell.Environment("SYSTEM") | ||
systemEnv("FLUENT_PACKAGE_TOPDIR") = newValue | ||
]]> | ||
</CustomAction> | ||
<!-- Propagate changed environment variable --> | ||
<CustomActionRef Id="WixBroadcastEnvironmentChange" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow! I had no idea there was such a way!
I'm concerned about one point.
Don't we need to remove the environmental variable on uninstalling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is just a PoC yet because now building msi... to verify.
If it works as expected, also add code for uninstalling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed. 😭
MSI (s) (F8:7C) [16:28:25:209]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1720
Error 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action ModifyDirSepForFluentPackageTopdir script error -2146827850, Microsoft VBScript 実行時エラー: オブジェクトでサポート
されていないプロパティまたはメソッドです。: 'shellObject' Line 4, Column 9,
MSI (s) (F8:7C) [16:28:53:263]: Note: 1: 2205 2: 3: Error
MSI (s) (F8:7C) [16:28:53:263]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709
MSI (s) (F8:7C) [16:28:53:263]: Product: Fluent Package v5.0.0 -- Error 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action ModifyDirSepForFluentPackageTopdir script error -2146827850, Microsoft VBScript 実行時エラー: オブジェクトでサポートされていないプロパティまたはメソッドです。: 'shellObject' Line 4, Column 9,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
investigating a workaround...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can choose inline snippet or external script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebuilding msi...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should set Impersonate="no" explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two way to do it.
- Kick inline script via CustomAction
- Kick external script via CustomAction with JScriptCall and so on.
Both of them, it seems that Session.Property("...") is empty.
Additionally, setting Session.Property can't be overridden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of them, it seems that Session.Property("...") is empty.
This is a blocker of this issue.
c3e3819
to
a607e07
Compare
01766e4
to
ad71507
Compare
FLUENT_PACKAGE_TOPDIR environment variable must be set for fluentdwinsvc service because winsvc.rb launches ruby process directly (doesn't use wrapper fluentd.bat) If FLUENT_PACKAGE_TOPDIR contains backslash ('\') instead of slash ('/'), it is harmful to handle match pattern ('*') in fluentd.conf. Instead of using WiX Environment element, we use CustomAction to modify directory separator. NOTE: For string object, we can omit Dim and Set, but the other part, we need to use Set explicitly. Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
NOTE: There is the one problem that Session.Property("FLUENTPROJECTLOCATION") returns empty value. |
FLUENT_PACKAGE_TOPDIR environment variable must be set for
fluentdwinsvc service because winsvc.rb launches ruby
process directly (doesn't use wrapper fluentd.bat)
If FLUENT_PACKAGE_TOPDIR contains backslash ('') instead of
slash ('/'), it is harmful to handle match pattern ('*') in
fluentd.conf.
Instead of using WiX Environment element, we use CustomAction to
modify directory separator.
NOTE: For string object, we can omit Dim and Set, but the
other part, we need to use Set explicitly.