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

Pre/Post Install scripts need to have LF line endings #76

Open
clemensv opened this issue Sep 4, 2018 · 2 comments
Open

Pre/Post Install scripts need to have LF line endings #76

clemensv opened this issue Sep 4, 2018 · 2 comments

Comments

@clemensv
Copy link

clemensv commented Sep 4, 2018

The install scripts lifted from the XML build info need to have LF endings. Currently, CRLF from Windows authors csproj gets carried over and causes syntax errors

The conversion should also strip trailing/leading whitespace that's an artifact of XML formatting, e.g.

<PostInstallScript>
   statement
   statement
   if [ cond ]; then
       statement
   fi
</PostInstallScript>

should strip

  • the first line break and any whitespace leading up to it (right after )
  • "shared whitespace" of all statements (i.e. the first three spaces of each line)
  • any trailing whitespace of any line
  • the final line break and any whitespace leading up to it and after it
@qmfrederik
Copy link
Collaborator

Regarding CRLF/LF, we can/should probably do a string.Replace to always normalize to LF.

On the other hand, regarding whitespace, I have a feeling that doing too much 'magic' (like removing 'shared whitespace') can have unintended side-effects.

What about:

  • Just wrapping the PostInstallScript contents in a CDATA element, like this:
<PostInstallScript><![CDATA[statement
statement
if [ cond ]; then
    statement
fi]]></PostInstallScript>
  • Instead of inlining the script in the .csproj file, sourcing it from another file (e.g. <PostInstallScript Path="myfile.sh"/>)?

@clemensv
Copy link
Author

clemensv commented Sep 5, 2018

I like sourcing from another file best. That's what I effectively resort to now by including a script and calling it. The step should ideally copy the content but not require the file to be included in the output.

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