View Single Post
Old 04-06-2014, 08:52 PM   #3
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
What is wrong with Kovid's one-liner?

There is a calibre-upgrade.sh here

Quote:
Originally Posted by eschwartz View Post
There is a new install command, so make sure to update calibre-upgrade.sh everyone!

(the old version has been kept up for backwards compatibility, but we wouldn't be in this thread if we were content with plebeian methodologies. )


Code:
#!/bin/bash

calibre-debug -c "import urllib as u; from calibre.constants import numeric_version; raise SystemExit(int(numeric_version  < (tuple(map(int, u.urlopen('http://calibre-ebook.com/downloads/latest_version').read().split('.'))))))"

UP_TO_DATE=$?

if [ $UP_TO_DATE = 0 ]; then
	echo "Calibre is up-to-date"
else
	calibre --shutdown-running-calibre
	killall calibre-server

	sudo -v; wget -nv -O- https://github.com/kovidgoyal/calibre/raw/master/setup/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()"
fi
And we have more goodies, like calibre-uninstall, and an "isolated" updater.
This will check for an updated version, and then it is a simple matter of running calbre-upgrade.sh in a weekly cron job. It compares calibre --version to the website version, and calls Kovid's one-liner. Nice and simple. Why didn't we make a sticky for that anyway?
eschwartz is offline   Reply With Quote