Commit ef2b0260 authored by julian.gethmann's avatar julian.gethmann

Make LaTeX fonts more stateless and work with `su`

* LaTeXfonts' tasks only run if necessary
* They run with 'sudo su -c ' so the problem with sudo and su is worked
around.
*
parent ecc10f5e
--- ---
# should be more stateless... - name: Check for getnonfreefonts
command: /usr/local/bin/getnonfreefonts-sys --version
register: gnff_available
changed_when: gnff_available.rc != 0
ignore_errors: yes
- name: Download common MS fonts - name: Download common MS fonts
get_url: dest=/tmp/ url=https://www.tug.org/fonts/getnonfreefonts/install-getnonfreefonts mode=777 get_url:
dest: /tmp/
url: "https://www.tug.org/fonts/getnonfreefonts/install-getnonfreefonts"
mode: 777
register: tex_fonts_dl_ok register: tex_fonts_dl_ok
when: gnff_available.changed
- name: Install getnonfreefonts - name: Install getnonfreefonts
environment: environment:
PATH: "{{ lookup('env', 'PATH') }}" PATH: "{{ lookup('env', 'PATH') }}"
become: yes become: yes
command: /tmp/install-getnonfreefonts command: /tmp/install-getnonfreefonts
when: gnff_available.changed
register: gnff_downloaded
- name: Check installed fonts
become: yes
command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -l | grep 'not installed'"
register: all_fonts
changed_when: all_fonts.rc == 0
ignore_errors: yes
- name: Install all TeX fonts - name: Install all TeX fonts
environment: environment:
PATH: "{{ lookup('env', 'PATH') }}" PATH: "{{ lookup('env', 'PATH') }}"
become: yes become: yes
command: getnonfreefonts-sys -a command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -a"
when: all_fonts.changed
- name: Register all TeX fonts - name: Register all TeX fonts
environment: environment:
PATH: "{{ lookup('env', 'PATH') }}" PATH: "{{ lookup('env', 'PATH') }}"
become: yes become: yes
command: getnonfreefonts-sys -r command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -r"
when: all_fonts.changed
- name: cleanup - name: cleanup
file: file:
...@@ -28,3 +48,4 @@ ...@@ -28,3 +48,4 @@
dest: "/tmp/{{ item }}" dest: "/tmp/{{ item }}"
with_items: with_items:
- install-getnonfreefonts - install-getnonfreefonts
when: gnff_downloaded.changed
...@@ -3,15 +3,17 @@ ...@@ -3,15 +3,17 @@
# not tested yet # not tested yet
- name: Install Fedora's LaTeX - name: Install Fedora's LaTeX
dnf: name=texlive state=installed
become: yes become: yes
dnf:
name: texlive
state: installed
tags: latex tags: latex
- name: Install LaTeX subpackages - name: Install LaTeX subpackages
become: yes
dnf: dnf:
name: "{{ item }}" name: "{{ item }}"
state: latest state: installed
become: yes
with_items: "{{ texlivepackages }}" with_items: "{{ texlivepackages }}"
when: ansible_distribution == "Fedora" when: ansible_distribution == "Fedora"
......
--- ---
- name: create destination directories
become: yes
file:
path: "/usr/share/texlive/texmf-local/{{ item }}/latex/uniinput"
state: directory
mode: 0755
with_items:
- tex
- doc
register: uniinputdir
- name: download uniinput - name: download uniinput
get_url: get_url:
url: "{{ item }}" url: "{{ item }}"
...@@ -6,11 +17,13 @@ ...@@ -6,11 +17,13 @@
with_items: with_items:
- "http://wiki.neo-layout.org/export/HEAD/latex/Standard-LaTeX/uniinput.dtx" - "http://wiki.neo-layout.org/export/HEAD/latex/Standard-LaTeX/uniinput.dtx"
- "http://wiki.neo-layout.org/export/HEAD/latex/Standard-LaTeX/uniinput.ins" - "http://wiki.neo-layout.org/export/HEAD/latex/Standard-LaTeX/uniinput.ins"
when: uniinputdir.changed
- name: compile package docu - name: compile package docu
command: pdflatex -interaction=nonstopmode uniinput.dtx command: pdflatex -interaction=nonstopmode uniinput.dtx
args: args:
chdir: /tmp chdir: /tmp
creates: /tmp/uniinput.pdf
ignore_errors: yes ignore_errors: yes
- name: compile package - name: compile package
...@@ -19,16 +32,6 @@ ...@@ -19,16 +32,6 @@
chdir: /tmp chdir: /tmp
creates: /tmp/uniinput.sty creates: /tmp/uniinput.sty
- name: create destination directories
file:
path: "/usr/share/texlive/texmf-local/{{ item }}/latex/uniinput"
state: directory
mode: 0755
with_items:
- tex
- doc
become: yes
- name: move style to LaTeX dir - name: move style to LaTeX dir
become: yes become: yes
copy: copy:
...@@ -39,7 +42,7 @@ ...@@ -39,7 +42,7 @@
- name: move docu to LaTeX dir - name: move docu to LaTeX dir
become: yes become: yes
copy: copy:
src: /tmp/uniinput.pdf src: /tmp/uniinput.pdf
dest: "/usr/share/texlive/texmf-local/doc/latex/uniinput/" dest: "/usr/share/texlive/texmf-local/doc/latex/uniinput/"
remote_src: yes remote_src: yes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment