#!/bin/bash #Get latest vesion NewDuplicatiVer=$(curl -s https://api.github.com/repos/duplicati/duplicati/releases | grep 'tag_name.*' | grep 'beta' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |head -n 1) #Compare versions to check for update if [ "$NewDuplicatiVer" = "$(cat /opt/Duplicati-installed)" ] ; then echo 'Duplicati up-to-date' exit else echo "Updater Disabled, Newer versions not compatible" exit 123 systemctl stop duplicati rm -rf /opt/duplicati.bck mv /opt/duplicati /opt/duplicati.bck echo 'Updating Duplicati' curl -L --retry 7 --retry-delay 5 $(curl -s https://api.github.com/repos/duplicati/duplicati/releases/tags/"$NewDuplicatiVer" | grep browser_download_url | grep .zip |grep -v signatures | sed -e s#^.*https#https# | tr -d \") -o /tmp/duplicati.zip unzip /tmp/duplicati.zip -d /opt/duplicati systemctl start duplicati echo $NewDuplicatiVer > "/opt/Duplicati-installed" fi