Refactoring

This commit is contained in:
David Gonzalez Martinez (DHL Supply Chain), external 2024-11-04 16:05:49 +01:00
parent db888656db
commit 36ff8879a0

View File

@ -9,7 +9,7 @@ if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$releases = Invoke-RestMethod -uri $releases_url
$latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith('msixbundle') } | Select -First 1
$latestRelease = $releases.assets | Where-Object { $_.browser_download_url.EndsWith('msixbundle') } | Select-Object -First 1
"Installing winget from $($latestRelease.browser_download_url)"
Add-AppxPackage -Path $latestRelease.browser_download_url
@ -59,7 +59,7 @@ Foreach ($app in $apps) {
$listApp = winget list --exact -q $app.name --accept-source-agreements
if (![String]::Join("", $listApp).Contains($app.name)) {
Write-host "Installing:" $app.name
if ($app.source -ne $null) {
if ($null -ne $app.source) {
winget install --exact --silent $app.name --source $app.source --accept-package-agreements
}
else {