Skip to content

Commit

Permalink
feat: Rename binaries at the end of installation
Browse files Browse the repository at this point in the history
  • Loading branch information
thepluck committed Oct 9, 2024
1 parent dbb13e7 commit 91876d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions foundryup-zksync/foundryup-zksync
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -eo pipefail

BASE_DIR=${XDG_CONFIG_HOME:-$HOME}
FOUNDRY_DIR=${FOUNDRY_DIR:-"$BASE_DIR/.foundry"}
FOUNDRY_DIR=${FOUNDRY_DIR:-"$BASE_DIR/.foundry-zksync"}
FOUNDRY_BIN_DIR="$FOUNDRY_DIR/bin"
FOUNDRY_MAN_DIR="$FOUNDRY_DIR/share/man/man1"

Expand Down Expand Up @@ -186,7 +186,7 @@ EOF
FOUNDRYUP_BRANCH=${FOUNDRYUP_BRANCH:-main}
REPO_PATH="$FOUNDRY_DIR/$FOUNDRYUP_REPO"

# If repo path does not exist, grab the author from the repo, make a directory in .foundry, cd to it and clone.
# If repo path does not exist, grab the author from the repo, make a directory in .foundry-zksync, cd to it and clone.
if [ ! -d "$REPO_PATH" ]; then
AUTHOR="$(echo "$FOUNDRYUP_REPO" | cut -d'/' -f1 -)"
ensure mkdir -p "$FOUNDRY_DIR/$AUTHOR"
Expand All @@ -205,7 +205,7 @@ EOF
ensure git checkout "$FOUNDRYUP_COMMIT"
fi

# Build the repo and install the binaries locally to the .foundry bin directory.
# Build the repo and install the binaries locally to the .foundry-zksync bin directory.
ensure cargo build --bins "${CARGO_BUILD_ARGS[@]}"
for bin in "${BINS[@]}"; do
for try_path in target/release/$bin target/release/$bin.exe; do
Expand All @@ -225,6 +225,10 @@ EOF

say "done"
fi

for bin in "${BINS[@]}"; do
mv "$FOUNDRY_BIN_DIR/$bin" "$FOUNDRY_BIN_DIR/$bin-zksync"
done
}

usage() {
Expand Down
4 changes: 2 additions & 2 deletions foundryup-zksync/install
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ set -eo pipefail
echo "Installing foundryup-zksync..."

BASE_DIR="${XDG_CONFIG_HOME:-$HOME}"
FOUNDRY_DIR="${FOUNDRY_DIR-"$BASE_DIR/.foundry"}"
FOUNDRY_DIR="${FOUNDRY_DIR-"$BASE_DIR/.foundry-zksync"}"
FOUNDRY_BIN_DIR="$FOUNDRY_DIR/bin"
FOUNDRY_MAN_DIR="$FOUNDRY_DIR/share/man/man1"

BIN_URL="https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/foundryup-zksync/foundryup-zksync"
BIN_PATH="$FOUNDRY_BIN_DIR/foundryup-zksync"

# Create the .foundry bin directory and foundryup binary if it doesn't exist.
# Create the .foundry-zksync bin directory and foundryup binary if it doesn't exist.
mkdir -p "$FOUNDRY_BIN_DIR"
curl -sSf -L "$BIN_URL" -o "$BIN_PATH"
chmod +x "$BIN_PATH"
Expand Down
4 changes: 2 additions & 2 deletions install-foundry-zksync
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set -e

# URLs to the raw files on GitHub
INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/foundryup-zksync/install"
FOUNDRYUP_ZKSYNC_URL="https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/foundryup-zksync/foundryup-zksync"
INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/KyberNetwork/foundry-zksync/main/foundryup-zksync/install"
FOUNDRYUP_ZKSYNC_URL="https://raw.githubusercontent.com/KyberNetwork/foundry-zksync/main/foundryup-zksync/foundryup-zksync"

# Download the install script
echo "Downloading the install script..."
Expand Down

0 comments on commit 91876d4

Please sign in to comment.