Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
magecnion committed Oct 2, 2024
1 parent 4d4e79f commit c57dc50
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions zombienet/download_polkadot.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Default version and download directory
VERSION=${1:-"v1.11.0"}
DOWNLOAD_DIR=${2:-"./tmp"} # Default is tmp
DOWNLOAD_DIR=${2:-"./tmp"} # Default is the current directory

BASE_URL="https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-$VERSION"

Expand All @@ -12,36 +12,33 @@ ARTIFACTS=("polkadot" "polkadot-execute-worker" "polkadot-prepare-worker")
# Create the download directory if it doesn't exist
mkdir -p "$DOWNLOAD_DIR"

# Download each artifact if it doesn't exist
# Download each artifact, overwrite if it already exists, and set executable permission
for ARTIFACT in "${ARTIFACTS[@]}"; do
FILE_PATH="$DOWNLOAD_DIR/$ARTIFACT"
FILE_URL="$BASE_URL/$ARTIFACT"

if [ -f "$FILE_PATH" ]; then
echo "$ARTIFACT already exists, skipping download."
echo "Downloading $ARTIFACT from $FILE_URL..."
curl -L -o "$FILE_PATH" "$FILE_URL"

if [ $? -ne 0 ]; then
echo "Failed to download $ARTIFACT."
exit 1
else
echo "$ARTIFACT downloaded successfully!"
fi

# Set executable permissions
chmod u+x "$FILE_PATH"
if [ $? -eq 0 ]; then
echo "Set executable permissions for $ARTIFACT."
else
FILE_URL="$BASE_URL/$ARTIFACT"
echo "Downloading $ARTIFACT from $FILE_URL..."
curl -L -o "$FILE_PATH" "$FILE_URL"

if [ $? -eq 0 ]; then
echo "$ARTIFACT downloaded successfully!"
chmod u+x "$FILE_PATH"
else
echo "Failed to download $ARTIFACT."
fi
echo "Failed to set executable permissions for $ARTIFACT."
exit 1
fi
done

echo "All downloads complete. Files are located in $DOWNLOAD_DIR"

# Set ZOMBIENET_RELAYCHAIN_COMMAND to the polkadot binary
POLKADOT_BINARY="$DOWNLOAD_DIR/polkadot"

if [ ! -f "$POLKADOT_BINARY" ]; then
echo "Error: polkadot binary not found in $DOWNLOAD_DIR"
exit 1
fi

echo ""
echo "To set the ZOMBIENET_RELAYCHAIN_COMMAND environment variable for the polkadot binary, run the following command:"
echo "export ZOMBIENET_RELAYCHAIN_COMMAND=\"$DOWNLOAD_DIR/polkadot\""

0 comments on commit c57dc50

Please sign in to comment.