Closed brogers5 closed 1 year ago
:x: Package verification failed, please review the Appveyor Logs and the provided Artifacts before requesting a human reviewer to take a look.
:white_check_mark: Package verification completed without issues. PR is now pending human review
:white_check_mark: Package verification completed without issues. PR is now pending human review
@brogers5 your changes have been merged, thanks for your contribution!
Description
This changeset adds support for silent uninstallations, as well as version detection support to improve
googledrive
's handling of a few situations, including:Motivation and Context
Fixes #138, fixes #154, fixes #165.
By default, Google Drive is configured to silently update itself. As Google Drive's installer currently does not support reinstallations, this could cause the installer to return exit code 1638 with either an initial package install (when the machine already has Google Drive installed), or a package upgrade (since a package upgrade may occur after the software was updated).
When run non-silently, if the installer has the same version packaged, Google Drive will inform the user it is already installed :
The package will now detect the currently installed version of Google Drive (if any) and compare it to the packaged software version. If the software is not installed, or the packaged version is newer, the package will continue to install/upgrade as it historically has. However, if the packaged version is already installed, download and installation of Google Drive will now be skipped by default, which enables the package install/upgrade to gracefully succeed. This can be optionally overridden with the
--force
switch if desired.Google Drive's installer also does not support downgrades. If the installer has an earlier version packaged, the installer will inform the user a newer version is already installed:
The software will need to be uninstalled first if we're doing a forced reinstallation or a downgrade. To get this process started, I've implemented support for a silent uninstall as documented here.
The uninstaller is quirky in that it will shell an executable out to
TEMP
(regardless of where it starts from), spawn a child process from said executable, then terminate itself. Unfortunately, bothUninstall-ChocolateyPackage
andStart-ChocolateyProcessAsAdmin
will only track the parent process, and terminates with exit code 0 well before the child process actually finishes, which necessitated the use ofStart-Process
with both-PassThru
and-Wait
to correctly handle this situation.The uninstaller will also queue some files to be cleaned up upon the next reboot, and prevents another installation of Google Drive before the reboot completes:
To work around this, a warning is printed after uninstallation completes, which states that a reboot is required to complete the uninstallation. In the case of a mandatory uninstall, the install script will deliberately throw an error in an attempt to guide users toward the correct path. An install that is attempted before this happens will fail with exit code 1610.
How Has this Been Tested?
Environments
Dev
Chocolatey Test Environment
Steps
Create Test Packages
choco pack
).Prepare Testing Environment
Set-Location
to my packages' parent directory.Clean Install Regression Test
choco install googledrive --source="'.'" --version=70.0.2.0
).Upgrade Regression Test
choco upgrade googledrive --source="'.'"
).Package-Only Install Test
choco install googledrive --source="'.'"
).Package-Only Upgrade Test
choco install googledrive --source="'.'" --version=70.0.2.0
).choco upgrade googledrive --source="'.'"
).Forced Reinstallation Test
choco install googledrive --source="'.'" --force
).choco install googledrive --source="'.'" --force
).Downgrade Test
choco install googledrive --source="'.'" --version=70.0.2.0 --allow-downgrade
).choco install googledrive --source="'.'" --version=70.0.2.0 --allow-downgrade
).Uninstall Test
choco uninstall googledrive
).Screenshot (if appropriate, usually isn't needed):
N/A
Types of changes
Checklist: