11#! /bin/bash
22
3+ # Check if version argument is provided
4+ if [ $# -ne 1 ]; then
5+ echo " Usage: $0 <version>"
6+ echo " Example: $0 1.0.0 or $0 v1.0.0"
7+ exit 1
8+ fi
9+
10+ # Get the version argument
11+ VERSION=$1
12+
13+ # Remove 'v' prefix if it exists, then add it back in the proper format
14+ VERSION_CLEAN=${VERSION# v}
15+ VERSION_PROPER=" v${VERSION_CLEAN} "
16+
17+ # Construct the download URL
18+ DOWNLOAD_URL=" https://github.com/VU-ASE/rover/releases/download/${VERSION_PROPER} /roverd"
19+
320# This script will download the latest version of roverd and install it.
421# It pauses the roverd service in the process. Make sure not to quite
522# the script at any time while it is running.
@@ -10,15 +27,16 @@ ROVERD_PATH=/usr/local/bin/roverd
1027sudo rm $TEMP_FILE 2> /dev/null
1128
1229>&2 echo " Downloading latest roverd"
13- sudo curl -Lo " $TEMP_FILE " https://github.com/VU-ASE/roverd/releases/latest/download/roverd > /dev/null 2>&1
30+ sudo curl -Lo " $TEMP_FILE " " $DOWNLOAD_URL " > /dev/null 2>&1
1431
1532file_output=$( file " $TEMP_FILE " )
1633echo " File command output: $file_output "
1734
1835# Check if the file output contains ARM64 indicators
1936if ! echo " $file_output " | grep -q " ARM aarch64" && ! echo " $file_output " | grep -q " arm64" ; then
2037 echo " Error: File does not appear to be an ARM64 executable"
21- echo " This means that the release page is currently building. Try again in 10 minutes!"
38+ echo " This either means that release page is currently building (try again in 10 minutes!)"
39+ echo " or it means that the version supplied does not exist"
2240 exit 1
2341fi
2442
0 commit comments