Skip to content

Commit

Permalink
On installe TeXLive Vanilla et les paquets LaTeX à partir de latex-te…
Browse files Browse the repository at this point in the history
…mplate

- 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
  • Loading branch information
Situphen committed Apr 19, 2021
1 parent 01f2d86 commit 408dec4
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 95 deletions.
10 changes: 9 additions & 1 deletion roles/latex/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
58 changes: 39 additions & 19 deletions roles/latex/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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 }}/
Expand Down Expand Up @@ -55,6 +75,6 @@
- Regular
- Semibold
- SemiboldIt
notify: refresh font-config cache
tags:
- bootstrap
notify: refresh font-config cache
59 changes: 20 additions & 39 deletions roles/latex/tasks/packages.yml
Original file line number Diff line number Diff line change
@@ -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"
31 changes: 31 additions & 0 deletions roles/latex/templates/texlive.profile
Original file line number Diff line number Diff line change
@@ -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
39 changes: 3 additions & 36 deletions roles/latex/vars/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 408dec4

Please sign in to comment.