mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-25 03:00:05 +00:00
92 lines
2.8 KiB
Bash
92 lines
2.8 KiB
Bash
#!/bin/bash
|
|
# Description: Document typesetting
|
|
set -e
|
|
|
|
__tex_init="tlmgr init-usertree"
|
|
__tex_info="tlmgr --usermode info --only-installed"
|
|
__tex_install="tlmgr --usermode install"
|
|
__tex_index="texhash"
|
|
|
|
case "$_PLATFORM" in
|
|
darwin)
|
|
_recipe brew
|
|
_brew_cask mactex
|
|
;;
|
|
arch)
|
|
# Install texlive if it isn't already available (e.g. a local or
|
|
# portable installation).
|
|
if ! command -v tlmgr >/dev/null; then
|
|
_recipe _arch
|
|
_pacman texlive-bibtexextra
|
|
_pacman texlive-core
|
|
_pacman texlive-fontsextra
|
|
_pacman texlive-formatsextra
|
|
_pacman texlive-games
|
|
_pacman texlive-humanities
|
|
_pacman texlive-latexextra
|
|
_pacman texlive-music
|
|
_pacman texlive-pictures
|
|
_pacman texlive-pstricks
|
|
_pacman texlive-publishers
|
|
_pacman texlive-science
|
|
_yay tllocalmgr-git
|
|
__tex_init=""
|
|
__tex_info="tllocalmgr info --localsearch"
|
|
__tex_install="yes | tllocalmgr install"
|
|
else
|
|
echo "[tex] Texlive appears to already be installed, skipping."
|
|
fi
|
|
;;
|
|
debian)
|
|
_recipe _apt
|
|
# Install texlive if it isn't already available (e.g. a local or
|
|
# portable installation).
|
|
if ! command -v tlmgr >/dev/null; then
|
|
_ppa jonathonf/texlive
|
|
_apt texlive-full
|
|
else
|
|
echo "[tex] Texlive appears to already be installed, skipping."
|
|
fi
|
|
# xzdec is required by tlmgr
|
|
_apt xzdec
|
|
esac
|
|
|
|
_run "[tex] Initializing user database" $__tex_init 2>/dev/null || /bin/true
|
|
|
|
function _tex {
|
|
local pkg=$1
|
|
if ! $__tex_info $pkg | grep -i '^installed:.*Yes$' >/dev/null 2>&1; then
|
|
_run "[tex] Install $pkg" bash -c "$__tex_install $@"
|
|
else
|
|
echo "[tex] $pkg is already installed, skipping."
|
|
fi
|
|
}
|
|
|
|
function _tex_git {
|
|
local pkg=$1
|
|
local repo=$2
|
|
local repo_path=$3
|
|
local clone_path="$(kpsewhich -var-value TEXMFHOME)/git/latex/${pkg}"
|
|
local install_parent="$(kpsewhich -var-value TEXMFHOME)/tex/latex"
|
|
local install_path="${install_parent}/${pkg}"
|
|
if [[ ! -d "${install_path}" ]]; then
|
|
_git $2 "$(kpsewhich -var-value TEXMFHOME)/git/latex/${pkg}"
|
|
_run "[tex] Install $pkg" mkdir -p "${install_parent}" && ln -s "${clone_path}/${repo_path}" "${install_path}"
|
|
else
|
|
echo "[tex] $pkg is already installed, skipping."
|
|
fi
|
|
}
|
|
|
|
_tex labbook
|
|
_tex mdframed
|
|
_tex microtype
|
|
_tex minted
|
|
_tex soul
|
|
_tex tufte-latex
|
|
|
|
_recipe git
|
|
_tex_git dnd https://github.com/evanbergeron/DND-5e-LaTeX-Template.git
|
|
_tex_git trek https://github.com/lancelet/beamer-trek.git theme
|
|
_tex_git moderncv https://github.com/moderncv/moderncv.git
|
|
|
|
_run "[tex] Indexing packages" $__tex_index
|