2018-05-10 20:32:44 +00:00
|
|
|
# roles/calibre/tasks/main.yml requires calibre_via_python (to be True) before calling this script.
|
2018-05-10 20:31:18 +00:00
|
|
|
|
2017-11-20 08:43:01 +00:00
|
|
|
# Seems to work with just about any Linux (Fedora 18 on OLPC XO Laptops??) and deals with dependencies.
|
2018-05-10 20:31:18 +00:00
|
|
|
# BUT IS ARCH DEPENDENT: requires x86_64 or i686 as of early 2018.
|
2017-11-20 08:43:01 +00:00
|
|
|
|
2017-11-19 20:33:53 +00:00
|
|
|
- name: Download latest linux-installer.py from GitHub to calibre-installer.py
|
|
|
|
get_url:
|
|
|
|
url: "{{ calibre_src_url }}"
|
|
|
|
dest: "{{ downloads_dir }}/calibre-installer.py"
|
|
|
|
mode: 0755
|
|
|
|
force: yes
|
|
|
|
backup: yes
|
2017-12-08 06:07:49 +00:00
|
|
|
timeout: "{{ download_timeout }}"
|
2017-11-19 20:33:53 +00:00
|
|
|
register: calibre_download_output
|
|
|
|
when: internet_available
|
|
|
|
|
|
|
|
# ALWAYS DEFINED, DESPITE get_url DOCUMENTATION CLAIM...
|
|
|
|
# - debug:
|
|
|
|
# msg: "{{ calibre_download_output.src }}"
|
|
|
|
#
|
|
|
|
# DEFINED ONLY WHEN /opt/iiab/downloads/calibre-installer.py CHANGES
|
|
|
|
# - debug:
|
|
|
|
# msg: "{{ calibre_download_output.backup_file }}"
|
|
|
|
|
|
|
|
# OOPS BAD IDEA: changes in https://github.com/kovidgoyal/calibre/commits/master/setup/linux-installer.py are not sync'd with Calibre releases!
|
|
|
|
# - name: FORCE AN UPGRADE IF calibre-installer.py HAS CHANGED, IF SO ORIGINAL IS SAVED TO {{ calibre_download_output.backup_file }}
|
|
|
|
# file:
|
|
|
|
# path: /usr/bin/calibre-uninstall
|
|
|
|
# state: absent
|
|
|
|
# when: calibre_download_output.backup_file is defined
|
|
|
|
|
|
|
|
- name: Check if calibre-installer.py exists in /opt/iiab/downloads
|
|
|
|
stat:
|
|
|
|
path: "{{ downloads_dir }}/calibre-installer.py"
|
|
|
|
register: calib_inst
|
|
|
|
|
2018-05-10 20:21:49 +00:00
|
|
|
# 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
|
2017-11-19 20:33:53 +00:00
|
|
|
|
2018-05-10 20:31:18 +00:00
|
|
|
- name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/calibre-installer.py OR Internet ARE MISSING
|
2017-11-20 09:23:29 +00:00
|
|
|
# meta: end_play
|
2017-11-19 20:33:53 +00:00
|
|
|
fail:
|
|
|
|
msg: "{{ downloads_dir }}/calibre-installer.py and an Internet connection are REQUIRED in order to install Calibre!"
|
2018-05-10 20:21:49 +00:00
|
|
|
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)
|
2017-11-19 20:33:53 +00:00
|
|
|
|
2018-05-10 20:21:49 +00:00
|
|
|
# INSTALL THE LATEST CALIBRE (calibre, calibredb, calibre-server etc)
|
2017-11-19 20:33:53 +00:00
|
|
|
|
2018-05-10 20:21:49 +00:00
|
|
|
- name: Run calibre-installer.py to install Calibre programs into /usr/bin
|
2017-11-19 20:33:53 +00:00
|
|
|
shell: "{{ downloads_dir }}/calibre-installer.py >> /dev/null"
|
2018-05-10 20:21:49 +00:00
|
|
|
#args:
|
|
|
|
# creates: /usr/bin/calibre-uninstall
|
2017-11-19 20:33:53 +00:00
|
|
|
when: internet_available
|