Mod for AppID-notinstalled
parent
17b02dfc95
commit
c304b70604
|
@ -181,7 +181,8 @@ Just put the scripts in question with the **AppID** followed by the `-preinstall
|
|||
|
||||
>- Runs before upgrade/install: `AppID-preinstall.ps1`<br>
|
||||
>- Runs during upgrade/install (before install check): `AppID-upgrade.ps1`/`AppID-install.ps1`<br>
|
||||
>- Runs after upgrade/install has been confirmed: `AppID-installed.ps1`
|
||||
>- Runs after upgrade/install has been confirmed: `AppID-installed.ps1`<br>
|
||||
>- Runs after a failed upgrade/install: `AppID-notinstalled.ps1`<br>
|
||||
|
||||
The **-install** mod will be used for upgrades too if **-upgrade** doesn't exist (**WAU** first tries `& $Winget upgrade --id` and if the app isn't detected after that `& $Winget install --id` is tried).<br>
|
||||
`AppID-install.ps1` is recommended because it's used in **both** scenarios.
|
||||
|
|
|
@ -8,6 +8,7 @@ function Test-Mods ($app) {
|
|||
$ModsUpgrade = $null
|
||||
$ModsInstall = $null
|
||||
$ModsInstalled = $null
|
||||
$ModsNotInstalled = $ null
|
||||
|
||||
$Mods = "$WorkingDir\mods"
|
||||
if (Test-Path "$Mods\$app-*") {
|
||||
|
@ -27,8 +28,11 @@ function Test-Mods ($app) {
|
|||
if (Test-Path "$Mods\$app-installed.ps1") {
|
||||
$ModsInstalled = "$Mods\$app-installed.ps1"
|
||||
}
|
||||
if (Test-Path "$Mods\$app-notinstalled.ps1") {
|
||||
$ModsNotInstalled = "$Mods\$app-notinstalled.ps1"
|
||||
}
|
||||
}
|
||||
|
||||
return $ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled
|
||||
return $ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled, $ModsNotInstalled
|
||||
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ Function Update-App ($app) {
|
|||
$Balise = $($app.Name)
|
||||
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Balise $Balise -Button1Action $ReleaseNoteURL -Button1Text $Button1Text
|
||||
|
||||
#Check if mods exist for preinstall/install/upgrade
|
||||
$ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled = Test-Mods $($app.Id)
|
||||
#Check if mods exist for preinstall/override/upgrade/install/installed/notinstalled
|
||||
$ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled, $ModsNotInstalled = Test-Mods $($app.Id)
|
||||
|
||||
#Winget upgrade
|
||||
Write-ToLog "########## WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID '$($App.Id)' ##########" "Gray"
|
||||
|
@ -87,6 +87,10 @@ Function Update-App ($app) {
|
|||
& "$ModsInstalled"
|
||||
}
|
||||
}
|
||||
elseif ($FailedToUpgrade -eq $true -and $ModsNotInstalled) {
|
||||
Write-ToLog "Modifications for $($app.Id) after a failed upgrade/install are being applied..." "Yellow"
|
||||
& "$ModsNotInstalled"
|
||||
}
|
||||
|
||||
Write-ToLog "########## WINGET UPGRADE PROCESS FINISHED FOR APPLICATION ID '$($App.Id)' ##########" "Gray"
|
||||
|
||||
|
|
|
@ -7,12 +7,13 @@ Custom scripts should be placed here.
|
|||
A script **Template** and **Mods Functions** are included as an **example** to get you started...
|
||||
|
||||
Scripts that are considered:
|
||||
**AppID**`-preinstall.ps1`, `-upgrade.ps1`, `-install.ps1` or `-installed.ps1`.
|
||||
**AppID**`-preinstall.ps1`, `-upgrade.ps1`, `-install.ps1`, `-installed.ps1` or `-notinstalled.ps1`.
|
||||
(`-preuninstall.ps1`, `-uninstall.ps1` or `-uninstalled.ps1` - if used together with [Winget-Install](https://github.com/Romanitho/Winget-Install)).
|
||||
|
||||
> Runs before upgrade/install: `AppID-preinstall.ps1`
|
||||
> Runs during upgrade/install (before install check): `AppID-upgrade.ps1`/`AppID-install.ps1`
|
||||
> Runs after upgrade/install has been confirmed: `AppID-installed.ps1`
|
||||
> Runs after a failed upgrade/install: `AppID-notinstalled.ps1`
|
||||
|
||||
The **-install** mod will be used for upgrades too if **-upgrade** doesn't exist (**WAU** first tries `& $Winget upgrade --id` and if the app isn't detected after that `& $Winget install --id` is tried).
|
||||
|
||||
|
|
Loading…
Reference in New Issue