mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Check for volta installation
This commit is contained in:
parent
22b780ddcd
commit
eddb4f3f75
2 changed files with 52 additions and 0 deletions
|
|
@ -60,6 +60,31 @@ function Remove-NpmInstallation {
|
|||
}
|
||||
}
|
||||
|
||||
# Check and uninstall Volta-managed package if present
|
||||
function Remove-VoltaInstallation {
|
||||
# Check if Volta is available
|
||||
if (-not (Get-Command volta -ErrorAction SilentlyContinue)) {
|
||||
return
|
||||
}
|
||||
|
||||
# Volta manages global packages in its own directory
|
||||
# Check if safe-chain is installed via Volta
|
||||
volta list @aikidosec/safe-chain 2>&1 | Out-Null
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Info "Detected Volta installation of @aikidosec/safe-chain"
|
||||
Write-Info "Uninstalling Volta version before installing binary version..."
|
||||
|
||||
volta uninstall @aikidosec/safe-chain 2>&1 | Out-Null
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Info "Successfully uninstalled Volta version"
|
||||
}
|
||||
else {
|
||||
Write-Warn "Failed to uninstall Volta version automatically"
|
||||
Write-Warn "Please run: volta uninstall @aikidosec/safe-chain"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Main installation
|
||||
function Install-SafeChain {
|
||||
Write-Info "Installing safe-chain $Version..."
|
||||
|
|
@ -67,6 +92,9 @@ function Install-SafeChain {
|
|||
# Check for existing npm installation
|
||||
Remove-NpmInstallation
|
||||
|
||||
# Check for existing Volta installation
|
||||
Remove-VoltaInstallation
|
||||
|
||||
# Detect platform
|
||||
$arch = Get-Architecture
|
||||
$binaryName = "safe-chain-win-$arch.exe"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue