Quote:
Originally Posted by Geremia
|
And Kovid fixed that. See here:
Official calibre PPA? where we discussed updating via a script using that check.
This thread also has a nice elegant way of checking if there is an update available -- Kovid helped us thrash it out.
Here it is:
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
killall calibre calibre-server
sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main(install_dir='/opt')"
fi