Skip to content

Instantly share code, notes, and snippets.

@thibthibaut
Last active January 3, 2022 13:37
Show Gist options
  • Save thibthibaut/65bac02507db72b208ab0e4dfbb8c12b to your computer and use it in GitHub Desktop.
Save thibthibaut/65bac02507db72b208ab0e4dfbb8c12b to your computer and use it in GitHub Desktop.
stm32ai_downloader
#!/bin/bash -e
SW="stm32ai-linux-5.1.2.zip"
URL="aHR0cHM6Ly9zdy1jZW50ZXIuc3QuY29tL3BhY2tzL3gtY3ViZS1haS9zdG0zMmFpLWxpbnV4LTUuMS4yLnppcAo="
LIC_URL="https://www.st.com/content/ccc/resource/legal/legal_agreement/license_agreement/group0/eb/8e/f9/c1/9e/64/49/95/SLA0048/files/SLA0048.txt/jcr:content/translations/en.SLA0048.txt"
LIC_FILE="en.SLA0048.txt"
echo "==============================="
echo " Welcome to stm32ai_downloader "
echo "==============================="
echo "This tool downloads stm32ai command line interface."
echo "This software is under SLA0048 Licence."
# Cleanup previous installations
rm $SW 2> /dev/null || echo > /dev/null
rm $LIC_FILE 2> /dev/null || echo > /dev/null
#read -e -n 1 -s -r -p $'Press any key to download and display the licence file\x0a'
echo "Downloading licence file"
wget $LIC_URL
if [ $? -ne 0 ]; then
echo "Error downloading licence file. Exiting."
exit
fi
# Display licence
cat $LIC_FILE
echo "====================================================================================="
read -ep $'Please write "I agree" to agree with licence terms and conditions and start download\x0a> ' AGREE
if [ "$AGREE" == "I agree" ]; then
echo $URL | base64 --decode | wget -i -
echo "Extracting software, this may take a little while..."
unzip -o -qq $SW
echo "export PATH=`realpath linux`:\$PATH" > stm32ai_env.sh
echo "Done."
echo "Please run: \`source stm32ai_env.sh\` to update environement variables"
else
echo "You did not agree to the licence. Exiting"
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment