summaryrefslogtreecommitdiff
path: root/setup_texlive.sh
blob: 5a553b0fadd219e18a4aacb444f98669f2088e2a (plain)
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
#!/bin/bash

if [ $# -ne 1 ] && [ $# -ne 2 ]; then
    echo "This is $(basename $0). Usage:"
    echo "$(basename $0) [/path/to/texlive2019-20190410-iso/mounted] [/path/to/install/directory]"
    exit 1
fi

texlive_mount=$1
install_dir=$2

read -p "Installing TeX Live. This will *OVERWRITE* $install_dir. Continue? [y/N] " -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
    rm -rf $install_dir
    mkdir -p $install_dir

    infile=$(mktemp)
    echo "I" > $infile

    if which tlmgr
    then
        echo "I" >> $infile
    fi

    pushd $texlive_mount
    cat $infile | \
    TEXLIVE_INSTALL_PREFIX=$install_dir \
    ./install-tl -no-gui -portable -scheme full
    popd

    rm $infile

    # TeXLive will make different bin directories depending on the
    # OS; this overrides that to be just x86_64.
    tmpdir=$(mktemp -d)
    mv $install_dir/bin/*/* $tmpdir
    rm -rf $install_dir/bin/*
    mkdir $install_dir/bin/x86_64
    mv $tmpdir/* $install_dir/bin/x86_64
    rm -rf $tmpdir

    echo "Success!"
    echo "Writing Installation Directory to $HOME/.bazelrc"
    echo "build --define TEXLIVE_FULL_DIR=$install_dir" >> ~/.bazelrc
    echo "run --define TEXLIVE_FULL_DIR=$install_dir" >> ~/.bazelrc
else
    echo "Aborting."
fi
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback