From dace5f3845b240933670866411b8279e0967a193 Mon Sep 17 00:00:00 2001 From: Sander Declerck Date: Wed, 10 Dec 2025 13:48:07 +0100 Subject: [PATCH] PR comments: handle unix on pwsh, update readme, rename variable in unix script --- README.md | 24 ++++++++++++++---------- install-scripts/uninstall-safe-chain.ps1 | 13 ++++++++++++- install-scripts/uninstall-safe-chain.sh | 6 +++--- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index def262f..28b94cf 100644 --- a/README.md +++ b/README.md @@ -116,17 +116,21 @@ More information about the shell integration can be found in the [shell integrat ## Uninstallation -To uninstall the Aikido Safe Chain, you can run the following command: +To uninstall the Aikido Safe Chain, use our one-line uninstaller: -1. **Remove all aliases from your shell** by running: - ```shell - safe-chain teardown - ``` -2. **Uninstall the Aikido Safe Chain package** using npm: - ```shell - npm uninstall -g @aikidosec/safe-chain - ``` -3. **❗Restart your terminal** to remove the aliases. +### Unix/Linux/macOS + +```shell +curl -fsSL https://raw.githubusercontent.com/AikidoSec/safe-chain/main/install-scripts/uninstall-safe-chain.sh | sh +``` + +### Windows (PowerShell) + +```powershell +iex (iwr "https://raw.githubusercontent.com/AikidoSec/safe-chain/main/install-scripts/uninstall-safe-chain.ps1" -UseBasicParsing) +``` + +**❗Restart your terminal** after uninstalling to ensure all aliases are removed. # Configuration diff --git a/install-scripts/uninstall-safe-chain.ps1 b/install-scripts/uninstall-safe-chain.ps1 index 5eb6c11..4941262 100644 --- a/install-scripts/uninstall-safe-chain.ps1 +++ b/install-scripts/uninstall-safe-chain.ps1 @@ -75,11 +75,22 @@ function Uninstall-SafeChain { Write-Info "Uninstalling safe-chain..." # Run teardown if safe-chain is available + # Check for both safe-chain.exe (Windows) and safe-chain (Unix) since PowerShell Core runs on all platforms $safeChainExe = Join-Path $InstallDir "safe-chain.exe" + $safeChainBin = Join-Path $InstallDir "safe-chain" + + $safeChainPath = $null if (Test-Path $safeChainExe) { + $safeChainPath = $safeChainExe + } + elseif (Test-Path $safeChainBin) { + $safeChainPath = $safeChainBin + } + + if ($safeChainPath) { Write-Info "Running safe-chain teardown..." try { - & $safeChainExe teardown + & $safeChainPath teardown if ($LASTEXITCODE -ne 0) { Write-Warn "safe-chain teardown encountered issues, continuing with uninstallation..." } diff --git a/install-scripts/uninstall-safe-chain.sh b/install-scripts/uninstall-safe-chain.sh index 609f2f2..4b2d7ec 100755 --- a/install-scripts/uninstall-safe-chain.sh +++ b/install-scripts/uninstall-safe-chain.sh @@ -77,11 +77,11 @@ remove_volta_installation() { # Main uninstallation main() { - SAFE_CHAIN_EXE="$INSTALL_DIR/safe-chain" + SAFE_CHAIN_LOCATION="$INSTALL_DIR/safe-chain" - if [ -x "$SAFE_CHAIN_EXE" ]; then + if [ -x "$SAFE_CHAIN_LOCATION" ]; then info "Running safe-chain teardown..." - "$SAFE_CHAIN_EXE" teardown || warn "safe-chain teardown encountered issues, continuing with uninstallation..." + "$SAFE_CHAIN_LOCATION" teardown || warn "safe-chain teardown encountered issues, continuing with uninstallation..." elif command_exists safe-chain; then info "Running safe-chain teardown..." safe-chain teardown || warn "safe-chain teardown encountered issues, continuing with uninstallation..."