I try to make an embedded version of TeX Live. My goal is to be able to use it to compile TeX documents in a web application. I can't use system LaTeX distribution due to too old packages.
To achieve this I wrote a bash script:
#!/bin/bash
set -x
#set proxy if needed
arch=x86_64-linux
tlmgr=./texlive/bin/$arch/tlmgr
fmtutils=./texlive/bin/$arch/fmtutil
webc2=./texlive/texmf-dist/web2c/
#export http_proxy
if [ -d build ]
then
rm -rf build
fi
mkdir build
echo prepare build tree
cp texlive.profile build
pushd build
sed -i "s|%BASEDIR%|$PWD|" texlive.profile
echo download installer
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
echo extract installer
tar -xzf install-tl-unx.tar.gz
pushd install-tl-*
echo basic instalation of texlive
./install-tl -profile ../texlive.profile
popd
echo custom installation
$tlmgr list --only-installed | sed -r "s/i ([a-zA-Z0-9_\.-]+):.*/\1/" > installedPkg
cp ../pkglist pkglist
for i in $(cat pkglist)
do
if ! grep "^$i$" installedPkg
then
echo $i >> needInstall
fi
done
for i in $(cat installedPkg)
do
if ! grep "^$i$" pkglist
then
echo $i >> needRemove
fi
done
$tlmgr install $(cat needInstall)
$tlmgr remove $(cat needRemove) --force
echo regenerate format
for i in mptopdf dvilualatex luatex lualatex dviluatex etex pdfetex xetex xelatex
do
$fmtutils --disablefmt=$i --fmtdir=$webc2
done
$fmtutils --all --fmtdir=$webc2
pushd texlive/bin/*
rm pdflatex
ln -s ./pdftex pdflatex
popd
cp -R texlive ..
Actual behaviour
When I set the texlive/bin/x86_64-linux in the path, everything works fine.
If I however call the texlive/bin/x86_64-linux/pdflatex executable explicitly, system library are used (and fail).
Needed behaviour
I would like to be able to run pdfLaTeX like this:
texlive/bin/x86_64-linux/pdflatex foo.tex
Moreover, I would like this way of calling pdfLaTeX to be able to search the library in the correct path without set environment variables by hand (wrapper script can be usable).
kpsewhich language.datto search for the babel config file. Now the wrong kpsewhich might be used, and as consequence the wrong files. Easy solution is to use a wrapper that temporarily sets the PATH to include the