Skip to content

Commit 94a8410

Browse files
committed
add os
1 parent ade6238 commit 94a8410

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scripts/install.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,35 @@ check_cmd() {
2828
}
2929

3030
# Check if the commands to be used exist.
31-
for cmd in curl unzip; do
31+
for cmd in curl unzip awk; do
3232
check_cmd $cmd
3333
done
3434

3535
get_latest_release_number() {
3636
curl --silent "https://github.com/sourceplusplus/interface-cli/releases/latest" | sed 's#.*tag/\(.*\)\".*#\1#'
3737
}
3838

39+
# Convert the string to lower case.
40+
OS=$(echo $OS | awk '{print tolower($0)}')
41+
3942
# Get the latest version of spp-cli.
4043
VERSION=$(get_latest_release_number)
4144
echo "Installing spp-cli $VERSION"
4245

4346
# Download the binary package.
44-
curl -sSLO "https://github.com/sourceplusplus/interface-cli/releases/download/$VERSION/spp-cli-$VERSION-linux64.zip" > /dev/null
45-
if [ -f "spp-cli-$VERSION-linux64.zip" ]; then
46-
unzip -q spp-cli-$VERSION-linux64.zip
47+
curl -sSLO "https://github.com/sourceplusplus/interface-cli/releases/download/$VERSION/spp-cli-$VERSION-${OS}64.zip" > /dev/null
48+
if [ -f "spp-cli-$VERSION-${OS}64.zip" ]; then
49+
unzip -q spp-cli-$VERSION-${OS}64.zip
4750

4851
echo "Adding spp-cli to your PATH"
4952
# Add spp-cli to the environment variable PATH.
5053
sudo mv spp-cli /usr/local/bin/spp-cli
5154

5255
# Delete unnecessary files.
53-
rm "./spp-cli-$VERSION-linux64.zip"
56+
rm "./spp-cli-$VERSION-${OS}64.zip"
5457
echo "Installation complete."
5558

5659
echo "Type 'spp-cli --help' to get more information."
5760
else
58-
abort "Failed to download spp-cli-$VERSION-linux64.zip"
61+
abort "Failed to download spp-cli-$VERSION-${OS}64.zip"
5962
fi

0 commit comments

Comments
 (0)