@@ -25,14 +25,26 @@ fail() { printf "${RED}✗${NC} %s\n" "$1"; exit 1; }
2525info () { printf " ${BLUE} ℹ${NC} %s\n" " $1 " ; }
2626
2727# ── Constants ────────────────────────────────────────────────
28+ FOUNDRY_VERSION=" v1.6.0-rc1"
29+ PYENV_VERSION=" v2.5.3"
2830CASSANDRA_VERSION=" 5.0.6"
2931PYTHON_VERSION=" 3.11.15"
3032PYENV_ROOT=" ${PYENV_ROOT:- $HOME / .pyenv} "
3133PYTHON_BIN=" ${PYENV_ROOT} /versions/${PYTHON_VERSION} /bin/python3"
3234CASSANDRA_URL=" https://dlcdn.apache.org/cassandra/${CASSANDRA_VERSION} /apache-cassandra-${CASSANDRA_VERSION} -bin.tar.gz"
3335CASSANDRA_DIR=" $HOME /.foc-devnet/artifacts/cassandra"
36+ FOUNDRY_DIR=" $HOME /.foc-devnet/artifacts/foundry/bin"
3437CASSANDRA_HOME=" ${CASSANDRA_DIR} /apache-cassandra-${CASSANDRA_VERSION} "
3538
39+ verify_checksum () {
40+ local file=" $1 " expected=" $2 "
41+ local actual
42+ actual=$( sha256sum " $file " | awk ' {print $1}' )
43+ if [[ " $actual " != " $expected " ]]; then
44+ fail " Checksum mismatch for $file (got $actual , want $expected )"
45+ fi
46+ }
47+
3648# ── 0. Verify basic system tools ────────────────────────────
3749info " Checking basic system tools..."
3850
4759# ── 1. Foundry (cast / forge) ───────────────────────────────
4860info " Checking Foundry..."
4961
50- if command -v cast & > /dev/null; then
51- pass " Foundry already installed (cast @ $( command -v cast) )"
62+ CAST=" $FOUNDRY_DIR /cast"
63+
64+ if [[ -x " $CAST " ]]; then
65+ pass " Foundry already installed (cast @ $CAST )"
5266else
53- info " Installing Foundry..."
54- curl -sSL https://foundry.paradigm.xyz | bash
55- export PATH=" $HOME /.foundry/bin:$PATH "
56- " $HOME /.foundry/bin/foundryup"
57- if command -v cast & > /dev/null; then
67+ info " Installing Foundry ${FOUNDRY_VERSION} to $FOUNDRY_DIR ..."
68+ mkdir -p " $FOUNDRY_DIR "
69+ ARCH=" $( uname -m) "
70+ case " $ARCH " in
71+ x86_64) ARCH=" amd64" ;;
72+ aarch64|arm64) ARCH=" arm64" ;;
73+ * ) fail " Unsupported architecture: $ARCH " ;;
74+ esac
75+ OS=" $( uname -s | tr ' [:upper:]' ' [:lower:]' ) "
76+ TARBALL_NAME=" foundry_${FOUNDRY_VERSION} _${OS} _${ARCH} .tar.gz"
77+ TARBALL_URL=" https://github.com/foundry-rs/foundry/releases/download/${FOUNDRY_VERSION} /${TARBALL_NAME} "
78+ TARBALL_PATH=" /tmp/${TARBALL_NAME} "
79+ info " Downloading $TARBALL_URL "
80+ curl -fsSL -o " $TARBALL_PATH " " $TARBALL_URL "
81+ tar -xzf " $TARBALL_PATH " -C " $FOUNDRY_DIR "
82+ rm -f " $TARBALL_PATH "
83+ if [[ -x " $CAST " ]]; then
5884 pass " Foundry installed successfully"
5985 else
60- fail " Foundry installation failed — cast not found on PATH "
86+ fail " Foundry installation failed — cast not found at $CAST "
6187 fi
6288fi
6389
74100 if [[ -x " ${PYENV_ROOT} /bin/pyenv" ]]; then
75101 export PATH=" ${PYENV_ROOT} /bin:$PATH "
76102 else
77- info " Installing pyenv..."
78- curl -fsSL https://pyenv.run | bash
103+ info " Installing pyenv ${PYENV_VERSION} from GitHub tarball..."
104+ PYENV_TARBALL=" /tmp/pyenv-${PYENV_VERSION} .tar.gz"
105+ curl -fsSL -o " $PYENV_TARBALL " \
106+ " https://github.com/pyenv/pyenv/archive/refs/tags/${PYENV_VERSION} .tar.gz"
107+ mkdir -p " ${PYENV_ROOT} "
108+ tar -xzf " $PYENV_TARBALL " -C " ${PYENV_ROOT} " --strip-components=1
109+ rm -f " $PYENV_TARBALL "
79110 export PATH=" ${PYENV_ROOT} /bin:$PATH "
80111 fi
81112 fi
0 commit comments