mirror of
https://github.com/CyberL1/holesail-proxy.git
synced 2025-06-27 23:59:43 -04:00
feat: upgrade command
This commit is contained in:
36
scripts/get.ps1
Normal file
36
scripts/get.ps1
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$BinPath = "${Home}\.holesail-proxy\bin"
|
||||
$Zip = "$RuntimerPath\holesail-proxy.zip"
|
||||
$Exe = "$RuntimerPath\holesail-proxy.exe"
|
||||
$OldExe = "$env:Temp\holesail-proxy-old.exe"
|
||||
|
||||
$Target = "windows-amd64"
|
||||
|
||||
$DownloadUrl = "https://github.com/CyberL1/holesail-proxy/releases/latest/download/holesal-proxy-${Target}.zip"
|
||||
|
||||
if (!(Test-Path $BinPath)) {
|
||||
New-Item $BinPath -ItemType Directory | Out-Null
|
||||
}
|
||||
|
||||
curl.exe -Lo $Zip $DownloadUrl
|
||||
|
||||
if (Test-Path $Exe) {
|
||||
Move-Item -Path $Exe -Destination $OldExe -Force
|
||||
}
|
||||
|
||||
Expand-Archive -LiteralPath $Zip -DestinationPath $BinPath -Force
|
||||
Remove-Item $Zip
|
||||
|
||||
$User = [System.EnvironmentVariableTarget]::User
|
||||
$Path = [System.Environment]::GetEnvironmentVariable('Path', $User)
|
||||
|
||||
if (!(";${Path};".ToLower() -like "*;${BinPath};*".ToLower())) {
|
||||
[System.Environment]::SetEnvironmentVariable('Path', "${Path};${BinPath}", $User)
|
||||
$Env:Path += ";${BinPath}"
|
||||
}
|
||||
|
||||
Write-Output "Holesail proxy was installed to $Exe"
|
||||
Write-Output "Run 'holesail-proxy up' to get started"
|
45
scripts/get.sh
Normal file
45
scripts/get.sh
Normal file
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! command -v unzip > /dev/null; then
|
||||
echo "Error: Unzip is required to install Holesail proxy"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dir="$HOME/.holesail-proxy/bin"
|
||||
zip="$dir/holesail-proxy.zip"
|
||||
exe="$dir/holesail-proxy"
|
||||
|
||||
if [ "$OS" = "Windows_NT" ]; then
|
||||
target="windows"
|
||||
else
|
||||
case $(uname -sm) in
|
||||
"Darwin x86_64") target="darwin-amd64" ;;
|
||||
"Darwin arm64") target="dawin-arm64" ;;
|
||||
"Linux aarch64") target="linux-arm64" ;;
|
||||
*) target="linux-amd64"
|
||||
esac
|
||||
fi
|
||||
|
||||
download_url="https://github.com/CyberL1/holesail-proxy/releases/latest/download/holesail-proxy-${target}.zip"
|
||||
|
||||
if [ ! -d $dir ]; then
|
||||
mkdir -p $dir
|
||||
fi
|
||||
|
||||
curl --fail --location --progress-bar --output $zip $download_url
|
||||
unzip -d $dir -o $zip
|
||||
chmod +x $exe
|
||||
rm $zip
|
||||
|
||||
echo "Holesail proxy was installed to $runtimer_exe"
|
||||
if command -v holesail-proxy > /dev/null; then
|
||||
echo "Run 'holesail-proxy --help' to get started"
|
||||
else
|
||||
case $SHELL in
|
||||
/bin/zsh) shell_profile=".zshrc" ;;
|
||||
*) shell_profile=".bashrc" ;;
|
||||
esac
|
||||
echo "export PATH=\"$dir:\$PATH\"" >> $HOME/$shell_profile
|
||||
fi
|
Reference in New Issue
Block a user