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

(#2112) Add msp installer support to Install-ChocolateyInstallPackage #2113

Merged
merged 3 commits into from
May 12, 2021

Conversation

steviecoaster
Copy link
Contributor

Fixes #2112

  • Adds support for the msp file type in `Install-ChocolateyInstallPackage

Verified no additional changes were required to wire this up in Start-ChocolateyProcessAsAdmin

Copy link
Member

@vexx32 vexx32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me, just a few small things I'd probably look to clean up a little, but otherwise everything seems proper 💖

@gep13
Copy link
Member

gep13 commented Apr 19, 2021

@steviecoaster are you in a position to fix up the suggestions that have been made here?

@steviecoaster
Copy link
Contributor Author

@gep13 I've gone through and addressed the requested changes.

@steviecoaster steviecoaster requested a review from vexx32 April 19, 2021 17:52
Copy link
Member

@vexx32 vexx32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me with one small comment.

Comment on lines 264 to 267
if ($additionalInstallArgs -match 'INSTALLDIR' -or `
$additionalInstallArgs -match 'TARGETDIR' -or `
$additionalInstallArgs -match 'dir\=' -or `
$additionalInstallArgs -match '\/D\='
$additionalInstallArgs -match 'TARGETDIR' -or `
$additionalInstallArgs -match 'dir\=' -or `
$additionalInstallArgs -match '\/D\='
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be done with a single -match:

if ($additionalInstallArgs -match 'INSTALLDIR|TARGETDIR|dir\=|\/D\=') { ... }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do. Should we go this route (I know what | means here), or should we leave it as is for readability?

Copy link
Member

@vexx32 vexx32 Apr 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability we can opt for something like this instead:

$argPattern = @(
    'INSTALLDIR'
    'TARGETDIR'
    'dir\='
    '\/D\='
) -join '|'

if ($additionalInstallArgs -match $argPattern) { ... }

Maybe with a short comment explaining it if you feel it can use it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear... this PR is really about adding msp support, it isn't really about changing existing code, unless it is related to that change, so I don't think we need to spend too much time thinking about this change. We can make changes to code outwith the change thing that is being worked on, but it should be done as a separate commit in the PR. This is one of the things that I updated while rebasing this PR.

@steviecoaster
Copy link
Contributor Author

@gep13 looks like I've got all requested changes in here now!

@gep13 gep13 changed the base branch from master to stable May 5, 2021 12:29
@gep13 gep13 force-pushed the GH2112 branch 2 times, most recently from c6b0f5c to 2f07a6c Compare May 5, 2021 12:49
@gep13
Copy link
Member

gep13 commented May 5, 2021

@steviecoaster I have taken the liberty of rebasing this PR, and re-targetting against the stable branch. I have left some comments in the PR though, as I believe that there are some changes required. @vexx32 can I get you to re-review the changes and my comments as well to make sure I am not barking up the wrong tree. Thanks

gep13 added 2 commits May 12, 2021 08:15
Rather than using multiple OR matches, which isn't maintainable.
It's trivial to currently work with MSI installers with chocolately, as
we natively hook into msiexec's silent installation parameters to
complete the installation.

Support for msp files directly is a simple addition, as it uses the same
underlying msiexec installation method, with a slightly modified
parameter set.

Co-authored-by:  Stephen Valdinger <[email protected]>
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gep13 gep13 merged commit a992a82 into chocolatey:stable May 12, 2021
@gep13
Copy link
Member

gep13 commented May 12, 2021

@steviecoaster thanks for getting this added, appreciate it!

@gep13 gep13 changed the title (GH-2112) Add msp installer support to Install-ChocolateyInstallPackage (#2112) Add msp installer support to Install-ChocolateyInstallPackage May 12, 2021
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

Successfully merging this pull request may close these issues.

Provide ability to install msp patch files using Install-ChocolateyInstallPackage function
3 participants