aboutsummaryrefslogtreecommitdiffstats
path: root/deploy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..16a5c25
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+INCLUDES=(
+ "install.sh"
+ "module.prop"
+ "system"
+)
+
+# Welche Dateien/Ordner sollen ausgeschlossen werden?
+EXCLUDES=(
+)
+
+PROP_FILE="module.prop"
+
+trim() { sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'; }
+
+if [[ ! -f "$PROP_FILE" ]]; then
+ echo "Fehler: $PROP_FILE nicht gefunden."
+ exit 1
+fi
+
+if ! command -v zip >/dev/null 2>&1; then
+ echo "Fehler: 'zip' ist nicht installiert."
+ exit 1
+fi
+
+id=$(
+ awk -F= '$1=="id"{print substr($0,index($0,"=")+1)}' "$PROP_FILE" | trim
+)
+version=$(
+ awk -F= '$1=="version"{print substr($0,index($0,"=")+1)}' "$PROP_FILE" | trim
+)
+
+if [[ -z "${id}" || -z "${version}" ]]; then
+ echo "Fehler: Konnte 'id' und/oder 'version' nicht aus $PROP_FILE lesen."
+ exit 1
+fi
+
+mkdir -p release
+zipfile="release/${id}-${version}.zip"
+
+rm -f "$zipfile"
+
+ZIP_EXCLUDES=()
+for ex in "${EXCLUDES[@]}"; do
+ ZIP_EXCLUDES+=("-x" "$ex/*" "-x" "$ex")
+done
+
+zip -r "$zipfile" "${INCLUDES[@]}" "${ZIP_EXCLUDES[@]}"
+
+echo "Fertig: $zipfile"
+