blob: 6d9d136deed4194f120d4179f6cf21104232f8fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
|