mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-29 01:11:30 -06:00
Compile Winutil
This commit is contained in:
parent
dec704305f
commit
dd50b70bf9
20
winutil.ps1
20
winutil.ps1
@ -2460,11 +2460,17 @@ function Test-WinUtilPackageManager {
|
|||||||
# Install Winget if not detected
|
# Install Winget if not detected
|
||||||
$wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue
|
$wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue
|
||||||
if ($wingetExists) {
|
if ($wingetExists) {
|
||||||
$wingetVersion = [System.Version]::Parse((winget --version).Trim('v'))
|
$wingetversionfull = (winget --version)
|
||||||
|
$wingetversiontrim = $wingetversionfull.Trim('v')
|
||||||
|
if ($wingetversiontrim.EndsWith("-preview")) {
|
||||||
|
$wingetversiontrim = $wingetversiontrim.Trim('-preview')
|
||||||
|
$wingetpreview = $true
|
||||||
|
}
|
||||||
|
$wingetVersion = [System.Version]::Parse($wingetversiontrim)
|
||||||
$minimumWingetVersion = [System.Version]::new(1,2,10691) # Win 11 23H2 comes with bad winget v1.2.10691
|
$minimumWingetVersion = [System.Version]::new(1,2,10691) # Win 11 23H2 comes with bad winget v1.2.10691
|
||||||
$wingetOutdated = $wingetVersion -le $minimumWingetVersion
|
$wingetOutdated = $wingetVersion -le $minimumWingetVersion
|
||||||
|
|
||||||
Write-Host "Winget v$wingetVersion"
|
Write-Host "Winget $wingetVersionfull"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$wingetExists -or $wingetOutdated) {
|
if (!$wingetExists -or $wingetOutdated) {
|
||||||
@ -2477,13 +2483,17 @@ function Test-WinUtilPackageManager {
|
|||||||
|
|
||||||
if ($winget) {
|
if ($winget) {
|
||||||
if ($wingetExists -and !$wingetOutdated) {
|
if ($wingetExists -and !$wingetOutdated) {
|
||||||
Write-Host "- Winget up-to-date"
|
if (!$wingetpreview) {
|
||||||
|
Write-Host "- Winget up-to-date"
|
||||||
|
} else {
|
||||||
|
Write-Host "- Winget preview version detected. Unexptected problems may occur" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($choco){
|
if ($choco) {
|
||||||
if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)){
|
if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)) {
|
||||||
Write-Host "Chocolatey v$chocoVersion"
|
Write-Host "Chocolatey v$chocoVersion"
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user