diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-09-07 15:22:30 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2024-09-07 15:22:30 +0200 |
| commit | 9294ebca1c6cc28f37986f8064d999f4965c8de3 (patch) | |
| tree | 72855ff79d4c2e8d1c2443c6877ab4eec2550822 /scripts/lesson-dist | |
| parent | 9b144bd580248d95bf37b163c3affbbedc11b887 (diff) | |
| download | unterricht-9294ebca1c6cc28f37986f8064d999f4965c8de3.tar.gz unterricht-9294ebca1c6cc28f37986f8064d999f4965c8de3.zip | |
improve script to create a distributable zip archive
* Only add needed latex code.
* Include the License from the BASEDIR
Diffstat (limited to 'scripts/lesson-dist')
| -rwxr-xr-x | scripts/lesson-dist | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/scripts/lesson-dist b/scripts/lesson-dist index 6d9d136d..15ca2368 100755 --- a/scripts/lesson-dist +++ b/scripts/lesson-dist @@ -1,8 +1,7 @@ #!/bin/sh # Create a distributable archive for my lesson material - ARCHIVE="$(basename "$PWD").zip" -zip "${ARCHIVE}" ./** +zip "${ARCHIVE}" $(find . -mindepth 1 -not -path './.*' -printf '%p ') # TODO: replace hardcoded base dir BASEDIR=/home/muhq/Documents/MyDocuments/Work/Schule/Unterricht @@ -15,8 +14,50 @@ with zipfile.ZipFile("${ARCHIVE}", "a") as zf: EOF } -for path in "${BASEDIR}"/latex/*.cls "${BASEDIR}"/latex/*.tex "${BASEDIR}"/latex/images/**; -do - path_in_arc="$(echo "${path}" | sed -e "s%${BASEDIR}/%%")" - add_to_archive "${path}" "${path_in_arc}" -done +add_custom_latex_to_archive() { + for path in "$@" + do + path_in_arc="$(echo "${path}" | sed -e "s%${BASEDIR}/%%")" + add_to_archive "${path}" "${path_in_arc}" + done +} + +# Include license +add_custom_latex_to_archive "${BASEDIR}"/COPYING + +# Include common latex code +add_custom_latex_to_archive "${BASEDIR}"/latex/common.tex \ + "${BASEDIR}"/latex/common_packages.tex \ + "${BASEDIR}"/latex/common_options.tex + +# Include common images +add_custom_latex_to_archive "${BASEDIR}"/latex/images/** + +# Include the needed latex classes +if grep -Pzrq '(?s)documentclass.+test\}' .; then + add_custom_latex_to_archive "${BASEDIR}"/latex/test.cls +fi + +if grep -Pzrq '(?s)documentclass.+arbeitsauftrag\}' .; then + add_custom_latex_to_archive "${BASEDIR}"/latex/arbeitsauftrag.cls +fi + +if grep -Pzrq '(?s)documentclass.+handout\}' .; then + add_custom_latex_to_archive "${BASEDIR}"/latex/handout.cls +fi + +include_planning= +if grep -Pzrq '(?s)documentclass.+map\}' .; then + add_custom_latex_to_archive "${BASEDIR}"/latex/map.cls + include_planning=true +fi + +if grep -Pzrq '(?s)documentclass.+sequence\}' .; then + add_custom_latex_to_archive "${BASEDIR}"/latex/sequence.cls + include_planning=true +fi + +if [ -n "${include_planning}" ]; then + add_custom_latex_to_archive "${BASEDIR}"/latex/common_planning*.tex +fi + |
