@@ -28,32 +28,37 @@ 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
3333done
3434
3535get_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.
4043VERSION=$( get_latest_release_number)
4144echo " Installing spp-cli $VERSION "
4245
46+ ARCHIVE_NAME=" spp-cli-$VERSION -${OS} 64.zip"
47+
4348# 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
49+ curl -sSLO " https://github.com/sourceplusplus/interface-cli/releases/download/$VERSION /$ARCHIVE_NAME " > /dev/null
50+ if [ -f " $ARCHIVE_NAME " ]; then
51+ unzip -q $ARCHIVE_NAME
4752
4853 echo " Adding spp-cli to your PATH"
4954 # Add spp-cli to the environment variable PATH.
5055 sudo mv spp-cli /usr/local/bin/spp-cli
5156
5257 # Delete unnecessary files.
53- rm " ./spp-cli- $VERSION -linux64.zip "
58+ rm " ./$ARCHIVE_NAME "
5459 echo " Installation complete."
5560
5661 echo " Type 'spp-cli --help' to get more information."
5762else
58- abort " Failed to download spp-cli- $VERSION -linux64.zip "
63+ abort " Failed to download $ARCHIVE_NAME "
5964fi
0 commit comments