Skip to content

Instantly share code, notes, and snippets.

@robgithub
Created June 30, 2020 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robgithub/cffb1b1ef7db42316d3e59e0a937fd55 to your computer and use it in GitHub Desktop.
Save robgithub/cffb1b1ef7db42316d3e59e0a937fd55 to your computer and use it in GitHub Desktop.
Script to get the latest linux version of blender
# 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