User Tools

Site Tools


config:master-pdf-editor

Master PDF Editor

https://code-industry.net/free-pdf-editor/

Required dependencies

sudo apt-get install libqt5concurrent5

Create the following script in /usr/local/bin

/usr/local/bin/pdfupdate.sh
#!/bin/sh
if [ "$LOGNAME" != "root" ]
then
    echo "Master PDF Editor updater needs to be run as root!"
    exit
fi

#get latest pdf version number for qt 5.4.1 or later
url=$(curl -s "https://code-industry.net/free-pdf-editor/" \
    | grep -o -P "https://code-industry.net/public/master-pdf-editor-[.\d]+-qt5\.x86_64\.deb" | head -n 1 | cut -d '"' -f 1 | tail -n 1 )

#get latest master pdf version on web
mpe_ver=$(echo "$url" | sed 's/.*\([0-9]\.[0-9]\.[0-9][0-9]\).*/\1/')

current_mpe_v=$(dpkg -s master-pdf-editor | grep -i version)
current_mpe_ver=$(echo "$current_mpe_v" | sed 's/.*\([0-9]\.[0-9]\.[0-9][0-9]\).*/\1/')

#convert version numbers to integers for comparison
mpemv=$(echo "$mpe_ver"         | sed 's/\.//g')
mpecv=$(echo "$current_mpe_ver" | sed 's/\.//g')
if [ "$mpecv" = "" ];
then
    mpecv=0
fi
#download and install only if web version greater than current version
#if main web version doesn't exist, then install new main version
if [ "$mpemv" -gt "$mpecv" ]
then
    echo "Current Master PDF Editor version $current_mpe_ver, upgrading to version $mpe_ver"
    cd /tmp/
    wget "${url}"
    dpkg -i master-pdf-editor-${mpe_ver}-qt5.*
    rm master-pdf-editor-${mpe_ver}-qt5.*
else
    echo "Current Version $current_mpe_ver, available version $mpe_ver"
    echo "No upgrade necessary"
fi

Make it executable

sudo chmod 755 /usr/local/bin/pdfupdate.sh

Create daily cron job:

/etc/cron.daily/pdfupdate
#!/bin/sh
echo `date` >> /var/log/pdfupdate.log
/usr/local/bin/pdfupdate.sh 2>&1 >> /var/log/pdfupdate.log 
echo >> /var/log/pdfupdate.log

Make executable:

sudo chmod 755 /etc/cron.daily/pdfupdate
config/master-pdf-editor.txt · Last modified: 2023/10/12 12:01 by Wulf Rajek