-
Notifications
You must be signed in to change notification settings - Fork 180
/
install_texlive.sh
executable file
·126 lines (112 loc) · 2.62 KB
/
install_texlive.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
set -e
if [[ -x "/usr/bin/latex" ]]; then
echo "texlive already installed"
exit 0
fi
CTAN_REPO=${1:-${CTAN_REPO:-"https://mirror.ctan.org/systems/texlive/tlnet"}}
ARCH=$(uname -m)
# a function to install apt packages only if they are not installed
function apt_install() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
apt-get update
fi
apt-get install -y --no-install-recommends "$@"
fi
}
cat <<EOF >/tmp/texlive-profile.txt
selected_scheme scheme-infraonly
TEXDIR /usr/local/texlive
TEXMFCONFIG /opt/texlive/texmf-config
TEXMFHOME /opt/texlive/texmf
TEXMFLOCAL /opt/texlive/texmf-local
TEXMFSYSCONFIG /opt/texlive/texmf-config
TEXMFSYSVAR /opt/texlive/texmf-var
TEXMFVAR /opt/texlive/texmf-var
option_doc 0
option_src 0
EOF
export PATH="${PATH}:/usr/local/texlive/bin/linux/"
mkdir -p /opt/texlive
# set up packages
apt_install \
wget \
perl \
xzdec
wget "${CTAN_REPO}/install-tl-unx.tar.gz"
tar -xzf install-tl-unx.tar.gz
cd ./install-tl-20*
./install-tl --profile=/tmp/texlive-profile.txt --repository "$CTAN_REPO"
cd ..
rm -rf install-tl-*
rm /tmp/texlive-profile.txt
ln -fsr /usr/local/texlive/bin/"${ARCH}"-linux /usr/local/texlive/bin/linux
tlmgr update --self
tlmgr install latex-bin luatex xetex
tlmgr install \
ae \
amsmath \
auxhook \
bibtex \
bigintcalc \
bitset \
bookmark \
context \
ec \
epstopdf-pkg \
etexcmds \
etoolbox \
fancyvrb \
framed \
geometry \
gettitlestring \
hycolor \
hyperref \
inconsolata \
infwarerr \
intcalc \
koma-script \
kvdefinekeys \
kvoptions \
kvsetkeys \
letltxmacro \
listings \
ltxcmds \
makeindex \
mdwtools \
metafont \
mfware \
parskip \
pdfcrop \
pdfescape \
pdftexcmds \
refcount \
rerunfilecheck \
stringenc \
tex \
tikzfill \
tools \
uniquecounter \
url \
xcolor \
xkeyval \
zapfding
## do not add to /usr/local/bin
# tlmgr path add
# instead, we keep binaries separate and add to PATH
echo "PATH=${PATH}" >>"${R_HOME}"/etc/Renviron.site
## open permissions to avoid needless warnings
NON_ROOT_USER=$(getent passwd "1000" | cut -d: -f1)
if [ -n "$NON_ROOT_USER" ]; then
chown -R "${NON_ROOT_USER}":staff /opt/texlive
chown -R "${NON_ROOT_USER}":staff /usr/local/texlive
fi
chmod -R 777 /opt/texlive
chmod -R 777 /usr/local/texlive
# Clean up
rm -rf /var/lib/apt/lists/*
# Check the tlmgr version
echo -e "Check the tlmgr version...\n"
tlmgr --version
echo -e "\nInstall texlive, done!"