Created
June 30, 2020 21:57
-
-
Save robgithub/cffb1b1ef7db42316d3e59e0a937fd55 to your computer and use it in GitHub Desktop.
Script to get the latest linux version of blender
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
# Download the latest version of Blender for linux if not already in folder | |
# 2020-06-29 | |
baseUrl=https://download.blender.org/release/ | |
latest=$( curl -s $baseUrl \ | |
| egrep "^<a" \ | |
| sed -re 's/^[^"]+"([^"]+)">[^>]+>\s+([^-]+)-([^-]+)-([0-9]+).+/\4-\3-\2 \1/' \ | |
-e 's/-Jan-/-01-/' \ | |
-e 's/-Feb-/-02-/' \ | |
-e 's/-Mar-/-03-/' \ | |
-e 's/-Apr-/-04-/' \ | |
-e 's/-May-/-05-/' \ | |
-e 's/-Jun-/-06-/' \ | |
-e 's/-Jul-/-07-/' \ | |
-e 's/-Aug-/-08-/' \ | |
-e 's/-Sep-/-09-/' \ | |
-e 's/-Oct-/-10-/' \ | |
-e 's/-Nov-/-11-/' \ | |
-e 's/-Dec-/-12-/' \ | |
| sort -n | tail -n 1 \ | |
| sed -re 's/\S+\s(.+)/\1/' ) | |
latestUrl="$baseUrl$latest" | |
echo looking in $latestUrl | |
latest=$( curl -s $latestUrl \ | |
| egrep "^<a" \ | |
| egrep -i "linux" \ | |
| sed -re 's/^[^"]+"([^"]+)">[^>]+>\s+([^-]+)-([^-]+)-([0-9]+).+/\4-\3-\2 \1/' \ | |
-e 's/-Jan-/-01-/' \ | |
-e 's/-Feb-/-02-/' \ | |
-e 's/-Mar-/-03-/' \ | |
-e 's/-Apr-/-04-/' \ | |
-e 's/-May-/-05-/' \ | |
-e 's/-Jun-/-06-/' \ | |
-e 's/-Jul-/-07-/' \ | |
-e 's/-Aug-/-08-/' \ | |
-e 's/-Sep-/-09-/' \ | |
-e 's/-Oct-/-10-/' \ | |
-e 's/-Nov-/-11-/' \ | |
-e 's/-Dec-/-12-/' \ | |
| sort -n | tail -n 1 \ | |
| sed -re 's/\S+\s(.+)/\1/' ) | |
latestUrl="$latestUrl$latest" | |
echo looking at $latestUrl | |
if [ ! -f "$latest" ]; then | |
wget "$latestUrl" | |
echo "You probably want to do the following now" | |
echo "tar xvf $latest" | |
blender=$(echo $latest | sed -re 's/\.tar.+$//') | |
current=$(pwd) | |
echo "ln -sf ${current}/${blender}/blender /usr/bin/blender" | |
else | |
echo "Congratulations! you already have what I have deemed to be the latest version of Blender for Linux" | |
ls -l --color=always /usr/bin/blender | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment