Calibre is an e-book library manager. One of its notable features is the conversion between various e-book formats. Its fast development cycle prevent the use of apt repositories to install it. This guide describes how to install Calibre and set up a auto-update cron task.

This howto is tested on:

  • Ubuntu 19.10 Eoan Ermine

This howto is tested with these versions of the software:

  • 4.12.0

Installation

Install the software:

sudo -v \
  && command wget --no-verbose --output-document=- \
        'https://download.calibre-ebook.com/linux-installer.sh' \
       | sudo sh '/dev/stdin'

Install a anacron task to automatically update Calibre when new versions are available:

sudo -v && sudo tee '/etc/cron.daily/calibre-update' \
<<< '#!/bin/bash
# Calibre auto-updater script.

# Check if calibre is present on the system.
type "calibre" &>"/dev/null" \
  || exit 1

# Detect current version and newest version number.
newestVersion="$(wget \
    --no-check-certificate --quiet --output-document=- \
    "https://code.calibre-ebook.com/latest")"

# Return a version without trailing ".0".
# currentVersion="$(calibre --version \
#    | sed -e '\''s/^.* \([.0-9]*\))$/\1/'\'')"
currentVersion="$(grep "^[ ]*CALIBRE_VERSION = " \
     "/opt/calibre/resources/content-server/index-generated.html" \
  | cut --delimiter='\''"'\'' --fields=2)"

# Update calibre if a newer version is available.
# May generate false positives when only one version number end by ".0"
if dpkg --compare-versions "${currentVersion}" "lt" "${newestVersion}"; then
    wget --quiet --output-document=- \
        "https://download.calibre-ebook.com/linux-installer.sh" \
       | sh "/dev/stdin"
fi
'

Set the executable bit on the created cron task:

sudo chmod +x '/etc/cron.daily/calibre-update'

Bibliography

Thanks

Categories: Software

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.