04-07-2014, 04:27 PM | #1 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Fully automatic calibre installer/updater for linux
Growing out of this discussion: Official Calibre PPA?, here is a simple bash script to update calibre on linux.
Note: This can also perform the first-time install, since the version check returns the same failure for out-of-date as it does if there is no calibre installed. Thanks to aleyx for working on the version checking! EDIT: The script has been updated to fix a few problems. Also, you can now install the script and add the systemd timer or cron job (defaults to systemd timer, falls back on cron) by running the following one-liner in a terminal: Code:
sudo -v && wget -nv -O- https://github.com/eli-schwartz/calibre-installer/raw/master/linux/calibre-installer.sh | sudo bash - What this is doing, the manual way New code: Spoiler:
Old code: Spoiler:
Explanation: Spoiler:
Save this as "calibre-upgrade.sh" (or whatever you want) and stick it in "/usr/bin/", to add it to your path. ("$HOME/bin/" works too, but this is for a system install, so this is nicer. ) You can now update calibre by running Code:
sudo calibre-upgrade.sh Code:
0 6 * * 5 /usr/bin/calibre-upgrade.sh > /dev/null 2>&1 Code:
0 6 * * 5 /usr/bin/calibre-upgrade.sh Attached is a zip of the updater script (in a bin directory, and marked as executable), which can be extracted to "/usr/" (or $HOME) for your convenience. Last edited by eschwartz; 04-17-2016 at 06:59 PM. Reason: new script, updated instructions |
04-07-2014, 05:19 PM | #2 |
Addict
Posts: 250
Karma: 20386
Join Date: Sep 2010
Location: France
Device: Bookeen Diva, Kobo Clara BW
|
You're welcome ^_^
Some ideas: After the update one-liner, it may be useful to test for the success (or failure) of the update, then run a separate .sh containing the calibre-server command(s) for your particular libraries. That way you don't have to relaunch the servers manually. You can also use that separate .sh at boot time. Maybe also sending a mail with a little blurb (whether there was an update, whether it succeeded...) Also, between the killall and the oneliner, a backup.sh would be nice. Although anyone savvy enough to use this script should already have a nigthly backup in place, so maybe not? For those who are a little wary about messing with their crontab, just linking calibre-update.sh into /etc/cron.daily (or /etc/cron.weekly) can be an adequate solution. N. |
Advert | |
|
04-07-2014, 05:49 PM | #3 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
All kinds of frills can be used, of course. But the basics are there.
Regarding mail blurbs, just using Code:
0 6 * * 5 /usr/bin/calibre-upgrade.sh Last edited by eschwartz; 04-07-2014 at 06:14 PM. |
04-07-2014, 06:01 PM | #4 |
Addict
Posts: 250
Karma: 20386
Join Date: Sep 2010
Location: France
Device: Bookeen Diva, Kobo Clara BW
|
That's... a good point, actually.
|
05-11-2014, 10:04 AM | #5 |
Member
Posts: 12
Karma: 10
Join Date: May 2014
Device: None
|
In order to automate it have I understood the cron setup correctly?
sudo ln -s /usr/bin/calibre-upgrade.sh /etc/cron.weekly/calibre-upgrade (note i have removed the sh from the object link) I am not clear when cron.weekly will run. Is that a system operation not controlled by a cron script? |
Advert | |
|
05-11-2014, 12:00 PM | #6 | |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
The purpose of anacron is for running jobs on startup if the jobs were missed because the computer was off. You may not need that. I'd just put the command to run calibre-upgrade as a crontab job, like in the instructions. It's simpler/easier to control. Last edited by eschwartz; 05-11-2014 at 12:02 PM. |
|
05-11-2014, 09:23 PM | #7 |
null operator (he/him)
Posts: 21,014
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
05-11-2014, 09:38 PM | #8 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
|
05-11-2014, 09:53 PM | #9 |
null operator (he/him)
Posts: 21,014
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
No... by the Ghosts of Godwin and Early Burke
|
07-30-2014, 02:53 AM | #10 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I have created a github repository here: https://github.com/eli-schwartz/calibre-installer which contains an updated calibre-upgrade.sh as well as a script à la calibre's installer, which allows for a one-liner installation of the upgrade script. (Was that statement confusing enough? )
Run the following command in a terminal: Code:
sudo -v && wget -nv -O- https://github.com/eli-schwartz/calibre-installer/raw/master/linux/calibre-installer.sh | sudo sh -
If anyone has any improvement suggestions, I'd be delighted to hear them. * Because on my system it isn't -- who knew? Apparently, systemd is the wave of the future, and Arch Linux wants you to use systemd timers instead of crontabs. When I get around to it (or rather, figure out how they work ), I may write one of these timers. Meanwhile, if you are on Arch too, you can manually install a cron daemon or write your own stinking timer. (If anyone does, please share. </beg> ) Last edited by eschwartz; 02-11-2015 at 11:39 AM. Reason: updated script location |
07-30-2014, 03:01 AM | #11 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Things the new script fixes:
|
07-30-2014, 03:14 AM | #12 |
creator of calibre
Posts: 44,573
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@eschwartz: pacman -S cronie
|
07-30-2014, 03:17 AM | #13 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Of course I did this. (Weeks ago.) I even finished editing both that post and the main one, and suggested doing this, before finally noticing your post.
I had to do a bunch of edits, because I never get these right the first time around. |
09-23-2014, 09:50 AM | #14 |
Poker of bits and books
Posts: 70
Karma: 12662
Join Date: Sep 2013
Device: Kobo Glo HD, Tolino Vision 5
|
So, after running this "in production" for a few weeks, I must say, it's a great little thing.
I can only say "Thank you!" for this piece of code. Aside from a small hiccup when 2.0 came around, it ran like a mo...... from his father.... |
09-23-2014, 12:13 PM | #15 | |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
(If only my foray into duplicating this with Windows batch+powershell was nearly as fulfilling. But no, I can't even find a reliable way to download a freaking file. Forget about pogrammatically elevating to admin.) As a matter of pure curiosity, what kind of hiccup? I like perfection and this sounds like it isn't. |
|
Tags |
autoupdate, calibre, linux, systemd |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fully automatic Calibre autoupate solution (Windows) | Tscherno | Related Tools | 20 | 12-25-2021 07:55 PM |
Solution: Calibre AutoUpdater [Auto-Updater] | megamaniac | Calibre | 6 | 08-02-2013 10:47 PM |
Linux installer question | opitzs | Calibre | 2 | 11-09-2011 08:20 AM |
Either a userbug or a problem with the generic Linux binary installer. | Ingrid | Calibre | 11 | 07-16-2008 04:26 AM |