Repository navigation
Expand file tree
/
Copy pathdownload_trond.sh
More file actions
executable file
·56 lines (47 loc) · 1.64 KB
/
Copy pathdownload_trond.sh
File metadata and controls
executable file
·56 lines (47 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -euo pipefail
# Configuration
REPO_OWNER="tronprotocol"
REPO_NAME="tron-docker"
RELEASE_TAG="v0.1.1"
CHECKSUM_FILE="checksums.txt"
RACKAGE_PREFIX="trond"
# Determine the OS and architecture, then set the ASSET_NAME
OS=$(uname -s)
ARCH=$(uname -m)
case "$OS" in
Linux*)
case "$ARCH" in
x86_64) ASSET_NAME="${RACKAGE_PREFIX}_${RELEASE_TAG}_Linux_x86_64.tar.gz";;
arm64) ASSET_NAME="${RACKAGE_PREFIX}_${RELEASE_TAG}_Linux_arm64.tar.gz";;
*) echo "Unsupported architecture: $ARCH"; exit 1;;
esac
;;
Darwin*)
case "$ARCH" in
x86_64) ASSET_NAME="${RACKAGE_PREFIX}_${RELEASE_TAG}_Darwin_x86_64.tar.gz";;
arm64) ASSET_NAME="${RACKAGE_PREFIX}_${RELEASE_TAG}_Darwin_arm64.tar.gz";;
*) echo "Unsupported architecture: $ARCH"; exit 1;;
esac
;;
*) echo "Unsupported OS: $OS"; exit 1;;
esac
# Download URLs
DOWNLOAD_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${RELEASE_TAG}/${ASSET_NAME}"
CHECKSUM_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${RELEASE_TAG}/${CHECKSUM_FILE}"
# Download files
echo "Downloading ${ASSET_NAME}..."
echo ${DOWNLOAD_URL}
curl -L -O "${DOWNLOAD_URL}" --fail --progress-bar
echo "Downloading checksum file..."
echo ${DOWNLOAD_URL}
curl -L -O "${CHECKSUM_URL}" --fail --progress-bar
# Verify checksum
echo "Verifying checksum..."
if ! sha256sum --check --ignore-missing "${CHECKSUM_FILE}"; then
echo "Checksum validation failed!"
exit 1
fi
echo "✅ Success! ${ASSET_NAME} is valid."
tar -xvzf ${ASSET_NAME}
echo "Download completed successfully."