Drafting Mods
parent
1899070866
commit
572653819e
|
@ -111,6 +111,8 @@ function Install-WingetAutoUpdate{
|
||||||
New-Item -ItemType Directory -Force -Path $WingetUpdatePath
|
New-Item -ItemType Directory -Force -Path $WingetUpdatePath
|
||||||
}
|
}
|
||||||
Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
|
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
|
#White List or Black List apps
|
||||||
if ($UseWhiteList){
|
if ($UseWhiteList){
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
}
|
|
@ -16,6 +16,13 @@ Function Update-App ($app) {
|
||||||
#Run Winget Upgrade command
|
#Run Winget Upgrade command
|
||||||
& $Winget upgrade --id $($app.Id) --all --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
& $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
|
#Check if application updated properly
|
||||||
$CheckOutdated = Get-WingetOutdatedApps
|
$CheckOutdated = Get-WingetOutdatedApps
|
||||||
$FailedToUpgrade = $false
|
$FailedToUpgrade = $false
|
||||||
|
@ -25,6 +32,13 @@ Function Update-App ($app) {
|
||||||
#If app failed to upgrade, run Install command
|
#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
|
& $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
|
#Check if application installed properly
|
||||||
$CheckOutdated2 = Get-WingetOutdatedApps
|
$CheckOutdated2 = Get-WingetOutdatedApps
|
||||||
foreach ($CheckApp2 in $CheckOutdated2){
|
foreach ($CheckApp2 in $CheckOutdated2){
|
||||||
|
|
|
@ -31,6 +31,10 @@ function Update-WAU {
|
||||||
$TempPath = (Resolve-Path "$location\*\Winget-AutoUpdate\")[0].Path
|
$TempPath = (Resolve-Path "$location\*\Winget-AutoUpdate\")[0].Path
|
||||||
if ($TempPath){
|
if ($TempPath){
|
||||||
Copy-Item -Path "$TempPath\*" -Destination "$WorkingDir\" -Exclude "icons" -Recurse -Force
|
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
|
#Remove update zip file and update temp folder
|
||||||
|
|
Loading…
Reference in New Issue