From 9e9c94ea71e82b751cec7fa587530fe63a541a7e Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 15 Apr 2025 13:34:41 +0200 Subject: [PATCH] Updated list-updates.ps1 --- scripts/list-updates.ps1 | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/scripts/list-updates.ps1 b/scripts/list-updates.ps1 index d3f778d8..e4701c4e 100755 --- a/scripts/list-updates.ps1 +++ b/scripts/list-updates.ps1 @@ -3,8 +3,7 @@ Lists software updates .DESCRIPTION This PowerShell script queries the latest available software updates for the - local machine and lists it. - NOTE: Execute 'install-updates.ps1' to install the listed updates. + local machine and lists it (for installation use 'install-updates.ps1'). .EXAMPLE PS> ./list-updates.ps1 ⏳ Querying Microsoft Store updates... @@ -21,25 +20,36 @@ try { if ($IsLinux) { - "⏳ (1/2) Querying package updates..." - & sudo apt update - & sudo apt list --upgradable - "⏳ (2/2) Querying Snap updates..." - & sudo snap refresh --list + if (Get-Command apt -ErrorAction SilentlyContinue) { + Write-Host "`n⏳ Querying APT package updates..." -foregroundColor green + & sudo apt update + & sudo apt list --upgradable + } + if (Get-Command snap -ErrorAction SilentlyContinue) { + Write-Host "`n⏳ Querying Snap updates..." -foregroundColor green + & sudo snap refresh --list + } } elseif ($IsMacOS) { - throw "Sorry, MacOS not supported yet" + if (Get-Command brew -ErrorAction SilentlyContinue) { + Write-Host "`n⏳ Querying Homebrew updates..." -foregroundColor green + & brew outdated + } } else { if (Get-Command winget -ErrorAction SilentlyContinue) { Write-Host "`n⏳ Querying Microsoft Store updates..." -foregroundColor green & winget upgrade --include-unknown --source=msstore - Write-Host "`n⏳ Querying WinGet Store updates..." -foregroundColor green + Write-Host "`n⏳ Querying WinGet updates..." -foregroundColor green & winget upgrade --include-unknown --source=winget } if (Get-Command choco -ErrorAction SilentlyContinue) { Write-Host "`n⏳ Querying Chocolatey updates..." -foregroundColor green & choco outdated } + if (Get-Command scoop -ErrorAction SilentlyContinue) { + Write-Host "`n⏳ Querying Scoop updates..." -foregroundColor green + & scoop status + } } " " "💡 Execute 'install-updates.ps1' to install the listed updates."