Drafting Mods

pull/59/head
KnifMelti 2022-04-20 06:22:22 +02:00
parent 1899070866
commit 572653819e
4 changed files with 38 additions and 0 deletions

View File

@ -111,6 +111,8 @@ function Install-WingetAutoUpdate{
New-Item -ItemType Directory -Force -Path $WingetUpdatePath
}
Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
#Add 'mods' directory
New-Item -ItemType Directory -Force -Path "$WingetUpdatePath\mods"
#White List or Black List apps
if ($UseWhiteList){

View File

@ -0,0 +1,18 @@
#Function to check if modification exists in 'mods' directory
function Test-Mods ($app){
if (Test-Path "$WorkingDir\mods\$app-install.ps1"){
$ModsInstall = "$WorkingDir\mods\$app-install.ps1"
$ModsUpgrade = "$WorkingDir\mods\$app-install.ps1"
}
if (Test-Path "$WorkingDir\mods\$app-upgrade.ps1"){
$ModsUpgrade = "$WorkingDir\mods\$app-upgrade.ps1"
}
else{
return 0
}
return $ModsInstall,$ModsUpgrade
}

View File

@ -16,6 +16,13 @@ Function Update-App ($app) {
#Run Winget Upgrade command
& $Winget upgrade --id $($app.Id) --all --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
#Check if mods exist
$ModsUpgrade = Test-Mods $($app.Id)
if ($ModsUpgrade){
Write-Log "Modifications for $($app.Id) during upgrade are being applied..." "Yellow"
& "$ModsUpgrade"
}
#Check if application updated properly
$CheckOutdated = Get-WingetOutdatedApps
$FailedToUpgrade = $false
@ -24,6 +31,13 @@ Function Update-App ($app) {
#If app failed to upgrade, run Install command
& $Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
#Check if mods exist
$ModsInstall = Test-Mods $($app.Id)
if ($ModsInstall){
Write-Log "Modifications for $($app.Id) during install are being applied..." "Yellow"
& "$ModsInstall"
}
#Check if application installed properly
$CheckOutdated2 = Get-WingetOutdatedApps

View File

@ -31,6 +31,10 @@ function Update-WAU {
$TempPath = (Resolve-Path "$location\*\Winget-AutoUpdate\")[0].Path
if ($TempPath){
Copy-Item -Path "$TempPath\*" -Destination "$WorkingDir\" -Exclude "icons" -Recurse -Force
#Add 'mods' directory
if (!(Test-Path "$WorkingDir\mods")){
New-Item -ItemType Directory -Force -Path "$WingetUpdatePath\mods"
}
}
#Remove update zip file and update temp folder