mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Update powershell scripts and installation scripts
This commit is contained in:
parent
e58e77bc63
commit
8f80266ad3
4 changed files with 10 additions and 54 deletions
|
|
@ -1,15 +1,8 @@
|
||||||
# Downloads and installs safe-chain for Windows
|
# 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)
|
# 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"
|
$InstallDir = Join-Path $env:USERPROFILE ".safe-chain\bin"
|
||||||
$RepoUrl = "https://github.com/AikidoSec/safe-chain"
|
$RepoUrl = "https://github.com/AikidoSec/safe-chain"
|
||||||
|
|
||||||
|
|
@ -91,37 +84,6 @@ function Install-SafeChain {
|
||||||
|
|
||||||
Write-Info "Binary installed to: $finalFile"
|
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
|
# Execute safe-chain setup
|
||||||
Write-Info "Running safe-chain setup..."
|
Write-Info "Running safe-chain setup..."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
set -e # Exit on error
|
set -e # Exit on error
|
||||||
|
|
||||||
# Configuration
|
# 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"
|
INSTALL_DIR="${HOME}/.safe-chain/bin"
|
||||||
REPO_URL="https://github.com/AikidoSec/safe-chain"
|
REPO_URL="https://github.com/AikidoSec/safe-chain"
|
||||||
|
|
||||||
|
|
@ -99,18 +99,6 @@ main() {
|
||||||
|
|
||||||
info "Binary installed to: $FINAL_FILE"
|
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
|
# Execute safe-chain setup
|
||||||
info "Running safe-chain setup..."
|
info "Running safe-chain setup..."
|
||||||
if "$FINAL_FILE" setup; then
|
if "$FINAL_FILE" setup; then
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Write-SafeChainWarning {
|
||||||
param([string]$Command)
|
param([string]$Command)
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Write-SafeChainWarning {
|
||||||
param([string]$Command)
|
param([string]$Command)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue