Created
April 11, 2022 20:53
-
-
Save jar-o/1b8d3e3a29cfbe765cf6378070c0a0b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
{ # Prevent execution if this script was only partially downloaded | |
set -e | |
tmpfile=$(mktemp) | |
trap 'rm $tmpfile' EXIT | |
cat > "$tmpfile" <<'EOF' | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
NC='\033[0m' | |
oops() { | |
>&2 echo -e "${RED}error:${NC} $1" | |
exit 1 | |
} | |
#[[ "$(id -u)" -eq 0 ]] && oops "Please run this script as a regular user" | |
API_OUTPUT=$(curl -sS https://api.github.com/repos/dapphub/dapptools/releases/latest) | |
RELEASE=$(echo "$API_OUTPUT" | jq -r .tarball_url) | |
[[ $RELEASE == null ]] && oops "No release found in ${API_OUTPUT}" | |
cachix use dapp | |
command -v solc >/dev/null || solc="solc" | |
nix-env -iA dapp hevm seth ethsign "$solc" -f "$RELEASE" | |
echo -e "${GREEN}All set!${NC}" | |
EOF | |
nix-shell --pure -p cacert cachix curl git jq nix --run "bash $tmpfile" | |
} # End of wrapping | |
# vim: set ft=sh: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment