diff --git a/roles/calibre/defaults/main.yml b/roles/calibre/defaults/main.yml index 8cafdb995..f135ee6f2 100644 --- a/roles/calibre/defaults/main.yml +++ b/roles/calibre/defaults/main.yml @@ -12,7 +12,7 @@ calibre_sample_book: "Metamorphosis-jackson.epub" calibre_src_url: "https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py" -# USE TO TEST debs.yml (RASPBIAN APPROACH!) ON DEBIAN 9.X -calibre_debs_on_debian: True -# enable calibre unstable -calibre_unstable: False +# USE TO TEST debs.yml (RASPBIAN APPROACH!) ON DEBIAN 9.X: (now handled by calibre_via_debs in /opt/iiab/iiab/vars/*) +#calibre_debs_on_debian: True +# Enable unstable .deb's, not just testing .deb's: (moved to vars/local_vars.yml & vars/default_vars.yml) +#calibre_unstable_debs: False diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index ad9917fce..2fdd5cfdc 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -1,24 +1,31 @@ -- name: Start by installing OS's Calibre package - package: - name: "{{ item }}" - state: latest - with_items: - - calibre - - calibre-bin - when: internet_available +# roles/calibre/tasks/main.yml requires calibre_via_debs (to be True) before calling this script. -# April 5 2018 raspbian is now tracking the latest Calibre with a small delay. -# Should you really want the latest just run the below script standalone, it is -# strongly suggested that waiting for the lastest deb from Raspbian is the best. +# MOVED UP TO roles/calibre/tasks/main.yml +#- name: Start by installing OS's Calibre package +# package: +# name: "{{ item }}" +# state: latest +# with_items: +# - calibre +# - calibre-bin +# when: internet_available -- name: Upgrade to testing Calibre - RPi +# April/May 2018: Raspbian .deb's for the latest Calibre now appear +# (http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/) +# within about 10 days of Calibre's quasi-monthly releases +# (https://calibre-ebook.com/whats-new). + +# If you want the latest Calibre, run the appropriate below script, standalone. +# HOWEVER: it's strongly suggested you wait for apt (blessed by your OS!) + +- name: Upgrade to Calibre testing .deb's - target Raspbian (rpi) command: scripts/calibre-install-latest-rpi.sh when: is_rpi and internet_available -- name: Upgrade to testing Calibre - non-RPi +- name: Upgrade to Calibre testing .deb's - target Ubuntu 16.04 (not rpi and not ubuntu_18) command: scripts/calibre-install-latest.sh when: not is_rpi and not is_ubuntu_18 and internet_available -- name: Upgrade to unstable Calibre - all +- name: Upgrade to Calibre unstable .deb's IF calibre_unstable_debs command: scripts/calibre-install-unstable.sh - when: calibre_unstable and internet_available + when: calibre_unstable_debs and internet_available diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index c09aa03ba..74c10c428 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -1,18 +1,36 @@ -# 1. INSTALL THE LATEST CALIBRE 3.X+ (calibre-server etc) ON ALL OS'S +# 1. INSTALL THE LATEST CALIBRE 3.X+ (calibre, calibredb, calibre-server etc) ON ALL OS'S -# RUNS IF /usr/bin/calibre-uninstall DOES NOT ALEADY EXIST -- name: Install Calibre via calibre-installer.py (redhat, ubuntu, debian if NOT calibre_debs_on_debian) - include_tasks: py-installer.yml - when: is_redhat or is_ubuntu or (is_debian and not calibre_debs_on_debian) - #when: not is_rpi +- name: Check if /usr/bin/calibre exists + stat: + path: "/usr/bin/calibre" + register: calib_executable -- name: Install Calibre via .debs (Raspbian, Debian if calibre_debs_on_debian) +- name: Install Calibre via OS's package installer (IF /usr/bin/calibre MISSING) + package: + name: "{{ item }}" + state: latest + with_items: + - calibre + - calibre-bin + when: internet_available and (not calib_executable.stat.exists) + +- name: Install Calibre experimental .debs IF calibre_via_debs (AND /usr/bin/calibre WAS MISSING) include_tasks: debs.yml - when: is_rpi or (is_debian and calibre_debs_on_debian) + when: calibre_via_debs and (not calib_executable.stat.exists) -#- name: Install Calibre via .debs (Ubuntu 18.xx) -# include_tasks: debs.yml -# when: is_ubuntu_18 +- name: Install Calibre via calibre-installer.py IF calibre_via_python (AND /usr/bin/calibre WAS MISSING) + include_tasks: py-installer.yml + when: calibre_via_python and (not calib_executable.stat.exists) + +# SEE calibre_via_python's value vars/default_vars.yml, vars/ubuntu-18.yml & +# vars/raspbian-9.yml: try to AVOID Python installer on Raspbian since its +# .deb's (http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/) +# are updated within about 10 days of Calibre's quasi-monthly releases! +# +# BUT IF ABSOLUTELY NEC: (SEE roles/calibre/tasks/debs.yml) +# - run testing branch for RPi: scripts/calibre-install-latest-rpi.sh +# - run testing branch for Ubuntu 16.04: scripts/calibre-install-latest.sh +# - run unstable branch for Debian etc: scripts/calibre-install-unstable.sh - name: Create calibre-serve.service and calibre.conf template: @@ -27,7 +45,7 @@ - { src: 'calibre-serve.service.j2', dest: '/etc/systemd/system/calibre-serve.service', mode: '0644'} - { src: 'calibre.conf', dest: '/etc/{{ apache_config_dir }}', mode: '0644'} -- name: Forcing systemd to reread configs +- name: Force systemd to reread configs systemd: daemon_reload: yes when: calibre_config.changed diff --git a/roles/calibre/tasks/py-installer.yml b/roles/calibre/tasks/py-installer.yml index 96c3162e5..29f9b3265 100644 --- a/roles/calibre/tasks/py-installer.yml +++ b/roles/calibre/tasks/py-installer.yml @@ -1,5 +1,7 @@ +# roles/calibre/tasks/main.yml requires calibre_via_python (to be True) before calling this script. + # Seems to work with just about any Linux (Fedora 18 on OLPC XO Laptops??) and deals with dependencies. -# But is arch dependent: requires x86_64 or i686 for now. +# BUT IS ARCH DEPENDENT: requires x86_64 or i686 as of early 2018. - name: Download latest linux-installer.py from GitHub to calibre-installer.py get_url: @@ -32,21 +34,23 @@ path: "{{ downloads_dir }}/calibre-installer.py" register: calib_inst -- name: Check if calibre-uninstall exists in /usr/bin - stat: - path: "/usr/bin/calibre-uninstall" - register: calib_uninst +# MOVED UP TO roles/calibre/tasks/main.yml (now checks for /usr/bin/calibre) +#- name: Check if calibre-uninstall exists in /usr/bin +# stat: +# path: "/usr/bin/calibre-uninstall" +# register: calib_uninst -- name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/calibre-installer.py doesn't exist OR needed Internet connection is missing +- name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/calibre-installer.py OR Internet ARE MISSING # meta: end_play fail: msg: "{{ downloads_dir }}/calibre-installer.py and an Internet connection are REQUIRED in order to install Calibre!" - when: (not calib_inst.stat.exists) or (not internet_available and not calib_uninst.stat.exists) + when: (not calib_inst.stat.exists) or (not internet_available) + #when: (not calib_inst.stat.exists) or (not internet_available and not calib_uninst.stat.exists) -# INSTALL THE LATEST CALIBRE (calibre-server etc) - RUNS IF /usr/bin/calibre-uninstall DOES NOT ALEADY EXIST +# INSTALL THE LATEST CALIBRE (calibre, calibredb, calibre-server etc) -- name: Run calibre-installer.py to install Calibre programs into /usr/bin - MANUALLY REMOVE /usr/bin/calibre-uninstall TO FORCE calibre-installer.py TO REINSTALL/UPGRADE HERE! +- name: Run calibre-installer.py to install Calibre programs into /usr/bin shell: "{{ downloads_dir }}/calibre-installer.py >> /dev/null" - args: - creates: /usr/bin/calibre-uninstall + #args: + # creates: /usr/bin/calibre-uninstall when: internet_available diff --git a/scripts/calibre-install-latest-rpi.sh b/scripts/calibre-install-latest-rpi.sh index 941f29306..a5d520bda 100755 --- a/scripts/calibre-install-latest-rpi.sh +++ b/scripts/calibre-install-latest-rpi.sh @@ -1,19 +1,23 @@ #!/bin/bash -# Thanks to Jerry Vonau (https://github.com/jvonau) who made -# this critical breakthrough (Calibre 3.x on Raspbian) possible! -# The latest available is 3.21 available from testing -# https://packages.debian.org/search?keywords=calibre -# (SEE http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/ -# OR http://archive.raspbian.org/raspbian/pool/main/c/calibre/ ?) -# Might break future updates, you have been warned. +# Thanks to Jerry Vonau (https://github.com/jvonau) who made this critical +# breakthrough possible! +# +# Calibre 3.23 is the latest available from testing as of 2018-05-10: +# +# http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/ +# http://archive.raspbian.org/raspbian/pool/main/c/calibre/ +# https://packages.debian.org/search?keywords=calibre +# http://deb.debian.org/debian/pool/main/c/calibre/ +# +# Might break future updates; you have been warned. export DEBIAN_FRONTEND=noninteractive -# Updates calibre calibre-bin to version 3.21 or ... from testing +# Prepares to update to latest from testing echo "deb http://raspbian.raspberrypi.org/raspbian/ testing main" > /etc/apt/sources.list.d/rpi-testing.list apt update apt -y install calibre calibre-bin -# Remove last line, safer than: rm /etc/apt/sources.list.d/debian-testing.list +# Removes last line, safer than: rm /etc/apt/sources.list.d/rpi-testing.list sed -i '$ d' /etc/apt/sources.list.d/rpi-testing.list # Clears the cache of testing apt update diff --git a/scripts/calibre-install-latest.sh b/scripts/calibre-install-latest.sh index aebc86ca1..37764db79 100755 --- a/scripts/calibre-install-latest.sh +++ b/scripts/calibre-install-latest.sh @@ -1,20 +1,26 @@ #!/bin/bash -# Thanks to Jerry Vonau (https://github.com/jvonau) who made -# this critical breakthrough for Calibre 3.x possible! -# The latest available is 3.20 available from testing -# https://packages.debian.org/search?keywords=calibre -# (SEE http://deb.debian.org/debian/pool/main/c/calibre/ ?) -# might break future updates, you have been warned +# Thanks to Jerry Vonau (https://github.com/jvonau) who made this critical +# breakthrough possible! +# +# Calibre 3.23 is the latest available from testing as of 2018-05-10: +# +# https://packages.debian.org/search?keywords=calibre +# http://deb.debian.org/debian/pool/main/c/calibre/ +# http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/ +# http://archive.raspbian.org/raspbian/pool/main/c/calibre/ +# +# Might break future updates; you have been warned. export DEBIAN_FRONTEND=noninteractive # Drags in stock desktop dependencies without too much from testing below -apt -y install calibre-bin dirmngr -# Updates calibre calibre-bin to version 3.20 or ... from testing +apt -y install dirmngr +# Prepares to update to latest from testing apt-key adv --recv-key --keyserver keyserver.ubuntu.com 7638D0442B90D010 echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list.d/debian-testing.list apt update -apt -y install libqt5core5a python-lxml calibre -# Remove last line, safer than: rm /etc/apt/sources.list.d/debian-testing.list +apt -y install libqt5core5a python-lxml calibre calibre-bin +# Removes last line, safer than: rm /etc/apt/sources.list.d/debian-testing.list sed -i '$ d' /etc/apt/sources.list.d/debian-testing.list +# Clears the cache of testing apt update diff --git a/scripts/calibre-install-unstable.sh b/scripts/calibre-install-unstable.sh index c27bfebf5..abb950f7c 100755 --- a/scripts/calibre-install-unstable.sh +++ b/scripts/calibre-install-unstable.sh @@ -1,18 +1,24 @@ #!/bin/bash -# Thanks to Jerry Vonau (https://github.com/jvonau) who made -# this critical breakthrough possible! -# might break future updates, you have been warned -# The latest available is 3.20 available from testing -# https://packages.debian.org/search?keywords=calibre -# might break future updates, you have been warned +# Thanks to Jerry Vonau (https://github.com/jvonau) who made this critical +# breakthrough possible! +# +# Calibre 3.23 is the latest available from testing as of 2018-05-10: +# +# https://packages.debian.org/search?keywords=calibre +# http://deb.debian.org/debian/pool/main/c/calibre/ +# http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/ +# http://archive.raspbian.org/raspbian/pool/main/c/calibre/ +# +# Might break future updates; you have been warned. export DEBIAN_FRONTEND=noninteractive -# Updates to calibre & calibre-bin to "very latest" 3.x from unstable +# Prepares to update to latest from unstable +apt-key adv --recv-key --keyserver keyserver.ubuntu.com 7638D0442B90D010 echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list.d/unstable.list apt update apt -y install calibre calibre-bin -# Remove last line, safer than: rm /etc/apt/sources.list.d/debian-unstable.list +# Removes last line, safer than: rm /etc/apt/sources.list.d/unstable.list sed -i '$ d' /etc/apt/sources.list.d/unstable.list # Clears the cache of testing and unstable apt update diff --git a/vars/centos-7.yml b/vars/centos-7.yml index 79a654af3..82b7fb824 100644 --- a/vars/centos-7.yml +++ b/vars/centos-7.yml @@ -18,3 +18,6 @@ sshd_service: sshd php_version: 7.0 postgresql_version: 9.5 systemd_location: /usr/lib/systemd/system +# Upgrade OS's own Calibre to very latest: +calibre_via_debs: False +calibre_via_python: True diff --git a/vars/debian-8.yml b/vars/debian-8.yml index 5b6153ce4..7d39b347b 100644 --- a/vars/debian-8.yml +++ b/vars/debian-8.yml @@ -18,3 +18,6 @@ sshd_service: ssh php_version: 5 postgresql_version: 9.4 systemd_location: /lib/systemd/system +# Upgrade OS's own Calibre to very latest: +calibre_via_debs: False +calibre_via_python: True diff --git a/vars/debian-9.yml b/vars/debian-9.yml index a945d779b..6477bf86f 100644 --- a/vars/debian-9.yml +++ b/vars/debian-9.yml @@ -19,5 +19,6 @@ sshd_service: ssh php_version: 7.0 postgresql_version: 9.6 systemd_location: /lib/systemd/system - - +# Upgrade OS's own Calibre to very latest: +calibre_via_debs: False +calibre_via_python: True diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 52effee23..c02f7254c 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -242,6 +242,11 @@ idmgr_enables: False calibre_install: True calibre_enabled: True +# vars/raspbian-9.yml tries the .deb upgrade of Calibre, overriding this default: +calibre_via_debs: False +calibre_unstable_debs: False +# vars/.yml try the x86_64 python upgrade of Calibre, overriding this default: +calibre_via_python: False # Change calibre_port to 8010 if you're using XO laptops needing above idmgr calibre_port: 8080 # Change calibre to XYZ add your own mnemonic URL like: http://box/XYZ diff --git a/vars/fedora-18.yml b/vars/fedora-18.yml index db8395fe9..378463b84 100644 --- a/vars/fedora-18.yml +++ b/vars/fedora-18.yml @@ -18,3 +18,6 @@ sshd_service: sshd nextcloud_install: False nextcloud_enabled: False systemd_location: /usr/lib/systemd/system +# Upgrade OS's own Calibre to very latest: +calibre_via_debs: False +calibre_via_python: True diff --git a/vars/fedora-22.yml b/vars/fedora-22.yml index f12a394c2..986a58f1b 100644 --- a/vars/fedora-22.yml +++ b/vars/fedora-22.yml @@ -14,3 +14,6 @@ mysql_service: mariadb apache_log: /var/log/httpd/access_log sshd_service: sshd systemd_location: /usr/lib/systemd/system +# Upgrade OS's own Calibre to very latest: +calibre_via_debs: False +calibre_via_python: True diff --git a/vars/medium.localvars b/vars/medium.localvars index f73dfd874..3077cfba5 100644 --- a/vars/medium.localvars +++ b/vars/medium.localvars @@ -125,6 +125,11 @@ iiab_usb_lib_show_all: True calibre_install: True calibre_enabled: True +# Try .deb upgrade of Calibre (like vars/raspbian-9.yml already does) +# calibre_via_debs: True +calibre_unstable_debs: False +# Try python x86_64 upgrade of Calibre (like vars/.yml already do) +# calibre_via_python: True # Change calibre_port to 8010 if you're using XO laptops needing above idmgr calibre_port: 8080 # Change calibre to XYZ add your own mnemonic URL like: http://box/XYZ diff --git a/vars/raspbian-8.yml b/vars/raspbian-8.yml index 1e1e42706..edbdd4606 100644 --- a/vars/raspbian-8.yml +++ b/vars/raspbian-8.yml @@ -20,3 +20,8 @@ sshd_service: ssh php_version: 5 postgresql_version: 9.4 systemd_location: /lib/systemd/system +# Upgrade Raspbian Jessie's Calibre 2.5.0: (via role/calibre/tasks/debs.yml, +# with .deb's released about 5-10 days after Calibre's quasi-monthly releases) +calibre_via_debs: True +# roles/calibre/tasks/py-installer.yml FAILS on ARM as of 2018-05-10: +calibre_via_python: False diff --git a/vars/raspbian-9.yml b/vars/raspbian-9.yml index bab3f83e0..4cc2d18b1 100644 --- a/vars/raspbian-9.yml +++ b/vars/raspbian-9.yml @@ -21,3 +21,8 @@ sshd_service: ssh php_version: 7.0 postgresql_version: 9.6 systemd_location: /lib/systemd/system +# Upgrade Raspbian Stretch's Calibre 2.75.1: (via role/calibre/tasks/debs.yml, +# with .deb's released about 5-10 days after Calibre's quasi-monthly releases) +calibre_via_debs: True +# roles/calibre/tasks/py-installer.yml FAILS on ARM as of 2018-05-10: +calibre_via_python: False diff --git a/vars/ubuntu-16.yml b/vars/ubuntu-16.yml index 741e3b012..2d1e28283 100644 --- a/vars/ubuntu-16.yml +++ b/vars/ubuntu-16.yml @@ -19,3 +19,6 @@ sshd_service: ssh php_version: 7.0 postgresql_version: 9.5 systemd_location: /lib/systemd/system +# Upgrade Ubuntu 16.04's Calibre 2.55.0 to very latest: +calibre_via_debs: False +calibre_via_python: True diff --git a/vars/ubuntu-17.yml b/vars/ubuntu-17.yml index 41fd02c1d..ac3b285c7 100644 --- a/vars/ubuntu-17.yml +++ b/vars/ubuntu-17.yml @@ -19,3 +19,6 @@ sshd_service: ssh php_version: 7.1 postgresql_version: 9.6 systemd_location: /lib/systemd/system +# Upgrade Ubuntu 17.10's Calibre 3.7.0 to very latest: +calibre_via_debs: False +calibre_via_python: True diff --git a/vars/ubuntu-18.yml b/vars/ubuntu-18.yml index c05df9cf8..9fb269ac9 100644 --- a/vars/ubuntu-18.yml +++ b/vars/ubuntu-18.yml @@ -21,3 +21,6 @@ php_version: 7.2 # "postgresql_version: 10.3" fails (too detailed for /etc/systemd/system/postgresql-iiab.service on Ubuntu 18.04) postgresql_version: 10 systemd_location: /lib/systemd/system +# Upgrade Ubuntu 18.04's Calibre 3.21.0 to very latest: +calibre_via_debs: False +calibre_via_python: True