diff --git a/setupFiles/compile.sh b/setupFiles/compile.sh index 80119b0..2f8873b 100644 --- a/setupFiles/compile.sh +++ b/setupFiles/compile.sh @@ -4,26 +4,29 @@ mkdir -p pdf -if test -f "pdf/output.aux"; then - rm pdf/* -fi -latexmk -C -latexmk -pdf -jobname=pdf/output main.tex -f -count=`ls -1 *.aux 2>/dev/null | wc -l` -if [ $count != 0 ] -then - mv *.aux pdf/ -fi -count=`ls -1 *.bbl 2>/dev/null | wc -l` -if [ $count != 0 ] -then - mv *.bbl pdf/ -fi -count=`ls -1 *.blg 2>/dev/null | wc -l` -if [ $count != 0 ] -then - mv *.blg pdf/ -fi -mkdir -p pdf/log -find pdf -maxdepth 1 -type f -not -name 'output.pdf' -exec mv {} pdf/log/ \; -mv pdf/output.pdf . +# if test -f "pdf/output.aux"; then +# rm pdf/* +# fi +# latexmk -C +latexmk -pdf -jobname=pdf/output main.tex -f -quiet +# count=`ls -1 *.aux 2>/dev/null | wc -l` +# if [ $count != 0 ] +# then +# mv *.aux pdf/ +# fi +# count=`ls -1 *.bbl 2>/dev/null | wc -l` +# if [ $count != 0 ] +# then +# mv *.bbl pdf/ +# fi +# count=`ls -1 *.blg 2>/dev/null | wc -l` +# if [ $count != 0 ] +# then +# mv *.blg pdf/ +# fi +# mkdir -p pdf/log +# find pdf -maxdepth 1 -type f -not -name 'output.pdf' -exec mv {} pdf/log/ \; +cp pdf/output.pdf . + +echo =================================== +echo Done compiling. diff --git a/setupFiles/install.sh b/setupFiles/install.sh index 3409318..58e5483 100644 --- a/setupFiles/install.sh +++ b/setupFiles/install.sh @@ -1,14 +1,18 @@ #! /bin/bash - # Adapted from github.com/gkilleen33/overleaf-offline under the MIT license -# Add build files to gitignore -cd /app/project +# CD into the main directory +cd /app/project || exit 2 -if test -f ".autoltx"; then - echo AutoLTX already installed, skipping steup +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 + if test -f ".gitignore"; then # Adding build files to .gitignore grep -qxF 'pdf/' .gitignore || echo 'pdf/' >> .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 touch .autoltx echo Configuring AutoLTX for this project -else + else # Creating .gitignore file printf 'pdf/\nlatexmkrc\ncompile.sh\n.autoltx\noutput.pdf\n' >> .gitignore touch .autoltx -fi - -# mkdir -p pdf/config - -# 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 + + # 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 diff --git a/startup.sh b/startup.sh index 5e852af..c64c8ec 100644 --- a/startup.sh +++ b/startup.sh @@ -1,13 +1,13 @@ #! /bin/bash -echo Running as user: $USER +echo Running as user: "$USER" if [[ -z ${1} ]]; then echo Main file not spicified echo Restart the container with proper arguments exit 1 else - echo Using main latex file: $1 + echo Using main latex file: "$1" fi if test -d /app/project; then @@ -25,5 +25,5 @@ fi # start auto compile loop echo Starting AutoLTX... sleep 3 -cd /app/project -ls $1 | entr -n sh -c ./compile.sh +cd /app/project || exit 2 +ls "$1" | entr -n sh -c ./compile.sh