-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathsetup.sh
executable file
·106 lines (95 loc) · 3.05 KB
/
setup.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
#!/bin/sh
set -e
scheme="$1"
retry() {
retries=$1
shift
count=0
until "$@"; do
exit=$?
wait="$(echo "2^$count" | bc)"
count="$(echo "$count + 1" | bc)"
if [ "$count" -lt "$retries" ]; then
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
sleep "$wait"
else
echo "Retry $count/$retries exited $exit, no more retries left."
return "$exit"
fi
done
}
echo "==> Install system packages"
apk --no-cache add \
bash \
curl \
fontconfig \
ghostscript \
gnupg \
gnuplot \
git \
graphviz \
make \
openjdk21-jre-headless \
perl \
py-pygments \
python3 \
tar \
ttf-freefont \
wget \
xz
# Dependencies needed by latexindent
apk --no-cache add \
perl-unicode-linebreak \
perl-yaml-tiny
apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing add \
perl-file-homedir
echo "==> Install TeXLive"
mkdir -p /tmp/install-tl
cd /tmp/install-tl
MIRROR_URL="$(curl -fsS -w "%{redirect_url}" -o /dev/null https://mirror.ctan.org/)"
echo "Use mirror url: ${MIRROR_URL}"
curl -fsSOL "${MIRROR_URL}systems/texlive/tlnet/install-tl-unx.tar.gz"
curl -fsSOL "${MIRROR_URL}systems/texlive/tlnet/install-tl-unx.tar.gz.sha512"
curl -fsSOL "${MIRROR_URL}systems/texlive/tlnet/install-tl-unx.tar.gz.sha512.asc"
gpg --import /texlive_pgp_keys.asc
gpg --verify ./install-tl-unx.tar.gz.sha512.asc ./install-tl-unx.tar.gz.sha512
sha512sum -c ./install-tl-unx.tar.gz.sha512
mkdir -p /tmp/install-tl/installer
tar --strip-components 1 -zxf /tmp/install-tl/install-tl-unx.tar.gz -C /tmp/install-tl/installer
retry 3 /tmp/install-tl/installer/install-tl -scheme "scheme-$scheme" -profile=/texlive.profile
# Install additional packages for non full scheme
if [ "$scheme" != "full" ]; then
tlmgr install \
collection-fontsrecommended \
collection-fontutils \
biber \
biblatex \
latexmk \
texliveonfly \
xindy
fi
# https://github.com/xu-cheng/latex-action/issues/32#issuecomment-626086551
ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/xindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/xindy
ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/texindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/texindy
curl -OL https://sourceforge.net/projects/xindy/files/xindy-source-components/2.4/xindy-kernel-3.0.tar.gz
tar xf xindy-kernel-3.0.tar.gz
cd xindy-kernel-3.0/src
apk add clisp --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
make
cp -f xindy.mem /opt/texlive/texdir/bin/x86_64-linuxmusl/
cd -
# System font configuration for XeTeX and LuaTeX
# Ref: https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-330003.4.4
ln -s /opt/texlive/texdir/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf
fc-cache -fv
echo "==> Clean up"
rm -rf \
/opt/texlive/texdir/install-tl \
/opt/texlive/texdir/install-tl.log \
/opt/texlive/texdir/texmf-dist/doc \
/opt/texlive/texdir/texmf-dist/source \
/opt/texlive/texdir/texmf-var/web2c/tlmgr.log \
/setup.sh \
/texlive.profile \
/texlive_pgp_keys.asc \
/tmp/install-tl