Page 1 of 1

Script to automatically update deb version of filebot

Posted: 12 Jun 2017, 07:38
by dirtycajunrice
Here is a simple script. When added to your crontab you can have the deb version of filebot updated automatically. When ran manually it can take the extra clicks and copy-pastas out of the job.

This script checks your version against the newest version on SourceForge and checks your architecture.

Link to script (in case it is updated after this post): https://github.com/DirtyCajunRice/scrip ... ebotupdate

Actual script:

Code: Select all

#!/bin/bash

baseurl='https://sourceforge.net/projects/filebot/files/filebot/'
currentver=$(filebot -version | awk '{print $2}')
currentsimple=$(sed 's/\.//g' <<< "$currentver")
newestver=$(curl -s $baseurl | grep -w "<a href\=\"/projects/filebot/files/filebot/*" |\
            cut -f6 -d'/' | awk ' NR==2{print $1}' | cut -f2 -d'_' | sed 's/\.//g')
newestsimple=$(sed 's/\.//g' <<< "$newestver")
architecture=$(uname -m)

if [ "$architecture" = "x86_64" ]; then
    arch='amd64'
elif [ "$architecture" = "i386" ] || [ "$architecture" = "i686" ]; then
    arch='i386'
elif [[ "$architecture" == *"arm"* ]]; then
    arch='armhf'
else
     echo "You are running on $architecture architecture"
     echo "This is not supported. Exiting"
     exit
fi

echo "You are currently on FileBot version $currentver"
if [ "$currentsimple" -lt "$newestsimple" ]; then
    cd /tmp || echo "Cannot change to tmp dir. Exiting" && exit
    echo "You are out of date!"
    echo "Downloading version $newestver"
    wget -q "${baseurl}FileBot_${newestver}/filebot_${newestver}_${arch}.deb"
    echo "Removing current version"
    dpkg -r filebot
    echo "Installing new version"
    dpkg -i /tmp/filebot*.deb
    echo "Cleaning up"
    rm /tmp/filebot*.deb
else
    echo "You are on the newest version. Exiting"
fi

Re: Script to automatically update deb version of filebot

Posted: 12 Jun 2017, 15:22
by rednoah
If I was building a auto-install-and-update script for generic Linux distributions, then I'd probably use the installer/portable.sh script as a foundation and take it from there:

Code: Select all

sh -xu <<< "$(curl -fsSL https://raw.githubusercontent.com/filebot/plugins/master/installer/portable.sh)"

:idea: The best solution for updates is of course to install via snap install and update via snap refresh because that'll securely provide efficient delta updates.

Re: Script to automatically update deb version of filebot

Posted: 13 Jun 2017, 04:17
by dirtycajunrice
Did not know this existed! i will look into this and update. Thanks rednoah!

Re: Script to automatically update deb version of filebot

Posted: 11 Nov 2022, 03:32
by rednoah