윈도우 lazygit 설치 시 오류 문제
This commit is contained in:
1 parent
174b543003
commit
27b0b4e6c9
1 file changed
+15
-9
+15
-9
@@ -1,4 +1,4 @@
|
|||||||
#Requires -Version 5.1
|
#Requires -Version 5.1
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Installs lazygit terminal UI for git from GitHub releases.
|
Installs lazygit terminal UI for git from GitHub releases.
|
||||||
@@ -98,25 +98,31 @@ function Install-GitPortable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tagName = $latestRelease.tag_name
|
$tagName = $latestRelease.tag_name
|
||||||
# Git for Windows tags look like "v2.54.0.windows.1"
|
Write-Info "Latest Git for Windows: $tagName"
|
||||||
$gitVersion = $tagName -replace '^v', '' -replace '\.windows\.\d+$', ''
|
|
||||||
Write-Info "Latest Git for Windows: $tagName (version $gitVersion)"
|
|
||||||
|
|
||||||
# Find the PortableGit asset for our architecture
|
# Find the PortableGit asset for our architecture (e.g. PortableGit-2.55.0.5-64-bit.7z.exe)
|
||||||
$portablePattern = "PortableGit-${gitVersion}-${gitArch}.7z.exe"
|
$asset = $latestRelease.assets | Where-Object {
|
||||||
$asset = $latestRelease.assets | Where-Object { $_.name -eq $portablePattern } | Select-Object -First 1
|
$_.name -match "^PortableGit-.*-${gitArch}\.7z\.exe$"
|
||||||
|
} | Select-Object -First 1
|
||||||
|
|
||||||
if (-not $asset) {
|
if (-not $asset) {
|
||||||
Write-Err "Could not find PortableGit asset matching '$portablePattern' in release $tagName."
|
$asset = $latestRelease.assets | Where-Object {
|
||||||
|
$_.name -like "PortableGit*$gitArch*.7z.exe"
|
||||||
|
} | Select-Object -First 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (-not $asset) {
|
||||||
|
Write-Err "Could not find PortableGit asset for architecture '$gitArch' in release $tagName."
|
||||||
|
}
|
||||||
|
|
||||||
|
$assetName = $asset.name
|
||||||
$downloadUrl = $asset.browser_download_url
|
$downloadUrl = $asset.browser_download_url
|
||||||
$installPath = Join-Path $env:USERPROFILE "PortableGit"
|
$installPath = Join-Path $env:USERPROFILE "PortableGit"
|
||||||
|
|
||||||
# Download
|
# Download
|
||||||
$tmpDir = Join-Path $env:TEMP "git_install_$(Get-Random)"
|
$tmpDir = Join-Path $env:TEMP "git_install_$(Get-Random)"
|
||||||
New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null
|
New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null
|
||||||
$zipPath = Join-Path $tmpDir "$portablePattern"
|
$zipPath = Join-Path $tmpDir "$assetName"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Info "Downloading: $downloadUrl"
|
Write-Info "Downloading: $downloadUrl"
|
||||||
|
|||||||
Reference in new issue
Block a user