48 lines
1.4 KiB
Bash
48 lines
1.4 KiB
Bash
#!/bin/sh
|
|
# Baut das OXT-Paket. Aufruf im Projektverzeichnis: ./build.sh
|
|
#
|
|
# Die Versionsnummer wird aus description.xml gelesen - sie steht damit
|
|
# an genau einer Stelle und kann beim Bauen nicht auseinanderlaufen.
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
VERSION=$(sed -n 's/.*<version[[:space:]]\{1,\}value="\([^"]*\)".*/\1/p' \
|
|
description.xml | head -n 1)
|
|
|
|
if [ -z "$VERSION" ]; then
|
|
echo "Fehler: keine Version in description.xml gefunden." >&2
|
|
exit 1
|
|
fi
|
|
|
|
NAME="synopse-$VERSION.oxt"
|
|
|
|
# Das 256er Symbol ist nur fuer das Erweiterungsverzeichnis und die
|
|
# Projektseite gedacht und gehoert nicht ins Paket.
|
|
|
|
# Symbole erzeugen, falls sie fehlen und Pillow verfuegbar ist
|
|
if [ ! -f icon/synopse.png ] && command -v python3 > /dev/null 2>&1; then
|
|
python3 tools/make_icons.py || \
|
|
echo "Hinweis: Symbole konnten nicht erzeugt werden." >&2
|
|
fi
|
|
|
|
for required in description.xml META-INF/manifest.xml synopse_handler.py \
|
|
icon/synopse.png icon/synopse_hc.png registration/license-en.txt; do
|
|
if [ ! -f "$required" ]; then
|
|
echo "Fehler: $required fehlt." >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
rm -f "$NAME"
|
|
zip -r -X "$NAME" \
|
|
META-INF \
|
|
description.xml \
|
|
description-de.txt description-en.txt description-fr.txt \
|
|
ProtocolHandler.xcu Addons.xcu \
|
|
synopse_handler.py pythonpath \
|
|
icon registration \
|
|
-x '*.pyc' -x '*__pycache__*' -x 'icon/synopse-256.png' > /dev/null
|
|
|
|
echo "fertig: $NAME"
|