View Single Post
Old 11-19-2013, 01:25 PM   #24
aleyx
Groupie
aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.aleyx has met Morla.
 
Posts: 171
Karma: 19134
Join Date: Sep 2010
Location: France
Device: Cybook Orizon
Following v1.11.0, here's the corrected calibre-update.sh:
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-server
        $HOME/bin/calibre-backup.sh
        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')"
        $HOME/bin/calibre-server.sh
fi
With Kovid's one-liner for the check, the separate calibre-check.py file is now unnecessary.

Should I go back in my previous posts and remove the obsolete versions? I usually hate to delete code when there's no version control (yeah, even little snippets like those; code is code), but I don't really know if there's a policy here regarding code obsolescence.
aleyx is offline   Reply With Quote