Skip to content

Commit

Permalink
Merge pull request #387 from ublefo/enhance/install-texlive
Browse files Browse the repository at this point in the history
enhance: refactor texlive installation script
  • Loading branch information
macite authored Aug 2, 2022
2 parents 47977fa + f871896 commit 7638518
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions .ci-setup/texlive-install.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
#!/bin/sh
#!/bin/bash

APP_PATH=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+1] != "") { if (patharr[idx] != "/") {printf("%s/", patharr[idx]); idx++ }} }'`
APP_PATH=`cd "$APP_PATH"; pwd`
set -e
APP_PATH="$(readlink -f "$(dirname "$0")")"
TEX_COMPILER=lualatex

# See if there is a cached version of TL available
export PATH=/tmp/texlive/bin/`uname -m`-linux:$PATH
if ! command -v lualatex > /dev/null; then
# Obtain TeX Live
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
# shellcheck disable=SC2155
export PATH="/tmp/texlive/bin/$(uname -m)-linux:$PATH"
if ! command -v "$TEX_COMPILER" > /dev/null; then
echo "----------------------------------------"
echo "Downloading texlive installer archive from CTAN:"
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xzf install-tl-unx.tar.gz
cd install-tl-20*

echo "Installing using profile:"
cat ${APP_PATH}/texlive.profile

echo "----------------------------------------"
echo "Installing texlive using profile:"
cat "${APP_PATH}"/texlive.profile
echo

# Install a full texlive system
./install-tl --profile="${APP_PATH}/texlive.profile"

echo "----------------------------------------"
echo "Installing additional texlive packages:"
tlmgr install fontawesome luatextra luacode minted fvextra catchfile xstring framed lastpage

cd ..

# Keep no backups (not required, simply makes cache bigger)
tlmgr option -- autobackup 0
fi

echo "----------------------------------------"
echo "Installation complete, verifying installation of $TEX_COMPILER."
command -v "$TEX_COMPILER" >/dev/null 2>&1 || { echo >&2 "$TEX_COMPILER is not found."; exit 1; }
# Do a test compile recommended by https://www.tug.org/texlive/quickinstall.html
"$TEX_COMPILER" small2e || { echo >&2 "Failed to process test file with $TEX_COMPILER."; exit 1; }

0 comments on commit 7638518

Please sign in to comment.