diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-08-24 18:44:38 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2024-08-24 18:44:38 +0200 |
| commit | 33e72730d3911b48db08d457b4d921b2be4b7ea5 (patch) | |
| tree | 7099782117c0e600c2747cfeb28f9af49a2cb2c2 /scripts/lesson-dist | |
| parent | 3f381650a4ca5d2e274bd533b08af27254818227 (diff) | |
| download | unterricht-33e72730d3911b48db08d457b4d921b2be4b7ea5.tar.gz unterricht-33e72730d3911b48db08d457b4d921b2be4b7ea5.zip | |
add simple script to pack my course material together with my latex code
Diffstat (limited to 'scripts/lesson-dist')
| -rwxr-xr-x | scripts/lesson-dist | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/lesson-dist b/scripts/lesson-dist new file mode 100755 index 00000000..6d9d136d --- /dev/null +++ b/scripts/lesson-dist @@ -0,0 +1,22 @@ +#!/bin/sh +# Create a distributable archive for my lesson material + +ARCHIVE="$(basename "$PWD").zip" +zip "${ARCHIVE}" ./** + +# TODO: replace hardcoded base dir +BASEDIR=/home/muhq/Documents/MyDocuments/Work/Schule/Unterricht + +add_to_archive() { +python3 <<EOF +import zipfile +with zipfile.ZipFile("${ARCHIVE}", "a") as zf: + zf.write("$1", "$2") +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 |
