Created
April 19, 2024 17:23
-
-
Save elPytel/7c50ce3c99ae461cf0d112f1c140d237 to your computer and use it in GitHub Desktop.
Bash script for installing the Gamin SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# By Pytel | |
# Colors: | |
# Reset | |
NC='\033[0m' | |
# Regular Colors | |
Red='\033[0;31m' # Red | |
Green='\033[0;32m' # Green | |
Blue='\033[0;34m' # Blue | |
# Definitions | |
sdk_folder="connectiq-sdk-manager-linux" | |
sdk_file="${sdk_folder}.zip" | |
sdk_link="https://developer.garmin.com/downloads/connect-iq/sdk-manager/${sdk_file}" | |
# Install dependencies | |
dependencies=(libwebkit2gtk-4.0-dev default-jre) | |
echo -e "${Green}Installing dependencies...$NC" | |
for i in "${dependencies[@]}"; do | |
if dpkg -l | grep -q $i; then | |
echo -e "${Blue}$i$NC is already installed" | |
else | |
sudo apt-get install $i | |
fi | |
done | |
# Download SDK Manager | |
echo -e "${Green}Downloading SDK Manager...$NC" | |
wget $sdk_link -O $sdk_file \ | |
&& echo -e "${Green}SDK Manager downloaded$NC" \ | |
|| echo -e "${Red}SDK Manager download failed$NC" | |
# Unzip SDK Manager | |
echo -e "${Green}Unzipping SDK Manager...$NC" | |
unzip $sdk_file -d $sdk_folder \ | |
&& echo -e "${Green}SDK Manager unzipped$NC" \ | |
|| echo -e "${Red}SDK Manager unzip failed$NC" | |
# Install SDK Manager | |
echo -e "${Green}Installing SDK Manager...$NC" | |
sudo cp ./${sdk_folder}/bin/sdkmanager /usr/local/bin/ \ | |
&& echo -e "${Green}SDK Manager installed$NC" \ | |
|| echo -e "${Red}SDK Manager installation failed$NC" | |
sudo cp -r ./${sdk_folder}/share/sdkmanager /usr/local/share/ \ | |
&& echo -e "${Green}SDK Manager files copied$NC" \ | |
|| echo -e "${Red}SDK Manager files copy failed$NC" | |
# Clean up | |
echo -e "${Green}Cleaning up...$NC" | |
rm -rf $sdk_folder $sdk_file \ | |
&& echo -e "${Green}Clean up finished$NC" \ | |
|| echo -e "${Red}Clean up failed$NC" | |
# Done | |
echo -e "${Green}Done$NC" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment