forked from taikoxyz/raiko
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·97 lines (92 loc) · 2.86 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env bash
# Any error will result in failure
set -e
# report the CI image status
if [ -n "$CI" ]; then
source ./script/ci-env-check.sh
fi
# toolchain necessary to compile c-kzg in SP1/risc0
if [ -z "$1" ] || [ "$1" == "sp1" ] || [ "$1" == "risc0" ]; then
# Check if the RISC-V GCC prebuilt binary archive already exists
if [ -f /tmp/riscv32-unknown-elf.gcc-13.2.0.tar.gz ]; then
echo "riscv-gcc-prebuilt existed, please check the file manually"
else
# Download the file using wget
wget -O /tmp/riscv32-unknown-elf.gcc-13.2.0.tar.gz https://github.com/stnolting/riscv-gcc-prebuilt/releases/download/rv32i-131023/riscv32-unknown-elf.gcc-13.2.0.tar.gz
# Check if wget succeeded
if [ $? -ne 0 ]; then
echo "Failed to download riscv-gcc-prebuilt"
exit 1
fi
# Create the directory if it doesn't exist
if [ ! -d /opt/riscv ]; then
mkdir /opt/riscv
fi
# Extract the downloaded archive
tar -xzf /tmp/riscv32-unknown-elf.gcc-13.2.0.tar.gz -C /opt/riscv/
# Check if tar succeeded
if [ $? -ne 0 ]; then
echo "Failed to extract riscv-gcc-prebuilt"
exit 1
fi
fi
fi
# SGX
if [ -z "$1" ] || [ "$1" == "sgx" ]; then
# also check if sgx is already installed
if command -v gramine-sgx >/dev/null 2>&1; then
echo "gramine already installed"
else
echo "gramine not installed, installing..."
# For SGX, install gramine: https://github.com/gramineproject/gramine.
wget -O /tmp/gramine.deb https://packages.gramineproject.io/pool/main/g/gramine/gramine_1.6.2_amd64.deb
sudo apt install -y /tmp/gramine.deb
fi
fi
# RISC0
if [ -z "$1" ] || [ "$1" == "risc0" ]; then
echo "Current TERM: $TERM"
if [ -z "$TERM" ] || [ "$TERM" = "dumb" ]; then
# Set TERM to xterm-color256
echo "Setting TERM to xterm"
export TERM=xterm
fi
curl -L https://risczero.com/install | bash
if [ -z "${CI}" ] || [ ! command -v rzup &> /dev/null ]; then
PROFILE=$HOME/.bashrc
echo ${PROFILE}
source ${PROFILE}
rzup install rust 1.81.0
rzup install cpp 2024.1.5
rzup install r0vm 1.2.5
rzup install cargo-risczero 1.2.5
else
echo "/home/runner/.config/.risc0/bin" >> $GITHUB_PATH
echo $GITHUB_PATH
/home/runner/.risc0/bin/rzup --verbose install
fi
fi
# SP1
if [ -z "$1" ] || [ "$1" == "sp1" ]; then
curl -L https://sp1.succinct.xyz | bash
echo "SP1 installed"
# if [ -z "${CI}" ] || [ ! command -v sp1up &> /dev/null ]; then
# echo "Non-CI environment"
# Need to add sp1up to the path here
PROFILE=$HOME/.profile
echo ${PROFILE}
source ${PROFILE}
if command -v sp1up >/dev/null 2>&1; then
echo "sp1 found in path"
sp1up -v v4.0.0-rc.1
else
echo "sp1 not found in path"
"$HOME/.sp1/bin/sp1up" -v v4.0.0-rc.1
fi
# else
# echo "CI environment"
# source /home/runner/.bashrc
# echo "/home/runner/.sp1/bin" >> $GITHUB_PATH
# /home/runner/.sp1/bin/sp1up
# fi
fi