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
|
# Main installation
|
||||||
function Install-SafeChain {
|
function Install-SafeChain {
|
||||||
Write-Info "Installing safe-chain $Version..."
|
Write-Info "Installing safe-chain $Version..."
|
||||||
|
|
@ -67,6 +92,9 @@ function Install-SafeChain {
|
||||||
# Check for existing npm installation
|
# Check for existing npm installation
|
||||||
Remove-NpmInstallation
|
Remove-NpmInstallation
|
||||||
|
|
||||||
|
# Check for existing Volta installation
|
||||||
|
Remove-VoltaInstallation
|
||||||
|
|
||||||
# Detect platform
|
# Detect platform
|
||||||
$arch = Get-Architecture
|
$arch = Get-Architecture
|
||||||
$binaryName = "safe-chain-win-$arch.exe"
|
$binaryName = "safe-chain-win-$arch.exe"
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,27 @@ check_npm_installation() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check and uninstall Volta-managed package if present
|
||||||
|
check_volta_installation() {
|
||||||
|
if ! command_exists volta; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Volta manages global packages in its own directory
|
||||||
|
# Check if safe-chain is installed via Volta
|
||||||
|
if volta list @aikidosec/safe-chain >/dev/null 2>&1; then
|
||||||
|
info "Detected Volta installation of @aikidosec/safe-chain"
|
||||||
|
info "Uninstalling Volta version before installing binary version..."
|
||||||
|
|
||||||
|
if volta uninstall @aikidosec/safe-chain >/dev/null 2>&1; then
|
||||||
|
info "Successfully uninstalled Volta version"
|
||||||
|
else
|
||||||
|
warn "Failed to uninstall Volta version automatically"
|
||||||
|
warn "Please run: volta uninstall @aikidosec/safe-chain"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Main installation
|
# Main installation
|
||||||
main() {
|
main() {
|
||||||
info "Installing safe-chain ${VERSION}..."
|
info "Installing safe-chain ${VERSION}..."
|
||||||
|
|
@ -95,6 +116,9 @@ main() {
|
||||||
# Check for existing npm installation
|
# Check for existing npm installation
|
||||||
check_npm_installation
|
check_npm_installation
|
||||||
|
|
||||||
|
# Check for existing Volta installation
|
||||||
|
check_volta_installation
|
||||||
|
|
||||||
# Detect platform
|
# Detect platform
|
||||||
OS=$(detect_os)
|
OS=$(detect_os)
|
||||||
ARCH=$(detect_arch)
|
ARCH=$(detect_arch)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue