-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #387 from ublefo/enhance/install-texlive
enhance: refactor texlive installation script
- Loading branch information
Showing
1 changed file
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } |