Deinstallieren löscht user://, also auch user://routines. Wer vorher synchronisiert hat, bekommt die Küren beim ersten Sync zurück – der Sync selbst ist aber manuell. - neuer Abschnitt 7: Ablauf vor und nach dem Wechsel Debug → Release - was der Sync abdeckt (JSON, Legacy-tres, Musik) und was nicht (Einstellungen, Kalibrierung, Hub-Token, Autosave) - Abschnitte 7/8 zu 8/9 umnummeriert, Querverweis aus Abschnitt 6 - Mailvorlage in publish_beta_build.sh erklärt das Sichern per Sync
283 lines
9.3 KiB
Bash
Executable file
283 lines
9.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
||
# Lädt die aktuellen Test-Builds in den Beta-Ordner und zeigt die Links für
|
||
# die Antwort-Mail an. Der Ordner ist pro Version deterministisch:
|
||
#
|
||
# https://programmschmiede.de/rinkplanner/beta/<version>/
|
||
#
|
||
# Zusätzlich werden macOS/Windows weiterhin nach /rinkplanner/download/
|
||
# hochgeladen, weil version.json und der In-App-Updater dorthin zeigen.
|
||
#
|
||
# Aufruf:
|
||
# ./tools/publish_beta_build.sh # Beta + Update-Kopien
|
||
# ./tools/publish_beta_build.sh --beta-only # nur Beta-Ordner
|
||
# ./tools/publish_beta_build.sh --no-upload # nur Links anzeigen
|
||
# ./tools/publish_beta_build.sh --mail macos # fertige Mailvorlage
|
||
# ./tools/publish_beta_build.sh --build-macos # DMG auf dem Mac bauen
|
||
# ./tools/publish_beta_build.sh --no-live-macos # kein Live-DMG übernehmen
|
||
#
|
||
# Fehlt build/macos/rinkplanner-setup.dmg, wird die veröffentlichte DMG
|
||
# derselben Version aus /rinkplanner/download/ übernommen und per SHA-256
|
||
# geprüft. --no-live-macos schaltet das ab.
|
||
#
|
||
# Die Links landen außerdem in build/beta-links.txt.
|
||
set -euo pipefail
|
||
|
||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||
PROJECT_DIR="$REPO_ROOT/rinkplanner"
|
||
CREDENTIALS="$REPO_ROOT/docs/credentials.txt"
|
||
BUILD_DIR="$REPO_ROOT/build"
|
||
LINKS_FILE="$BUILD_DIR/beta-links.txt"
|
||
|
||
MACOS="$BUILD_DIR/macos/rinkplanner-setup.dmg"
|
||
WINDOWS="$BUILD_DIR/windows/rinkplanner-setup.exe"
|
||
ANDROID="$BUILD_DIR/android/rinkplanner-debug.apk"
|
||
|
||
BASE_PUBLIC="https://programmschmiede.de"
|
||
|
||
MODE="upload"
|
||
MAIL_PLATFORM=""
|
||
BUILD_MACOS=0
|
||
LIVE_MACOS=1
|
||
while [[ $# -gt 0 ]]; do
|
||
case "$1" in
|
||
--no-upload) MODE="no-upload" ;;
|
||
--beta-only) MODE="beta-only" ;;
|
||
--build-macos) BUILD_MACOS=1 ;;
|
||
--no-live-macos) LIVE_MACOS=0 ;;
|
||
--mail)
|
||
MAIL_PLATFORM="${2:-}"
|
||
if [[ -z "$MAIL_PLATFORM" ]]; then
|
||
echo "--mail braucht macos, windows, android oder all." >&2
|
||
exit 1
|
||
fi
|
||
shift
|
||
;;
|
||
-h|--help)
|
||
sed -n '2,18p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
|
||
exit 0
|
||
;;
|
||
*)
|
||
echo "Unbekannte Option: $1" >&2
|
||
exit 1
|
||
;;
|
||
esac
|
||
shift
|
||
done
|
||
|
||
cred() {
|
||
[[ -f "$CREDENTIALS" ]] || { echo "Fehlt: $CREDENTIALS" >&2; exit 1; }
|
||
grep -m1 "^$1=" "$CREDENTIALS" | cut -d= -f2- | tr -d '\r'
|
||
}
|
||
|
||
VERSION="$(sed -n 's/^config\/version="\([^"]*\)"/\1/p' "$PROJECT_DIR/project.godot" | head -1)"
|
||
if [[ -z "$VERSION" ]]; then
|
||
echo "Version fehlt in $PROJECT_DIR/project.godot (config/version)." >&2
|
||
exit 1
|
||
fi
|
||
|
||
FTP_DIRECTORY="$(cred FTP_DIRECTORY)"
|
||
[[ -n "$FTP_DIRECTORY" ]] || FTP_DIRECTORY="rinkplanner"
|
||
|
||
BETA_URL="$BASE_PUBLIC/$FTP_DIRECTORY/beta/$VERSION"
|
||
DOWNLOAD_URL="$BASE_PUBLIC/$FTP_DIRECTORY/download"
|
||
|
||
platform_name() {
|
||
case "$1" in
|
||
macos) echo "rinkplanner-setup.dmg" ;;
|
||
windows) echo "rinkplanner-setup.exe" ;;
|
||
android) echo "rinkplanner-debug.apk" ;;
|
||
esac
|
||
}
|
||
|
||
platform_label() {
|
||
case "$1" in
|
||
macos) echo "macOS" ;;
|
||
windows) echo "Windows" ;;
|
||
android) echo "Android (APK)" ;;
|
||
esac
|
||
}
|
||
|
||
platform_local() {
|
||
case "$1" in
|
||
macos) echo "$MACOS" ;;
|
||
windows) echo "$WINDOWS" ;;
|
||
android) echo "$ANDROID" ;;
|
||
esac
|
||
}
|
||
|
||
platform_state() {
|
||
if [[ -f "$(platform_local "$1")" ]]; then
|
||
echo ""
|
||
else
|
||
echo " (nicht gebaut)"
|
||
fi
|
||
}
|
||
|
||
sha256_of() {
|
||
if command -v sha256sum >/dev/null 2>&1; then
|
||
sha256sum "$1" | awk '{print $1}'
|
||
else
|
||
shasum -a 256 "$1" | awk '{print $1}'
|
||
fi
|
||
}
|
||
|
||
## Uses the published DMG when the local macOS build is missing. The live
|
||
## version must match project.godot and the SHA-256 must verify, so an old or
|
||
## tampered file is never uploaded to the beta folder.
|
||
fetch_live_macos() {
|
||
[[ -f "$MACOS" ]] && return 0
|
||
local endpoint="https://rinkplanner.programmschmiede.de/version.json"
|
||
local tmp_json
|
||
tmp_json="$(mktemp "${TMPDIR:-/tmp}/rinkplanner-version.XXXXXX")"
|
||
if ! curl -fsSL --max-time 30 "$endpoint" -o "$tmp_json"; then
|
||
rm -f "$tmp_json"
|
||
echo "Hinweis: Update-Endpunkt nicht erreichbar; macOS-Link bleibt leer." >&2
|
||
return 0
|
||
fi
|
||
local live_version url sha
|
||
live_version="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("version",""))' "$tmp_json")"
|
||
url="$(python3 -c 'import json,sys; print((json.load(open(sys.argv[1])).get("downloads",{}).get("macos",{}) or {}).get("url",""))' "$tmp_json")"
|
||
sha="$(python3 -c 'import json,sys; print((json.load(open(sys.argv[1])).get("downloads",{}).get("macos",{}) or {}).get("sha256",""))' "$tmp_json")"
|
||
rm -f "$tmp_json"
|
||
if [[ "$live_version" != "$VERSION" || "$url" != https://* || -z "$sha" ]]; then
|
||
echo "Hinweis: Kein passendes macOS-DMG für Version $VERSION im Live-Endpunkt; bitte auf dem Mac bauen." >&2
|
||
return 0
|
||
fi
|
||
mkdir -p "$(dirname "$MACOS")"
|
||
if ! curl -fSL --max-time 900 "$url" -o "$MACOS"; then
|
||
rm -f "$MACOS"
|
||
echo "Hinweis: macOS-DMG konnte nicht geladen werden." >&2
|
||
return 0
|
||
fi
|
||
if [[ "$(sha256_of "$MACOS")" != "$sha" ]]; then
|
||
rm -f "$MACOS"
|
||
echo "Hinweis: SHA-256 des macOS-DMG stimmt nicht; nicht übernommen." >&2
|
||
return 0
|
||
fi
|
||
echo "Lokales macOS-DMG fehlt; veröffentlichte Version $VERSION übernommen (SHA-256 geprüft)."
|
||
}
|
||
|
||
print_mail() {
|
||
local platform="$1"
|
||
local link="$2"
|
||
cat <<EOF
|
||
Betreff: Rinkplanner Beta – dein Zugang
|
||
|
||
Hallo …,
|
||
|
||
danke für dein Interesse. Hier ist der Test-Build für $platform:
|
||
|
||
$link
|
||
|
||
Kurz zum Start:
|
||
- macOS: DMG öffnen, App in „Programme“ ziehen. Beim ersten Start
|
||
Rechtsklick → Öffnen (ad-hoc signiert, nicht notarisiert).
|
||
- Windows: Setup ausführen. SmartScreen → „Weitere Informationen“ →
|
||
„Trotzdem ausführen“ (unsigniert).
|
||
- Android: APK installieren, Sideloading erlauben (Debug-Signatur).
|
||
|
||
Das ist eine Testversion: Bitte vorher Küren sichern, keine Gewähr,
|
||
Feedback ist willkommen. Wenn du magst, lade ich dich in den Kür-Hub ein –
|
||
dann können wir Küren teilen.
|
||
|
||
Wichtig zum Sichern: Rinkplanner synchronisiert Küren und Musik nur, wenn du
|
||
„Sync“ drückst (Dropbox oder Google Drive). Vor einem neuen Build also Kür
|
||
speichern und synchronisieren. Nach einer Neuinstallation einmal den
|
||
Cloud-Ordner neu verbinden und erneut synchronisieren – dann sind alle
|
||
Küren wieder da. Einstellungen und Kalibrierung werden nicht mitgesichert.
|
||
|
||
Viele Grüße
|
||
Torsten
|
||
EOF
|
||
}
|
||
|
||
if [[ "$MODE" != "no-upload" ]]; then
|
||
if [[ "$BUILD_MACOS" -eq 1 ]]; then
|
||
if [[ "$(uname -s)" != "Darwin" ]]; then
|
||
echo "Hinweis: --build-macos geht nur auf macOS; baue auf einem Mac oder lass das veröffentlichte DMG übernehmen (ohne --no-live-macos)." >&2
|
||
else
|
||
"$REPO_ROOT/tools/export_macos_installer.sh"
|
||
fi
|
||
fi
|
||
if [[ "$LIVE_MACOS" -eq 1 ]]; then
|
||
fetch_live_macos
|
||
fi
|
||
|
||
FTP_URL="$(cred FTP_URL)"
|
||
FTP_USER="$(cred FTP_USER)"
|
||
FTP_PASSWORD="$(cred FTP_PASSWORD)"
|
||
HOST="${FTP_URL#ftp://}"
|
||
HOST="${HOST#ftps://}"
|
||
HOST="${HOST%%/*}"
|
||
HOST="${HOST%%:*}"
|
||
if [[ -z "$HOST" || -z "$FTP_USER" ]]; then
|
||
echo "FTP-Zugang unvollständig in $CREDENTIALS." >&2
|
||
exit 1
|
||
fi
|
||
CURL=(curl --ssl-reqd --insecure --silent --show-error --connect-timeout 20 --max-time 900 --user "$FTP_USER:$FTP_PASSWORD")
|
||
|
||
uploaded=0
|
||
for platform in macos windows android; do
|
||
name="$(platform_name "$platform")"
|
||
local_file="$(platform_local "$platform")"
|
||
if [[ ! -f "$local_file" ]]; then
|
||
echo "Hinweis: $local_file fehlt; der Link wird trotzdem angezeigt." >&2
|
||
continue
|
||
fi
|
||
"${CURL[@]}" --ftp-create-dirs -T "$local_file" \
|
||
"ftp://$HOST/$FTP_DIRECTORY/beta/$VERSION/$name"
|
||
if [[ "$MODE" == "upload" && ( "$platform" == "macos" || "$platform" == "windows" ) ]]; then
|
||
"${CURL[@]}" --ftp-create-dirs -T "$local_file" \
|
||
"ftp://$HOST/$FTP_DIRECTORY/download/$name"
|
||
fi
|
||
uploaded=$((uploaded + 1))
|
||
done
|
||
if [[ "$uploaded" -eq 0 ]]; then
|
||
echo "Keine Builds gefunden. Zuerst bauen:" >&2
|
||
echo " ./tools/export_macos_installer.sh" >&2
|
||
echo " ./tools/export_windows_installer.sh" >&2
|
||
echo " ./tools/export_android.sh debug" >&2
|
||
exit 1
|
||
fi
|
||
fi
|
||
|
||
mkdir -p "$BUILD_DIR"
|
||
{
|
||
echo "Rinkplanner $VERSION – Beta-Links"
|
||
echo
|
||
for platform in macos windows android; do
|
||
name="$(platform_name "$platform")"
|
||
echo "$(platform_label "$platform"): $BETA_URL/$name$(platform_state "$platform")"
|
||
done
|
||
echo
|
||
echo "Update-Kanal (unverändert): $DOWNLOAD_URL/"
|
||
echo "version.json: https://rinkplanner.programmschmiede.de/version.json"
|
||
} > "$LINKS_FILE"
|
||
|
||
echo "Rinkplanner $VERSION"
|
||
echo "Beta-Ordner: $BETA_URL/"
|
||
for platform in macos windows android; do
|
||
name="$(platform_name "$platform")"
|
||
echo "$(platform_label "$platform"): $BETA_URL/$name$(platform_state "$platform")"
|
||
done
|
||
echo
|
||
echo "Update-Kanal (unverändert): $DOWNLOAD_URL/"
|
||
echo "Links gespeichert: $LINKS_FILE"
|
||
|
||
if [[ -n "$MAIL_PLATFORM" ]]; then
|
||
echo
|
||
if [[ "$MAIL_PLATFORM" == "all" ]]; then
|
||
for platform in macos windows android; do
|
||
print_mail "$(platform_label "$platform")" "$BETA_URL/$(platform_name "$platform")"
|
||
echo
|
||
done
|
||
elif [[ "$MAIL_PLATFORM" == "macos" || "$MAIL_PLATFORM" == "windows" || "$MAIL_PLATFORM" == "android" ]]; then
|
||
if [[ ! -f "$(platform_local "$MAIL_PLATFORM")" ]]; then
|
||
echo "Achtung: $(platform_local "$MAIL_PLATFORM") fehlt lokal – der Link ist eventuell noch nicht live." >&2
|
||
fi
|
||
print_mail "$(platform_label "$MAIL_PLATFORM")" "$BETA_URL/$(platform_name "$MAIL_PLATFORM")"
|
||
else
|
||
echo "Unbekannte Plattform: $MAIL_PLATFORM (macos|windows|android|all)." >&2
|
||
exit 1
|
||
fi
|
||
fi
|