Skip to content

Commit

Permalink
Merge pull request #8 from crytic/dev-install-foundry
Browse files Browse the repository at this point in the history
Install foundry on the container if required
  • Loading branch information
montyly authored May 11, 2022
2 parents dd34bc5 + 2c09fae commit aa18757
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ install_node()
popd >/dev/null
}

install_foundry()
{
if [[ -d "$TARGET" ]] && [[ -f "$TARGET/foundry.toml" ]]; then
echo "[-] Foundry target detected, installing foundry nightly"

wget -q -O foundryup https://raw.githubusercontent.com/foundry-rs/foundry/36a66c857ff148f6ed007cdcd3402077de3595cf/foundryup/foundryup
if [ ! "c0c6711dc39deae65bebcc0320fec1265930895a527e18daa643a708218c07ae foundryup" = "$(sha256sum foundryup)" ]; then
echo "Foundry installer does not match expected checksum! exiting"
exit 1
fi

export FOUNDRY_DIR="/opt/foundry"
export PATH="$FOUNDRY_DIR/bin:$PATH"
mkdir -p "$FOUNDRY_DIR/bin" "$FOUNDRY_DIR/share/man/man1"
bash foundryup
rm foundryup
fi
}

install_slither()
{
SLITHERPKG="slither-analyzer"
Expand Down Expand Up @@ -113,6 +132,14 @@ install_deps()
echo "[-] Did not find a requirements.txt, proceeding without installing Python dependencies."
fi

# Foundry dependencies
if [[ -f foundry.toml ]]; then
echo "[-] Installing dependencies from foundry.toml"
forge install
else
echo "[-] Did not find a foundry.toml, proceeding without installing Foundry dependencies."
fi

popd >/dev/null
fi
}
Expand All @@ -123,6 +150,7 @@ IGNORECOMPILEFLAG=
if [[ -z "$IGNORECOMPILE" || $IGNORECOMPILE =~ ^[Ff]alse$ ]]; then
install_solc
install_node
install_foundry
install_deps
else
IGNORECOMPILEFLAG="--ignore-compile"
Expand Down

0 comments on commit aa18757

Please sign in to comment.