-
Notifications
You must be signed in to change notification settings - Fork 903
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
Update MSI installer to prevent upgrades and not partially remove Chocolatey #3290
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
<Product Name="$(var.ProductName)" Id="*" UpgradeCode="$(var.ProductCode)" Language="1033" Manufacturer="$(var.ProductVendor)" Codepage="1252" Version="$(var.ProductVersion)"> | ||
<Package Id='*' Platform='x86' Keywords='Installer' Description="$(var.ProductName)" Comments="$(var.ProductSummary)" InstallScope="perMachine" InstallerVersion="200" Compressed="yes" /> | ||
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="!(loc.NewerVersionInstalled)" /> | ||
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="!(loc.NewerVersionInstalled)" Disallow="yes" DisallowUpgradeErrorMessage="!(loc.UpgradeNotAllowed)" /> | ||
<Media Id="1" Cabinet="$(var.ArtifactName).cab" EmbedCab="yes" /> | ||
|
||
<!-- Installation Properties --> | ||
|
@@ -23,10 +23,6 @@ | |
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair from post-install options, as it will not work with the script method --> | ||
<Property Id="ARPNOMODIFY" Value="yes" Secure="yes" /> <!-- Remove modify from post-install options, as it will not work with the script method --> | ||
|
||
<CustomAction Id="SetHelpersDirectoryPath" Property="HelpersDirectoryPath" Value="[INSTALLDIR]\\helpers" /> | ||
<CustomAction Id="SetRedirectsDirectoryPath" Property="RedirectsDirectoryPath" Value="[INSTALLDIR]\\redirects" /> | ||
<CustomAction Id="SetToolsDirectoryPath" Property="ToolsDirectoryPath" Value="[INSTALLDIR]\\tools" /> | ||
|
||
<PropertyRef Id="WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED" /> | ||
<Condition Message="!(loc.RequiresDotNet48)"> | ||
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED]]> | ||
|
@@ -35,17 +31,13 @@ | |
<!-- Custom Actions to Install Chocolatey --> | ||
<SetProperty Id="InstallChocolatey" | ||
Before="InstallChocolatey" | ||
Sequence="execute" | ||
Sequence="execute" | ||
Value=""[SystemFolder]\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "$env:ChocolateyInstall='[INSTALLDIR]'; & '[#ChocolateyInstall]' -ChocolateyDownloadUrl '[#ChocolateyNupkg]' -UseNativeUnzip"" /> | ||
<CustomAction Id="InstallChocolatey" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="yes" /> | ||
|
||
<!-- Custom Additions to the InstallExecuteSequence (e.g. the actions above) --> | ||
<InstallExecuteSequence> | ||
<Custom Action="InstallChocolatey" After="InstallFiles"><![CDATA[NOT Installed]]></Custom> | ||
<!-- Set these values during the uninstall such that we can remove the folders --> | ||
<Custom Action="SetHelpersDirectoryPath" Before="CostInitialize"><![CDATA[Installed]]></Custom> | ||
<Custom Action="SetRedirectsDirectoryPath" Before="CostInitialize"><![CDATA[Installed]]></Custom> | ||
<Custom Action="SetToolsDirectoryPath" Before="CostInitialize"><![CDATA[Installed]]></Custom> | ||
Comment on lines
-45
to
-48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These custom actions only fire when Chocolatey is already installed, which only happens on an upgrade, change, repair, or uninstall. None of which we currently do anything with. |
||
</InstallExecuteSequence> | ||
|
||
<!-- Installation Layout - primarily 'temporary' install files, unlike most MSI installers, as we run the standard install script --> | ||
|
@@ -54,14 +46,6 @@ | |
<Directory Id="INSTALLDIR" Name="chocolatey"> | ||
<Component Id="ChocolateyInstallDirectory" Guid="{9E538CD6-6F07-43E5-B8E2-ED31995F3D1C}" Win64="no"> | ||
<CreateFolder /> | ||
<RemoveFile Id="ChocoEXE" On="uninstall" Name="choco.exe" /> | ||
<RemoveFile Id="ChocoIgnore" On="uninstall" Name="choco.exe.ignore" /> | ||
<RemoveFile Id="ChocoManifest" On="uninstall" Name="choco.exe.manifest" /> | ||
<RemoveFile Id="ChocoCredits" On="uninstall" Name="CREDITS.txt" /> | ||
<RemoveFile Id="ChocoLicense" On="uninstall" Name="LICENSE.txt" /> | ||
<util:RemoveFolderEx Id="HelpersDirectory" On="uninstall" Property="HelpersDirectoryPath" /> | ||
<util:RemoveFolderEx Id="RedirectsDirectory" On="uninstall" Property="RedirectsDirectoryPath" /> | ||
<util:RemoveFolderEx Id="ToolsDirectory" On="uninstall" Property="ToolsDirectoryPath" /> | ||
Comment on lines
-57
to
-64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we intend to remove the support to uninstall Chocolatey CLI through the MSI? Or mainly making it a no-op? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be a no-op. The goal is to remove from Programs and Features but not actually remove Chocolatey itself in this version. We should notify the user to that @corbob ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, in this version we're going to make it a no-op since the previous behaviour doesn't actually remove all of Chocolatey, and instead leaves it in a broken state that doesn't allow reinstallation without manual intervention. I'll be doing up an ADR for this with the reasoning and options considered. The main reason to do a no-op right now is we would rather have a non operative uninstall than one that isn't working and don't want to rush the work of having a proper uninstall. With regards to notifying the user @pauby, I wasn't finding anything in my searching about changing things, but I just noticed some things in this diff that I think can work, so I'll look into that. |
||
<Environment Id="ChocolateyInstallEnvVar" Action="set" Name="ChocolateyInstall" Permanent="no" System="yes" Value="[INSTALLDIR]" /> | ||
</Component> | ||
</Directory> | ||
|
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.
Why are you removing these custom actions?
I was under the impression they are required to be available?
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.
These custom actions only fire when Chocolatey is already installed, which only happens on an upgrade, change, repair, or uninstall. None of which we currently do anything with.