Skip to content
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

PostInstallScript and PostRemoveScript properties not respecting Condition #153

Open
GROSU1 opened this issue Jun 11, 2020 · 1 comment
Open

Comments

@GROSU1
Copy link

GROSU1 commented Jun 11, 2020

I noticed that the conditions for scripts are not being respected and are not adding the content. The only way to add data in the scripts is to remove the condition attribute altogether. Also tried to use the Path attribute to add a separate file script as mentioned in this issue but getting error MSB4066: The attribute "Path" in element <PostRemoveScript> is unrecognized.

 <PostRemoveScript Condition="$(InstallService.Equals('true', StringComparison.OrdinalIgnoreCase))">systemctl daemon-reload;</PostRemoveScript>

Also tried only with PostInstallScript and PostRemoveScript so I don't know if this is affecting pre scripts as well.

@aaronegger
Copy link

There is a substitute for the not working path attribute at the script tag.
To read files you can use $([System.IO.File]::ReadAllText($path"))

Example:
<PreInstallScript>$([System.IO.File]::ReadAllText("preinst"))</PreInstallScript> <PostInstallScript>$([System.IO.File]::ReadAllText("postinst"))</PostInstallScript> <PreRemoveScript>$([System.IO.File]::ReadAllText("prerm"))</PreRemoveScript> <PostRemoveScript>$([System.IO.File]::ReadAllText("postrm"))</PostRemoveScript>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants