-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
36 lines (28 loc) · 844 Bytes
/
installer.sh
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
#!/bin/bash
SUPPORTED_PLATFORMS=("linux-arm64" "linux-amd64" "darwin")
# check if platform is set
if [ -z "$PLATFORM" ]; then
echo "Error: PLATFORM not set."
exit 1
fi
# Check if the platform is supported
supported=false
for supported_platform in "${SUPPORTED_PLATFORMS[@]}"; do
if [ "$PLATFORM" == "$supported_platform" ]; then
supported=true
fi
done
if [ "$supported" == "false" ]; then
echo "Error: Platform '$PLATFORM' not supported."
echo "Supported platforms:" "${SUPPORTED_PLATFORMS[@]}"
exit 1
fi
echo "Downloading the clocks binary for $PLATFORM"
echo "This may take a few seconds..."
curl -s https://api.github.com/repos/prnvbn/clocks/releases/latest \
| grep "browser_download_url" \
| cut -d : -f 2,3 \
| tr -d \" \
| grep "$PLATFORM" \
| xargs -I{} curl -o clocks -sL {}
chmod +x clocks