Skip to content

Commit af52c2d

Browse files
authored
refactor: update n0des.sh (#378)
* Add target selection * Change target labels to match rustc for simplicity (needs n0-computer/n0des#374) * Print error message for unsupported targets * Do not download if HTTP status code is not 200 * Make downloaded binary executable
1 parent f4248de commit af52c2d

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

public/n0des.sh

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,30 @@ else
1010
tag="latest"
1111
fi
1212

13-
target="linux-amd64"
13+
# Get target from environment
14+
if [ "$OS" = "Windows_NT" ]; then
15+
target="windows-x86_64"
16+
else
17+
case $(uname -sm) in
18+
"Darwin x86_64") target="darwin-x86_64" ;;
19+
"Darwin arm64") target="darwin-aarch64" ;;
20+
"Linux arm64"|"Linux aarch64") target="linux-aarch64" ;;
21+
"Linux x86_64") target="linux-x86_64" ;;
22+
*) target="linux-x86_64" ;;
23+
esac
24+
fi
1425

15-
release_url="https://vorc.s3.us-east-2.amazonaws.com/n0des-${target}-${tag}"
26+
# Skip unsupported targets
27+
case "$target" in
28+
"darin-x68_64"|"linux-aarch64"|"windows-x86_64")
29+
echo "Platform $target is not yet supported. Please open an issue if you need support for this platform."
30+
exit 1
31+
;;
32+
esac
1633

34+
release_url="https://vorc.s3.us-east-2.amazonaws.com/n0des-${target}-${tag}"
1735

1836
echo "Downloading n0des for $target with tag $tag to ./n0des"
19-
curl "$release_url" -o ./n0des
37+
curl "$release_url" -f -o ./n0des
38+
chmod a+x ./n0des
39+
echo "Downloaded. Run the n0des CLI by executing ./n0des --help"

0 commit comments

Comments
 (0)