From 9dc82c8f005d5824af1b451f8bb62cdf579bcbe6 Mon Sep 17 00:00:00 2001 From: Situphen Date: Tue, 19 May 2020 22:00:10 +0200 Subject: [PATCH] =?UTF-8?q?On=20installe=20TeXLive=20Vanilla=20et=20les=20?= =?UTF-8?q?paquets=20LaTeX=20=C3=A0=20partir=20de=20latex-template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - On utilise la dernière version de TeXLive Vanilla (sans passer par les dépôts de Debian) - On installe les paquets LaTeX à partir de latex-template - Quelques modifications cosmétiques --- .travis.yml | 2 +- roles/latex/handlers/main.yml | 10 ++++- roles/latex/tasks/main.yml | 58 +++++++++++++++++--------- roles/latex/tasks/packages.yml | 59 +++++++++------------------ roles/latex/templates/texlive.profile | 31 ++++++++++++++ roles/latex/vars/main.yml | 39 ++---------------- 6 files changed, 103 insertions(+), 96 deletions(-) create mode 100644 roles/latex/templates/texlive.profile diff --git a/.travis.yml b/.travis.yml index ff2cf9b..072ca63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ install: script: # run kitchen tests (destroy, create, converge, setup, verify and destroy) - - kitchen test + - travis_wait 30 kitchen test diff --git a/roles/latex/handlers/main.yml b/roles/latex/handlers/main.yml index b3d97d3..f045647 100644 --- a/roles/latex/handlers/main.yml +++ b/roles/latex/handlers/main.yml @@ -1,7 +1,15 @@ - name: run texhash become: true become_user: zds - shell: texhash $HOME/texmf + shell: "{{ texlive_binaries }}/texhash $HOME/texmf" - name: refresh font-config cache shell: fc-cache -f + +- name: remove texlive installation files + shell: | + rm -rf ./install-tl-*/ + rm ./texlive.profile + args: + executable: /bin/bash + chdir: "{{ workdir }}" diff --git a/roles/latex/tasks/main.yml b/roles/latex/tasks/main.yml index f073d99..d59a9ff 100644 --- a/roles/latex/tasks/main.yml +++ b/roles/latex/tasks/main.yml @@ -1,31 +1,51 @@ -- name: install texlive packages - apt: - pkg: - - texlive - - texlive-luatex - - texlive-lang-french - - texlive-latex-extra - - texlive-fonts-extra - - python-pygments - - xzdec - - wget - cache_valid_time: 3600 +- name: download latest texlive + become: true + become_user: zds + unarchive: + src: http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz + dest: "{{ workdir }}" + remote_src: yes tags: - bootstrap -- include_tasks: packages.yml +- name: copy texlive.profile + become: true + become_user: zds + template: + src: texlive.profile + dest: "{{ workdir }}/texlive.profile" tags: - bootstrap -- name: clone the template - git: - repo: "https://github.com/zestedesavoir/latex-template/" - dest: /opt/zds/texmf/tex/generic/latex-template - notify: run texhash +- name: install latest texlive + become: true + become_user: zds + shell: | + if [ -d "{{ texlive_dir }}/bin" ]; then + echo "TeXLive is already installed" + else + ./install-tl*/install-tl -v -profile texlive.profile + fi + args: + executable: /bin/bash + chdir: "{{ workdir }}" + notify: remove texlive installation files + tags: + - bootstrap + +- include_tasks: packages.yml tags: - bootstrap - upgrade +- name: install fontconfig + apt: + pkg: fontconfig + state: present + cache_valid_time: 3600 + tags: + - bootstrap + - name: create font folders file: path: /usr/local/share/fonts/{{ item[0].path }}/{{ item[1].slug }}/ @@ -55,6 +75,6 @@ - Regular - Semibold - SemiboldIt + notify: refresh font-config cache tags: - bootstrap - notify: refresh font-config cache diff --git a/roles/latex/tasks/packages.yml b/roles/latex/tasks/packages.yml index e97633e..667ba7f 100644 --- a/roles/latex/tasks/packages.yml +++ b/roles/latex/tasks/packages.yml @@ -1,52 +1,33 @@ -- name: create tlmgr usertree +- name: clone latex template become: true become_user: zds - shell: tlmgr init-usertree - args: - creates: $HOME/texmf - tags: - - bootstrap - -- name: create ansible state if non-existant - file: - path: /opt/zds/texmf/ansible-state - state: touch - mode: 0666 - tags: - - bootstrap + git: + repo: "https://github.com/zestedesavoir/latex-template/" + dest: "{{ template_dir }}" + notify: run texhash -- name: check ansible state - slurp: src=/opt/zds/texmf/ansible-state - register: installed_packages - -- name: install packages +- name: install latex packages become: true become_user: zds - shell: > - # we make sure that tlmgr repository correspond to texlive annual release - texlive_year=$(tlmgr --version) && - texlive_year=$(echo -n $texlive_year | tail -c 4) && - tlmgr option repository http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/$texlive_year/tlnet-final && - # we tell updmap to go user mode, not system mode - updmap-user && - # we update and install - tlmgr update --list && - tlmgr install {{ ' '.join(latex_packages) }} && - echo {{ ' '.join(latex_packages) }} > $HOME/texmf/ansible-state - when: installed_packages.content|b64decode|trim != latex_packages|join(" ") - tags: - - bootstrap + vars: + packages: "{{ template_dir }}/scripts/packages" + shell: | + packages=$(cat {{ packages }}) + {{ texlive_binaries }}/tlmgr update --self + {{ texlive_binaries }}/tlmgr install $packages + args: + executable: /bin/bash - name: create tabu directory + become: true + become_user: zds file: - path: /opt/zds/texmf/tex/latex/tabu/ + path: "{{ texlive_dir }}/texmf-dist/tex/latex/tabu/" state: directory - tags: - - bootstrap - name: install tabu package + become: true + become_user: zds get_url: url: https://raw.githubusercontent.com/tabu-issues-for-future-maintainer/tabu/master/tabu.sty - dest: /opt/zds/texmf/tex/latex/tabu/tabu.sty - tags: - - bootstrap + dest: "{{ texlive_dir }}/texmf-dist/tex/latex/tabu/tabu.sty" diff --git a/roles/latex/templates/texlive.profile b/roles/latex/templates/texlive.profile new file mode 100644 index 0000000..311453f --- /dev/null +++ b/roles/latex/templates/texlive.profile @@ -0,0 +1,31 @@ +# Forked from Zeste de Savoir: +# https://github.com/zestedesavoir/zds-site/blob/a16c5fc932b361cbee5c6e61b24167605e24cd8b/scripts/texlive.profile +selected_scheme scheme-small +TEXMFCONFIG $TEXMFSYSCONFIG +TEXDIR {{ texlive_dir }} +TEXMFLOCAL {{ texlive_dir }}/texmf-local +TEXMFSYSCONFIG {{ texlive_dir }}/texmf-config +TEXMFSYSVAR {{ texlive_dir }}/texmf-var +TEXMFHOME $TEXMFLOCAL +TEXMFVAR $TEXMFSYSVAR +binary_x86_64-linux 1 +collection-basic 1 +collection-latex 1 +collection-latexrecommended 1 +collection-xetex 1 +option_adjustrepo 1 +tlpdbopt_autobackup 1 +tlpdbopt_backupdir tlpkg/backups +tlpdbopt_desktop_integration +option_doc 1 +tlpdbopt_file_assocs +option_fmt 1 +option_letter 0 +option_path +tlpdbopt_post_code 1 +option_src 1 +option_sys_bin /usr/local/bin +option_sys_info /usr/local/share/info +option_sys_man /usr/local/share/man +tlpdbopt_w32_multi_user 1 +portable 1 diff --git a/roles/latex/vars/main.yml b/roles/latex/vars/main.yml index df8c8b9..190980f 100644 --- a/roles/latex/vars/main.yml +++ b/roles/latex/vars/main.yml @@ -1,39 +1,6 @@ -latex_packages: - - adjustbox - - blindtext - - capt-of - - catoptions - - chemgreek - - cm-super - - collectbox - - ctablestack - - datatool - - environ - - etoolbox - - fontspec - - framed - - fvextra - - geometry - - ifmtarg - - ifplatform - - luacode - - menukeys - - mfirstuc - - mhchem - - minted - - multirow - - ntheorem - - pagecolor - - relsize - - substr - - tcolorbox - - tracklang - - trimspaces - - varwidth - - xfor - - xifthen - - xpatch - - xstring +texlive_dir: "{{ workdir }}/texlive" +texlive_binaries: "{{ texlive_dir }}/bin/x86_64-linux" +template_dir: "{{ texlive_dir }}/texmf-dist/tex/generic/latex-template" fonttypes: - ext: otf