Added initial version of rlatexmk

This commit is contained in:
Marcel Kapfer 2019-02-08 15:40:52 +01:00
parent e13e9fdbb5
commit 2ec5c90b35
No known key found for this signature in database
GPG key ID: 2DD1043A5603FCED
2 changed files with 52 additions and 0 deletions

47
rlatexmk/rlatexmk.sh Executable file
View file

@ -0,0 +1,47 @@
#!/bin/sh
# rlatexmk.sh
# Script for remote LaTeX compiling using rlatexmk
# 2019 (c) Marcel Kapfer <opensource@mmk2410.org>
# MIT License
# Importing variables from local rlatexmk_config.sh
import_config() {
CONFIG="$(pwd)/rlatexmk_config.sh"
if [ -f $CONFIG ]; then
source $CONFIG
else
echo "Configuration file $CONFIG not available. Aborting."
exit 1
fi
}
# Provide local folder content to remote using rsync
sync_up() {
rsync $RSYNC_OPTIONS ./ "$USER"@"$HOST":"$REMOTE_PATH"
}
# Get remote folder content using rsync
sync_down() {
rsync $RSYNC_OPTIONS "$USER"@"$HOST":"$REMOTE_PATH"/ .
}
# Run latexmk remote using SSH
compile() {
ssh "$USER"@"$HOST" <<EOF
cd $REMOTE_PATH
latexmk -C
latexmk $LATEXMK_OPTIONS $@
EOF
}
# Main function
main() {
import_config
sync_up
compile
sync_down
}
main

View file

@ -0,0 +1,5 @@
HOST="127.0.0.1"
USER="texlive"
REMOTE_PATH="/tmp"
RSYNC_OPTIONS="--delete --archive --human-readable --partial --progress"
LATEXMK_OPTIONS="-lualatex"