@@ -19,6 +19,69 @@ set +e
19
19
20
20
source /etc/environment
21
21
22
+ # Validate the release channel
23
+ case $NETWORK_ID in
24
+ mainnet|testnet|devnet)
25
+ ;;
26
+ * )
27
+ echo " Invalid NETWORK_ID. Please use mainnet, testnet, or devnet."
28
+ exit
29
+ ;;
30
+ esac
31
+
32
+ download_sui_binaries () {
33
+ NETWORK_ID=$1
34
+
35
+ echo " Fetching tags for ${NETWORK_ID} ..."
36
+
37
+ # Fetch tags using git ls-remote and filter based on the channel
38
+ LATEST_TAG=$( git ls-remote --tags --refs https://github.com/MystenLabs/sui.git |
39
+ awk ' {print $2}' |
40
+ sed ' s/^refs\/tags\///' |
41
+ grep " ^${NETWORK_ID} -" |
42
+ sort -V |
43
+ tail -n 1)
44
+
45
+ if [ -z " $LATEST_TAG " ]; then
46
+ echo " No matching tag found for ${NETWORK_ID} "
47
+ exit 1
48
+ fi
49
+
50
+ echo " Latest ${NETWORK_ID} tag: ${LATEST_TAG} "
51
+
52
+ # Construct the download URL
53
+ DOWNLOAD_URL=" https://github.com/MystenLabs/sui/releases/download/${LATEST_TAG} /sui-${LATEST_TAG} -ubuntu-x86_64.tgz"
54
+
55
+ echo " Downloading from: ${DOWNLOAD_URL} "
56
+
57
+ # Download the tar.gz file
58
+ curl -L -o " sui-${LATEST_TAG} -ubuntu-x86_64.tgz" " ${DOWNLOAD_URL} "
59
+
60
+ if [ $? -ne 0 ]; then
61
+ echo " Failed to download the file"
62
+ exit 1
63
+ fi
64
+
65
+ echo " Download complete. Unpacking..."
66
+
67
+ # Unpack the tar.gz file
68
+ tar -xzvf " sui-${LATEST_TAG} -ubuntu-x86_64.tgz"
69
+
70
+ if [ $? -ne 0 ]; then
71
+ echo " Failed to unpack the file"
72
+ exit 1
73
+ fi
74
+
75
+ echo " Unpacking complete. Cleaning up..."
76
+
77
+ # Remove the tar.gz file
78
+ rm " sui-${LATEST_TAG} -ubuntu-x86_64.tgz"
79
+
80
+ echo " Done! Sui ${NETWORK_ID} release ${LATEST_TAG} has been downloaded and unpacked."
81
+
82
+ }
83
+
84
+
22
85
# via https://github.com/Contribution-DAO/sui-node-setup
23
86
# Modifications made by yinalaws in 2024
24
87
# ASCII art removed for brevity, silenced interactions, added testnet p2p, Ubuntu 24.04 LTS tests
@@ -60,9 +123,18 @@ sudo apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install
60
123
sudo apt install -y libprotobuf-dev protobuf-compiler
61
124
62
125
# 3. Install Rust
63
- echo " [LOG] install rust"
64
- sudo curl https://sh.rustup.rs -sSf | sh -s -- -y
65
- source $HOME /.cargo/env
126
+ # echo "[LOG] install rust"
127
+ # sudo curl https://sh.rustup.rs -sSf | sh -s -- -y
128
+ # source $HOME/.cargo/env
129
+
130
+ # 4. Download Sui artifacts
131
+ cd $HOME
132
+
133
+ # Executing function that downloads official binaries from github
134
+ download_sui_binaries $NETWORK_ID
135
+ sudo mv ./sui-node /usr/local/bin/
136
+ sudo mv ./sui /usr/local/bin/
137
+ sudo mv ./sui-tool /usr/local/bin/
66
138
67
139
# 4. Download Sui repository
68
140
cd $HOME
0 commit comments