Files
AutoLTX/setupFiles/install.sh

37 lines
1.2 KiB
Bash

#! /bin/bash
# Adapted from github.com/gkilleen33/overleaf-offline under the MIT license
# CD into the main directory
cd /app/project || exit 2
if test -d "pdf/"; then
rm -r pdf/
fi
# Update old installation
if test -f ".autoltxXenon"; then # Intentional wrong file name checking, to ensure the files are updated everytime the container starts. To implement version checking in later version.
echo AutoLTX already installed, skipping steup
else
if test -f ".gitignore"; then
# Adding build files to .gitignore
grep -qxF 'pdf/' .gitignore || echo 'pdf/' >> .gitignore
grep -qxF 'latexmkrc' .gitignore || echo 'latexmkrc' >> .gitignore
grep -qxF 'compile.sh' .gitignore || echo 'compile.sh' >> .gitignore
grep -qxF '.autoltx' .gitignore || echo '.autoltx' >> .gitignore
grep -qxF 'output.pdf' .gitignore || echo 'output.pdf' >> .gitignore
touch .autoltx
echo Configuring AutoLTX for this project
else
# Creating .gitignore file
printf 'pdf/\nlatexmkrc\ncompile.sh\n.autoltx\noutput.pdf\n' >> .gitignore
touch .autoltx
fi
# Add latexmk rc file to build files
cp /app/setupFiles/latexmkrc /app/project/
# Add compile script to build files
cp /app/setupFiles/compile.sh /app/project
chmod +x compile.sh
fi