Skip to content

Commit

Permalink
Merge pull request #113 from tomamplius/allowupdate
Browse files Browse the repository at this point in the history
Allow upgrade app
  • Loading branch information
Romanitho committed May 24, 2024
2 parents 64e1f11 + a0d7ef6 commit c9119c2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions winget-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Forward Winget App ID to install. For multiple apps, separate with ",". Case sen
.PARAMETER Uninstall
To uninstall app. Works with AppIDs
.PARAMETER AllowUpgrade
To allow upgrade app if present. Works with AppIDs
.PARAMETER LogPath
Used to specify logpath. Default is same folder as Winget-Autoupdate project
Expand All @@ -34,14 +37,18 @@ If '-Uninstall' is used, it removes the app from WAU White List.
.EXAMPLE
.\winget-install.ps1 -AppIDs "7zip.7zip -v 22.00", "Notepad++.Notepad++"
.EXAMPLE
.\winget-install.ps1 -AppIDs "Notepad++.Notepad++" -AllowUpgrade
#>

[CmdletBinding()]
param(
[Parameter(Mandatory = $True, ParameterSetName = "AppIDs")] [String[]] $AppIDs,
[Parameter(Mandatory = $False)] [Switch] $Uninstall,
[Parameter(Mandatory = $False)] [String] $LogPath,
[Parameter(Mandatory = $False)] [Switch] $WAUWhiteList
[Parameter(Mandatory = $False)] [Switch] $WAUWhiteList,
[Parameter(Mandatory = $False)] [Switch] $AllowUpgrade
)


Expand Down Expand Up @@ -302,7 +309,7 @@ function Test-ModsUninstall ($AppID) {
#Install function
function Install-App ($AppID, $AppArgs) {
$IsInstalled = Confirm-Install $AppID
if (!($IsInstalled)) {
if (!($IsInstalled) -or $AllowUpgrade ) {
#Check if mods exist (or already exist) for preinstall/install/installedonce/installed
$ModsPreInstall, $ModsInstall, $ModsInstalledOnce, $ModsInstalled = Test-ModsInstall $($AppID)

Expand Down

0 comments on commit c9119c2

Please sign in to comment.