Merge pull request #206 from AikidoSec/fix-powershell-install-script

Fix scoping in powershell script
This commit is contained in:
Sander Declerck 2025-12-03 15:55:18 +01:00 committed by GitHub
commit fa7be54ee9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -110,9 +110,9 @@ function Remove-VoltaInstallation {
# Main installation # Main installation
function Install-SafeChain { function Install-SafeChain {
# Fetch latest version if VERSION is not set # Fetch latest version if VERSION is not set
if ([string]::IsNullOrWhiteSpace($script:Version)) { if ([string]::IsNullOrWhiteSpace($Version)) {
Write-Info "Fetching latest release version..." Write-Info "Fetching latest release version..."
$script:Version = Get-LatestVersion $Version = Get-LatestVersion
} }
# Build installation message # Build installation message
@ -166,6 +166,10 @@ function Install-SafeChain {
# Rename to final location # Rename to final location
$finalFile = Join-Path $InstallDir "safe-chain.exe" $finalFile = Join-Path $InstallDir "safe-chain.exe"
try { try {
# Remove existing file if present (Move-Item -Force doesn't overwrite)
if (Test-Path $finalFile) {
Remove-Item -Path $finalFile -Force
}
Move-Item -Path $tempFile -Destination $finalFile -Force Move-Item -Path $tempFile -Destination $finalFile -Force
} }
catch { catch {