implement update system, cleaned output text
All checks were successful
/ Build Container (push) Successful in 1h12m54s
All checks were successful
/ Build Container (push) Successful in 1h12m54s
This commit is contained in:
@@ -15,5 +15,8 @@ COPY --chown=ltxuser:ltxgroup startup.sh /app/startup.sh
|
|||||||
COPY --chown=ltxuser:ltxgroup setupFiles /app/setupFiles
|
COPY --chown=ltxuser:ltxgroup setupFiles /app/setupFiles
|
||||||
RUN chmod +x /app/startup.sh /app/setupFiles/install.sh
|
RUN chmod +x /app/startup.sh /app/setupFiles/install.sh
|
||||||
|
|
||||||
|
# Versioning file, positioned to run if project files changed.
|
||||||
|
# Change something below this to update the version.
|
||||||
|
RUN date +"%s" > /app/setupFiles/buildDate
|
||||||
# Startup command
|
# Startup command
|
||||||
CMD [ "sh", "-c", "/app/startup.sh ${mainFile}" ]
|
CMD [ "sh", "-c", "/app/startup.sh ${mainFile}" ]
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ Use the following command to attach the project folder to the built container.
|
|||||||
docker run --rm -it -e "mainFile=<mainTEXfile>" -v <projectFolderPath>:/app/project:z --user 1000:1000 phanipavank/autoltx:latest
|
docker run --rm -it -e "mainFile=<mainTEXfile>" -v <projectFolderPath>:/app/project:z --user 1000:1000 phanipavank/autoltx:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
replace `<mainTEXfile>` with the primary tex file to compile, `<projectFolderPath>` with the path to the project folder.
|
Replace `<mainTEXfile>` with the primary tex file to compile, `<projectFolderPath>` with the path to the project folder.
|
||||||
|
|
||||||
This will compile your project whenever a change is observed in the `mainTEXfile` file.
|
This will compile your project whenever a change is observed in the `mainTEXfile` file.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#! /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
|
||||||
|
|
||||||
|
# .autoltx file contents as per line numbers:
|
||||||
|
# 1. build date in epoch, for checking for updates.
|
||||||
|
|
||||||
# CD into the main directory
|
# CD into the main directory
|
||||||
cd /app/project || exit 2
|
cd /app/project || exit 2
|
||||||
|
|
||||||
@@ -8,29 +11,47 @@ if test -d "pdf/"; then
|
|||||||
rm -r pdf/
|
rm -r pdf/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update old installation
|
requiresUpdate=0
|
||||||
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.
|
settingsExists=0
|
||||||
echo AutoLTX already installed, skipping steup
|
|
||||||
|
# Check for updates
|
||||||
|
if test -f "/app/project/.autoltx"; then
|
||||||
|
buildDate=`cat /app/setupFiles/buildDate`
|
||||||
|
installedVersion=`sed -n "1p" /app/project/.autoltx`
|
||||||
|
settingsExists=1
|
||||||
|
if [[ installedVersion -eq buildDate ]]; then
|
||||||
|
requiresUpdate=0
|
||||||
|
echo AutoLTX already installed, skipping steup...
|
||||||
|
else
|
||||||
|
requiresUpdate=1
|
||||||
|
echo Found old AutoLTX files, updating...
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if test -f ".gitignore"; then
|
echo "1" > /app/project/.autoltx
|
||||||
|
requiresUpdate=1
|
||||||
|
echo AutoLTX not installed, configuring...
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update files if necessary
|
||||||
|
if [[ requiresUpdate -eq 1 ]]; then
|
||||||
|
# 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
|
||||||
|
|
||||||
|
if test -f "/app/project/.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
|
||||||
grep -qxF 'compile.sh' .gitignore || echo 'compile.sh' >> .gitignore
|
grep -qxF 'compile.sh' .gitignore || echo 'compile.sh' >> .gitignore
|
||||||
grep -qxF '.autoltx' .gitignore || echo '.autoltx' >> .gitignore
|
grep -qxF '.autoltx' .gitignore || echo '.autoltx' >> .gitignore
|
||||||
grep -qxF 'output.pdf' .gitignore || echo 'output.pdf' >> .gitignore
|
grep -qxF 'output.pdf' .gitignore || echo 'output.pdf' >> .gitignore
|
||||||
touch .autoltx
|
|
||||||
echo Configuring AutoLTX for this project
|
|
||||||
else
|
else
|
||||||
# Creating .gitignore file
|
# Creates .gitignore file
|
||||||
printf 'pdf/\nlatexmkrc\ncompile.sh\n.autoltx\noutput.pdf\n' >> .gitignore
|
echo Configuring .gitignore for this project
|
||||||
touch .autoltx
|
printf 'pdf/\nlatexmkrc\ncompile.sh\n.autoltx\noutput.pdf\n' >> /app/project/.gitignore
|
||||||
fi
|
fi
|
||||||
|
sed -i "1s/.*/$buildDate/" /app/project/.autoltx
|
||||||
# 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
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
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
|
||||||
@@ -24,6 +22,7 @@ fi
|
|||||||
|
|
||||||
# start auto compile loop
|
# start auto compile loop
|
||||||
echo Starting AutoLTX...
|
echo Starting AutoLTX...
|
||||||
|
echo
|
||||||
sleep 3
|
sleep 3
|
||||||
cd /app/project || exit 2
|
cd /app/project || exit 2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user