disabled log removal, del old build files on startup, shellcheck fixes

This commit is contained in:
2025-09-16 23:05:02 +05:30
parent 46840801af
commit 98fb6893a2
3 changed files with 49 additions and 44 deletions

View File

@@ -4,26 +4,29 @@
mkdir -p pdf mkdir -p pdf
if test -f "pdf/output.aux"; then # if test -f "pdf/output.aux"; then
rm pdf/* # rm pdf/*
fi # fi
latexmk -C # latexmk -C
latexmk -pdf -jobname=pdf/output main.tex -f latexmk -pdf -jobname=pdf/output main.tex -f -quiet
count=`ls -1 *.aux 2>/dev/null | wc -l` # count=`ls -1 *.aux 2>/dev/null | wc -l`
if [ $count != 0 ] # if [ $count != 0 ]
then # then
mv *.aux pdf/ # mv *.aux pdf/
fi # fi
count=`ls -1 *.bbl 2>/dev/null | wc -l` # count=`ls -1 *.bbl 2>/dev/null | wc -l`
if [ $count != 0 ] # if [ $count != 0 ]
then # then
mv *.bbl pdf/ # mv *.bbl pdf/
fi # fi
count=`ls -1 *.blg 2>/dev/null | wc -l` # count=`ls -1 *.blg 2>/dev/null | wc -l`
if [ $count != 0 ] # if [ $count != 0 ]
then # then
mv *.blg pdf/ # mv *.blg pdf/
fi # fi
mkdir -p pdf/log # mkdir -p pdf/log
find pdf -maxdepth 1 -type f -not -name 'output.pdf' -exec mv {} pdf/log/ \; # find pdf -maxdepth 1 -type f -not -name 'output.pdf' -exec mv {} pdf/log/ \;
mv pdf/output.pdf . cp pdf/output.pdf .
echo ===================================
echo Done compiling.

View File

@@ -1,14 +1,18 @@
#! /bin/bash #! /bin/bash
# Adapted from github.com/gkilleen33/overleaf-offline under the MIT license # Adapted from github.com/gkilleen33/overleaf-offline under the MIT license
# Add build files to gitignore # CD into the main directory
cd /app/project cd /app/project || exit 2
if test -f ".autoltx"; then if test -d "pdf/"; then
echo AutoLTX already installed, skipping steup 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 else
if test -f ".gitignore"; then if test -f ".gitignore"; then
# Adding build files to .gitignore # Adding build files to .gitignore
grep -qxF 'pdf/' .gitignore || echo 'pdf/' >> .gitignore grep -qxF 'pdf/' .gitignore || echo 'pdf/' >> .gitignore
grep -qxF 'latexmkrc' .gitignore || echo 'latexmkrc' >> .gitignore grep -qxF 'latexmkrc' .gitignore || echo 'latexmkrc' >> .gitignore
@@ -17,18 +21,16 @@ if test -f ".gitignore"; then
grep -qxF 'output.pdf' .gitignore || echo 'output.pdf' >> .gitignore grep -qxF 'output.pdf' .gitignore || echo 'output.pdf' >> .gitignore
touch .autoltx touch .autoltx
echo Configuring AutoLTX for this project echo Configuring AutoLTX for this project
else else
# Creating .gitignore file # Creating .gitignore file
printf 'pdf/\nlatexmkrc\ncompile.sh\n.autoltx\noutput.pdf\n' >> .gitignore printf 'pdf/\nlatexmkrc\ncompile.sh\n.autoltx\noutput.pdf\n' >> .gitignore
touch .autoltx touch .autoltx
fi fi
# mkdir -p pdf/config # Add latexmk rc file to build files
cp /app/setupFiles/latexmkrc /app/project/
# 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
# Add compile script to build files chmod +x compile.sh
cp /app/setupFiles/compile.sh /app/project
chmod +x compile.sh
fi fi

View File

@@ -1,13 +1,13 @@
#! /bin/bash #! /bin/bash
echo Running as user: $USER echo Running as user: "$USER"
if [[ -z ${1} ]]; then if [[ -z ${1} ]]; then
echo Main file not spicified echo Main file not spicified
echo Restart the container with proper arguments echo Restart the container with proper arguments
exit 1 exit 1
else else
echo Using main latex file: $1 echo Using main latex file: "$1"
fi fi
if test -d /app/project; then if test -d /app/project; then
@@ -25,5 +25,5 @@ fi
# start auto compile loop # start auto compile loop
echo Starting AutoLTX... echo Starting AutoLTX...
sleep 3 sleep 3
cd /app/project cd /app/project || exit 2
ls $1 | entr -n sh -c ./compile.sh ls "$1" | entr -n sh -c ./compile.sh