Skip to content

Commit 7f74e64

Browse files
committed
Updates to nodesh
1 parent 8ca1fe4 commit 7f74e64

File tree

1 file changed

+57
-57
lines changed
  • lib/sui/lib/assets/user-data

1 file changed

+57
-57
lines changed

lib/sui/lib/assets/user-data/node.sh

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -29,59 +29,6 @@ case $NETWORK_ID in
2929
;;
3030
esac
3131

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-
8532
# via https://github.com/Contribution-DAO/sui-node-setup
8633
# Modifications made by yinalaws in 2024
8734
# ASCII art removed for brevity, silenced interactions, added testnet p2p, Ubuntu 24.04 LTS tests
@@ -132,10 +79,63 @@ sudo apt install -y libprotobuf-dev protobuf-compiler
13279
cd $HOME
13380

13481
# Executing function that downloads official binaries from github
135-
download_sui_binaries $NETWORK_ID
136-
sudo mv ./sui-node /usr/local/bin/
137-
sudo mv ./sui /usr/local/bin/
138-
sudo mv ./sui-tool /usr/local/bin/
82+
83+
download_sui_binaries() {
84+
echo "Fetching tags for ${!NETWORK_ID}..."
85+
86+
# test with export
87+
88+
# Fetch tags using git ls-remote and filter based on the channel
89+
LATEST_TAG=$(git ls-remote --tags --refs https://github.com/MystenLabs/sui.git |
90+
awk '{print $2}' |
91+
sed 's/^refs\/tags\///' |
92+
grep "^${!NETWORK_ID}-" |
93+
sort -V |
94+
tail -n 1)
95+
96+
if [ -z "$!LATEST_TAG" ]; then
97+
echo "No matching tag found for ${!NETWORK_ID}"
98+
exit 1
99+
fi
100+
101+
echo "Latest ${!NETWORK_ID} tag: ${!LATEST_TAG}"
102+
103+
# Construct the download URL
104+
DOWNLOAD_URL="https://github.com/MystenLabs/sui/releases/download/${!LATEST_TAG}/sui-${!LATEST_TAG}-ubuntu-x86_64.tgz"
105+
106+
echo "Downloading from: ${!DOWNLOAD_URL}"
107+
108+
# Download the tar.gz file
109+
curl -L -o "sui-${!LATEST_TAG}-ubuntu-x86_64.tgz" "${!DOWNLOAD_URL}"
110+
111+
if [ $? -ne 0 ]; then
112+
echo "Failed to download the file"
113+
exit 1
114+
fi
115+
116+
echo "Download complete. Unpacking..."
117+
118+
# Unpack the tar.gz file
119+
tar -xzvf "sui-${!LATEST_TAG}-ubuntu-x86_64.tgz"
120+
121+
if [ $? -ne 0 ]; then
122+
echo "Failed to unpack the file"
123+
exit 1
124+
fi
125+
126+
echo "Unpacking complete. Cleaning up..."
127+
128+
# Remove the tar.gz file
129+
rm "sui-${!LATEST_TAG}-ubuntu-x86_64.tgz"
130+
131+
echo "Done! Sui ${!NETWORK_ID} release ${!LATEST_TAG} has been downloaded and unpacked."
132+
133+
}
134+
135+
download_sui_binaries
136+
sudo cp ./sui-node /usr/local/bin/
137+
sudo cp ./sui /usr/local/bin/
138+
sudo cp ./sui-tool /usr/local/bin/
139139

140140
# 5. Update Configs
141141
echo "[LOG] update configs"

0 commit comments

Comments
 (0)