Skip to content

Commit

Permalink
retry for texlive installation
Browse files Browse the repository at this point in the history
Sometimes the installation may fail due to unstable remote.
  • Loading branch information
xu-cheng committed Nov 15, 2019
1 parent 2f81acb commit db89844
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ 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 \
ghostscript \
Expand All @@ -30,7 +49,7 @@ gpg --verify ./install-tl-unx.tar.gz.sha512.asc
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
/tmp/install-tl/installer/install-tl -scheme "$scheme" -profile=/texlive.profile
retry 3 /tmp/install-tl/installer/install-tl -scheme "$scheme" -profile=/texlive.profile

# Install additional packages for non full scheme
if [ "$scheme" != "full" ]; then
Expand Down

0 comments on commit db89844

Please sign in to comment.