Reaper version check

This commit is contained in:
Christian Colglazier 2020-08-23 10:13:40 -04:00
parent 4bc38eadc4
commit a9c4699dae
3 changed files with 45 additions and 9 deletions

View File

@ -6,16 +6,11 @@
source $(dirname ${BASH_SOURCE[0]})/install-lib.sh
bitwig=$(dnf list | grep bitwig-studio)
bitwigVersion=$(echo $bitwig | awk '{print $2;}')
bitwigVersion=$(echo $bitwig | awk '{print $2;}'| filterVersion)
url=$(curl -s https://www.bitwig.com/en/download.html | grep .deb | grep -Po '(?<=href=")[^"]*.deb')
urlVersion=$(echo $url | awk -F "-" '{ print $3 }' | rev | cut -f 2- -d '.' | rev)
# Check if installed to the most recent version
if versionGreater $bitwigVersion $urlVersion; then
echo Bitwig is up to date. Installed version $bitwigVersion Web version $urlVersion
exit
fi
echo Installing Bitwig Studio $urlVersion
checkUptoDate Bitwig $bitwigVersion $urlVersion
# Setting up and downloading package
mkdir -p ~/Downloads/installers

View File

@ -1,4 +1,37 @@
# Program version number comparison
function versionGreater() {
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
if [[ $1 == $2 ]];then
return 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
ver1[i]=0
done
for ((i=0; i<${#ver1[@]}; i++)); do
if [[ -z ${ver2[i]} ]]; then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]})); then
return 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]})); then
return 2
fi
done
return 0
}
# Check if installed to the most recent version
function checkUptoDate() {
if versionGreater $2 $3; then
echo $1 is up to date. Installed version $2 Web version $3
exit
fi
}
function filterVersion() {
grep -Go [0-9]\.[0-9]\.[0-9]
}

View File

@ -2,9 +2,17 @@
# Automatic install script for Reaper
# Import library
source $(dirname ${BASH_SOURCE[0]})/install-lib.sh
# Get download url
reaperVersion=$(head /opt/REAPER/whatsnew.txt | grep -Go '[0-9]\.[0-9][0-9]')
reaperSite='https://www.reaper.fm/'
url=$reaperSite$(curl -s ${reaperSite}download.php | grep linux_x86_64 | grep -Po '(?<=href=")[^"]*')
downloadPage=$(curl -s ${reaperSite}download.php)
urlVersion=$(echo "$downloadPage" | grep -A 2 'Linux x86_64' | grep -Go '[0-9]\.[0-9][0-9]')
url=$reaperSite$(echo "$downloadPage" | grep linux_x86_64 | grep -Po '(?<=href=")[^"]*')
checkUptoDate Reaper $reaperVersion $urlVersion
# Setting up and downloading package
mkdir -p ~/Downloads/installers