Skip to content

Instantly share code, notes, and snippets.

@fcolista
Last active August 23, 2017 17:21
Show Gist options
  • Save fcolista/f47eaf2856a637ed9cea3bcfc6b003e6 to your computer and use it in GitHub Desktop.
Save fcolista/f47eaf2856a637ed9cea3bcfc6b003e6 to your computer and use it in GitHub Desktop.
AlpineLinux: Fix LaTex
#!/bin/sh
#
# Simple script used to get the latest laTeX package working with Alpine
# It assumes that testing repository is already added.
# If not:
# echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && apk update
#
# (c) 2017 Francesco Colista
# Email: [email protected]
#
TMP="/tmp/tlxmgr-install"
URL="ftp://ftp.tug.org/historic/systems/texlive/$(date +%Y)/"
apk info -qe texlive-full || apk add texlive-full
apk info -qe curl || apk add curl
mkdir -p $TMP && cd $TMP
curl -s $URL > /dev/null
if [ $? -ne "0" ]; then
URL="ftp://ftp.tug.org/historic/systems/texlive/$(date --date '-1 year' +%Y)/"
fi
latest_tlmgr=$(curl -s $URL | grep texmf | grep -v sha | awk '{print $9}')
latest_tlmgr_sum=$(curl -s $URL | grep texmf | grep sha512 | head -1 | awk '{print $9}' )
echo "Downloading the latest texlive-full package ..."
wget -q ${URL}${latest_tlmgr}
wget -q ${URL}${latest_tlmgr_sum}
echo "Checking integrity of $latest_tlmgr ..."
sha512sum -c $TMP/$latest_tlmgr_sum || ( echo "$latest_tlmgr is corrupted, download it again."; exit 1 )
tar -C /usr/share --strip-components=1 -xvf $latest_tlmgr
apk fix texlive
rm -rf $TMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment