diff options
author | Leonard Kugis <leonard@kug.is> | 2025-09-26 19:00:09 +0200 |
---|---|---|
committer | Leonard Kugis <leonard@kug.is> | 2025-09-26 19:00:09 +0200 |
commit | 6809b24fe771120eb52f406368b9108607409772 (patch) | |
tree | 637e15ae23b67f4eea58c0aea725fe3b5ef5005e /deploy.sh | |
parent | d25d1ac9e53b3333944ef4e18795cf1354c179f0 (diff) | |
download | magisk-fstab-6809b24fe771120eb52f406368b9108607409772.tar.gz |
Diffstat (limited to 'deploy.sh')
-rwxr-xr-x | deploy.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..87fac55 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +set -euo pipefail + +INCLUDES=( + "META-INF" + "service.sh" + "fstab.sh" + "module.prop" +) + +# Welche Dateien/Ordner sollen ausgeschlossen werden? +EXCLUDES=( + ".git" + ".gitignore" + "release" + "deploy.sh" +) + +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" + |