File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ $RepoOwner = "octra-labs"
88$RepoName = " wallet-gen"
99$InstallDir = " ${Home} \.octra"
1010$TempDir = " ${env: TEMP} \octra-wallet-gen-install"
11+ $BunInstallChecksum = " 73207f5bab5c4721a3955842867175808b8b09fe9e53aae071ea57a23f5ac61c"
1112
1213Write-Host " === ⚠️ SECURITY WARNING ⚠️ ==="
1314Write-Host " "
@@ -24,10 +25,21 @@ Write-Host ""
2425
2526function Install-Bun {
2627 if (-not (Get-Command bun - ErrorAction SilentlyContinue)) {
27- $installScript = Invoke-RestMethod - Uri ' https://bun.sh/install.ps1'
28- Invoke-Expression $installScript
29- # Add bun to PATH for the current session
30- $env: PATH = " ${Home} \.bun\bin;$ ( $env: PATH ) "
28+ $tempScriptPath = Join-Path $env: TEMP " bun-install.ps1"
29+ try {
30+ Invoke-WebRequest - Uri ' https://bun.sh/install.ps1' - OutFile $tempScriptPath - UseBasicParsing
31+
32+ if ((Get-FileHash - Path $tempScriptPath ).Hash.ToLower() -ne $BunInstallChecksum ) {
33+ Write-Host " Failed to install bun! Please install it manually from https://bun.sh"
34+ Remove-Item - Path $tempScriptPath - Force
35+ exit 1
36+ }
37+
38+ & $tempScriptPath
39+ $env: PATH = " ${Home} \.bun\bin;$ ( $env: PATH ) "
40+ } finally {
41+ Remove-Item - Path $tempScriptPath - Force
42+ }
3143 }
3244}
3345
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ REPO_OWNER="octra-labs"
66REPO_NAME=" wallet-gen"
77INSTALL_DIR=" $HOME /.octra"
88TEMP_DIR=" /tmp/octra-wallet-gen-install"
9+ BUN_INSTALL_CHECKSUM=" 144adba33c737330a081689ea5dd54c693c25d2bdb87b1f2d6aaed3c93de737e"
910
1011echo " === ⚠️ SECURITY WARNING ⚠️ ==="
1112echo " "
@@ -22,7 +23,14 @@ echo ""
2223
2324install_bun () {
2425 if ! command -v bun & > /dev/null; then
25- curl -fsSL https://bun.sh/install | bash
26+ curl -fsSL https://bun.sh/install -o /tmp/bun_install.sh
27+ if ! echo " $BUN_INSTALL_CHECKSUM /tmp/bun_install.sh" | shasum -a 256 -c -q; then
28+ echo " Failed to install bun! Please install it manually from https://bun.sh"
29+ rm -f /tmp/bun_install.sh
30+ exit 1
31+ fi
32+ bash /tmp/bun_install.sh
33+ rm -f /tmp/bun_install.sh
2634 # Set PATH to include Bun's binary directory
2735 export PATH=" $HOME /.bun/bin:$PATH "
2836 fi
You can’t perform that action at this time.
0 commit comments