Adding PreInstall mods...
parent
5eb55be980
commit
baa7ef84a4
|
@ -3,11 +3,15 @@
|
|||
function Test-Mods ($app) {
|
||||
|
||||
#Takes care of a null situation
|
||||
$ModsPreInstall = $null
|
||||
$ModsInstall = $null
|
||||
$ModsUpgrade = $null
|
||||
|
||||
$Mods = "$WorkingDir\mods"
|
||||
if (Test-Path "$Mods\$app-*") {
|
||||
if (Test-Path "$Mods\$app-preinstall.ps1") {
|
||||
$ModsPreInstall = "$Mods\$app-preinstall.ps1"
|
||||
}
|
||||
if (Test-Path "$Mods\$app-install.ps1") {
|
||||
$ModsInstall = "$Mods\$app-install.ps1"
|
||||
$ModsUpgrade = "$Mods\$app-install.ps1"
|
||||
|
@ -17,6 +21,6 @@ function Test-Mods ($app) {
|
|||
}
|
||||
}
|
||||
|
||||
return $ModsInstall, $ModsUpgrade
|
||||
return $ModsPreInstall, $ModsInstall, $ModsUpgrade
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,15 @@ 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, $ModsInstall, $ModsUpgrade = Test-Mods $($app.Id)
|
||||
|
||||
#If PreInstall script exist
|
||||
if ($ModsPreInstall) {
|
||||
Write-Log "Modifications for $($app.Id) before upgrade are being applied..." "Yellow"
|
||||
& "$ModsPreInstall"
|
||||
}
|
||||
|
||||
#Winget upgrade
|
||||
Write-Log "########## WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID '$($App.Id)' ##########" "Gray"
|
||||
|
||||
|
@ -61,9 +70,6 @@ Function Update-App ($app) {
|
|||
|
||||
if ($FailedToUpgrade -eq $false) {
|
||||
|
||||
#Check if mods exist for install/upgrade
|
||||
$ModsInstall, $ModsUpgrade = Test-Mods $($app.Id)
|
||||
|
||||
if (($ModsUpgrade) -and ($ModsMode -eq "Upgrade")) {
|
||||
Write-Log "Modifications for $($app.Id) after upgrade are being applied..." "Yellow"
|
||||
& "$ModsUpgrade"
|
||||
|
|
Loading…
Reference in New Issue