From 8f80266ad3e8ed9d8b7c93b2e6d8e838fd12d946 Mon Sep 17 00:00:00 2001 From: Sander Declerck Date: Mon, 1 Dec 2025 14:52:15 +0100 Subject: [PATCH] Update powershell scripts and installation scripts --- install-scripts/install-safe-chain.ps1 | 40 +------------------ install-scripts/install-safe-chain.sh | 14 +------ .../include-python/init-pwsh.ps1 | 5 ++- .../startup-scripts/init-pwsh.ps1 | 5 ++- 4 files changed, 10 insertions(+), 54 deletions(-) diff --git a/install-scripts/install-safe-chain.ps1 b/install-scripts/install-safe-chain.ps1 index ac85891..88c109a 100644 --- a/install-scripts/install-safe-chain.ps1 +++ b/install-scripts/install-safe-chain.ps1 @@ -1,15 +1,8 @@ # Downloads and installs safe-chain for Windows # Usage: iex (iwr "https://raw.githubusercontent.com/AikidoSec/safe-chain/main/install-scripts/install-safe-chain.ps1" -UseBasicParsing) -param( - [string]$Version -) - -# Configuration -if (-not $Version) { - $Version = if ($env:SAFE_CHAIN_VERSION) { $env:SAFE_CHAIN_VERSION } else { "v0.0.2-binaries-beta" } -} +$Version = "v0.0.3-binaries-beta" $InstallDir = Join-Path $env:USERPROFILE ".safe-chain\bin" $RepoUrl = "https://github.com/AikidoSec/safe-chain" @@ -91,37 +84,6 @@ function Install-SafeChain { Write-Info "Binary installed to: $finalFile" - # Check if directory is in PATH - $userPath = [Environment]::GetEnvironmentVariable("Path", "User") - if ($userPath -like "*$InstallDir*") { - Write-Info "Installation directory is already in PATH" - } - else { - Write-Warn "Installation directory is not in PATH" - Write-Host "" - Write-Warn "Would you like to add it to your PATH now? (Y/N)" - $response = Read-Host - - if ($response -eq "Y" -or $response -eq "y") { - try { - $newPath = "$userPath;$InstallDir" - [Environment]::SetEnvironmentVariable("Path", $newPath, "User") - Write-Info "Added to PATH. Please restart your terminal for changes to take effect." - } - catch { - Write-Warn "Failed to add to PATH automatically: $_" - Write-Warn "Please add the following directory to your PATH manually:" - Write-Host " $InstallDir" - } - } - else { - Write-Warn "Skipping PATH setup. Add the following directory to your PATH manually:" - Write-Host "" - Write-Host " $InstallDir" - Write-Host "" - } - } - # Execute safe-chain setup Write-Info "Running safe-chain setup..." diff --git a/install-scripts/install-safe-chain.sh b/install-scripts/install-safe-chain.sh index 37f3136..32d086b 100755 --- a/install-scripts/install-safe-chain.sh +++ b/install-scripts/install-safe-chain.sh @@ -7,7 +7,7 @@ set -e # Exit on error # Configuration -VERSION="${SAFE_CHAIN_VERSION:-v0.0.2-binaries-beta}" +VERSION="${SAFE_CHAIN_VERSION:-v0.0.3-binaries-beta}" INSTALL_DIR="${HOME}/.safe-chain/bin" REPO_URL="https://github.com/AikidoSec/safe-chain" @@ -99,18 +99,6 @@ main() { info "Binary installed to: $FINAL_FILE" - # Check if directory is in PATH - case ":$PATH:" in - *":$INSTALL_DIR:"*) - info "Installation directory is already in PATH" - ;; - *) - warn "Installation directory is not in PATH" - warn "Add the following line to your shell profile (~/.bashrc, ~/.zshrc, etc.):" - printf "\n export PATH=\"\$PATH:${INSTALL_DIR}\"\n\n" - ;; - esac - # Execute safe-chain setup info "Running safe-chain setup..." if "$FINAL_FILE" setup; then diff --git a/packages/safe-chain/src/shell-integration/startup-scripts/include-python/init-pwsh.ps1 b/packages/safe-chain/src/shell-integration/startup-scripts/include-python/init-pwsh.ps1 index 27a5065..50a6d0b 100644 --- a/packages/safe-chain/src/shell-integration/startup-scripts/include-python/init-pwsh.ps1 +++ b/packages/safe-chain/src/shell-integration/startup-scripts/include-python/init-pwsh.ps1 @@ -1,4 +1,7 @@ -$env:PATH = "$env:PATH;$HOME/.safe-chain/bin" +# Use cross-platform path separator (: on Unix, ; on Windows) +$pathSeparator = if ($IsWindows) { ';' } else { ':' } +$safeChainBin = Join-Path $HOME '.safe-chain' 'bin' +$env:PATH = "$env:PATH$pathSeparator$safeChainBin" function Write-SafeChainWarning { param([string]$Command) diff --git a/packages/safe-chain/src/shell-integration/startup-scripts/init-pwsh.ps1 b/packages/safe-chain/src/shell-integration/startup-scripts/init-pwsh.ps1 index 17ddeb2..ddf5aee 100644 --- a/packages/safe-chain/src/shell-integration/startup-scripts/init-pwsh.ps1 +++ b/packages/safe-chain/src/shell-integration/startup-scripts/init-pwsh.ps1 @@ -1,4 +1,7 @@ -$env:PATH = "$env:PATH;$HOME/.safe-chain/bin" +# Use cross-platform path separator (: on Unix, ; on Windows) +$pathSeparator = if ($IsWindows) { ';' } else { ':' } +$safeChainBin = Join-Path $HOME '.safe-chain' 'bin' +$env:PATH = "$env:PATH$pathSeparator$safeChainBin" function Write-SafeChainWarning { param([string]$Command)