Initial commit

This commit is contained in:
2026-09-04 19:49:43 +02:00
parent 7ce9248e95
commit 30faf00ba2
47 changed files with 3946 additions and 0 deletions

71
build.sh Normal file
View File

@@ -0,0 +1,71 @@
#!/bin/sh
# Baut die Erweiterung zu einer .oxt-Datei.
#
# Eine .oxt ist ein ZIP mit fester Struktur. Wichtig: aus dem
# Wurzelverzeichnis heraus packen, nicht das Verzeichnis selbst
# einpacken - sonst findet LibreOffice die META-INF/manifest.xml nicht.
set -eu
cd "$(dirname "$0")"
NAME="paperless-libreoffice"
VERSION="$(sed -n 's/.*<version value="\([^"]*\)".*/\1/p' description.xml)"
OUT="${NAME}-${VERSION}.oxt"
# Vollständigkeit prüfen. zip überspringt fehlende Pfade stillschweigend -
# ohne diese Prüfung entstünde ein Paket, das sich zwar bauen lässt, aber
# beim Installieren nur "Medientyp konnte nicht ermittelt werden" liefert.
FEHLT=""
for f in META-INF/manifest.xml description.xml Addons.xcu \
ProtocolHandler.xcu paperless_addon.py LICENSE \
pythonpath/paperless_client.py pythonpath/paperless_config.py \
pythonpath/paperless_dialogs.py pythonpath/paperless_formats.py \
pythonpath/paperless_i18n.py \
icons/paperless-logo.svg icons/paperless-logo_32.png
do
[ -e "$f" ] || FEHLT="$FEHLT $f\n"
done
if [ -n "$FEHLT" ]; then
printf "ABBRUCH - diese Dateien fehlen:\n%b" "$FEHLT" >&2
printf "\nWahrscheinlich wurden beim Kopieren die Unterverzeichnisse\n" >&2
printf "ausgelassen. Benoetigt werden META-INF/, pythonpath/ und icons/.\n" >&2
exit 1
fi
rm -f "$OUT"
find . -name '__pycache__' -type d -exec rm -rf {} + 2>/dev/null || true
# Lizenztext an die Stelle kopieren, an der LibreOffice ihn erwartet.
# Im Wurzelverzeichnis ohne Endung wird er beim Installieren nicht
# gefunden ("NOT_EXISTING"), obwohl er im Paket liegt.
mkdir -p registration
cp -f LICENSE registration/license-en.txt
zip -r -q "$OUT" \
META-INF \
description.xml description-de.txt description-en.txt \
description-fr.txt LICENSE SICHERHEIT.md registration \
Addons.xcu ProtocolHandler.xcu \
paperless_addon.py \
pythonpath \
icons \
-x "*.pyc" "*/__pycache__/*" "*.oxt" "build.sh" "README.md" "make_icons.py"
# Ergebnis gegenprüfen: Anzahl der Einträge und Vorhandensein des
# Manifests. Ohne META-INF/manifest.xml ist es aus Sicht von LibreOffice
# kein Erweiterungspaket.
ANZ=$(unzip -l "$OUT" | grep -c ' ' || true)
if ! unzip -l "$OUT" | grep -q 'META-INF/manifest.xml'; then
echo "ABBRUCH: META-INF/manifest.xml fehlt im erzeugten Paket." >&2
exit 1
fi
echo "Erstellt: $OUT ($(wc -c < "$OUT") Bytes)"
unzip -l "$OUT" | tail -2 | head -1
echo
echo "Installieren:"
echo " unopkg add --force $OUT"
echo "Entfernen:"
echo " unopkg remove org.example.paperless.libreoffice"
echo
echo "LibreOffice danach vollstaendig beenden, auch den Schnellstarter:"
echo " soffice --terminate_after_init # oder: pkill soffice"