Script to automatically update deb version of filebot

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
dirtycajunrice
Posts: 6
Joined: 20 May 2016, 16:20

Script to automatically update deb version of filebot

Post 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
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script to automatically update deb version of filebot

Post 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.
:idea: Please read the FAQ and How to Request Help.
dirtycajunrice
Posts: 6
Joined: 20 May 2016, 16:20

Re: Script to automatically update deb version of filebot

Post by dirtycajunrice »

Did not know this existed! i will look into this and update. Thanks rednoah!
Post Reply