Universelle Auto-Update-Engine für Shell-Scripts
Modulares System mit 3 Update-Modi für verschiedene Anwendungsfälle. Einfache Integration per Copy-Paste oder Bootstrap-Loader.
- ✅ 3 Update-Modi: GitHub Release, Git Pull, Direct Download
- ✅ Bootstrap-Loader (nur 30 Zeilen Code)
- ✅ Standalone-Version (komplett eingebettet)
- ✅ Automatische Versions-Prüfung
- ✅ Self-Replacing mit Backup & Rollback
- ✅ Cache für Offline-Betrieb (24h)
- ✅ Dry-Run & Verbose-Modus
- ✅ Archive-Support (tar.gz, zip)
- ✅ Dependencies mitbringen
- ✅ Private Repos via Token
#!/bin/bash
SCRIPT_VERSION="1.0.0"
# Update-Konfiguration
UPDATE_MODE="github_release"
UPDATE_GITHUB_USER="7onnie"
UPDATE_GITHUB_REPO="mein-repo"
GITHUB_TOKEN="${GITHUB_TOKEN:-}"
# Bootstrap
auto_update() {
local ENGINE_URL="https://raw.githubusercontent.com/7onnie/AutoUpdater/main/lib/auto_update_engine.sh"
local CACHE_FILE="/tmp/auto_update_cache/engine.sh"
mkdir -p "$(dirname "$CACHE_FILE")"
if [[ -f "$CACHE_FILE" && -n "$(find "$CACHE_FILE" -mmin -1440 2>/dev/null)" ]]; then
source "$CACHE_FILE" && _auto_update_main "$UPDATE_MODE" && return 0
fi
if curl -sS --max-time 30 "$ENGINE_URL" -o "$CACHE_FILE" 2>/dev/null; then
source "$CACHE_FILE" && _auto_update_main "$UPDATE_MODE" && return 0
else
echo "⚠️ Auto-Update nicht verfügbar"
return 1
fi
}
auto_update
# Deine Script-Logik
echo "Script läuft (Version: $SCRIPT_VERSION)"| Modus | Use-Case | Komplexität |
|---|---|---|
| github_release | Kontrollierte Releases, Archive, private Repos | Mittel |
| git_pull | Mono-Repos, Team-Entwicklung | Niedrig |
| direct_download | Einfache Scripts, öffentliche URLs | Sehr niedrig |
Kopiere bootstrap/bootstrap_minimal.sh in dein Script:
curl -sS https://raw.githubusercontent.com/7onnie/AutoUpdater/main/bootstrap/bootstrap_minimal.shKopiere standalone/auto_update_standalone.sh (komplett eingebettet, 400 Zeilen):
curl -sS https://raw.githubusercontent.com/7onnie/AutoUpdater/main/standalone/auto_update_standalone.shgit submodule add https://github.com/7onnie/AutoUpdater.git
source AutoUpdater/lib/auto_update_engine.sh- 📘 Setup Guide - Token erstellen, erste Schritte
- 🚀 Deployment Guide - CI/CD, automatische Releases
- 🔀 Modes Comparison - Welcher Modus passt zu dir?
- 📦 Migration Guide - Bestehende Scripts migrieren
AutoUpdater/
├── lib/ # Update-Engine Module
│ ├── auto_update_engine.sh # Vollständige Engine
│ ├── auto_update_github_only.sh # Nur GitHub Release
│ ├── auto_update_git_only.sh # Nur Git Pull
│ └── auto_update_direct_only.sh # Nur Direct Download
├── bootstrap/ # Bootstrap-Loader
│ ├── bootstrap_minimal.sh # 30 Zeilen
│ └── bootstrap_with_fallback.sh # 110 Zeilen mit Fallback
├── standalone/ # Standalone-Version
│ └── auto_update_standalone.sh # 400 Zeilen Copy-Paste
├── examples/ # Beispiel-Scripts
├── docs/ # Dokumentation
└── tests/ # Test-Suite
# Syntax-Check
bash -n dein_script.sh
# Dry-Run
UPDATE_DRY_RUN=1 UPDATE_VERBOSE=1 ./dein_script.sh
# Test-Suite ausführen
./tests/test_all_modes.shUPDATE_MODE="github_release"
UPDATE_GITHUB_USER="7onnie"
UPDATE_GITHUB_REPO="scripts"
UPDATE_RELEASE_TAG="latest"
GITHUB_TOKEN="${GITHUB_TOKEN:-}"UPDATE_MODE="git_pull"
UPDATE_GIT_BRANCH="master"UPDATE_MODE="direct_download"
UPDATE_DOWNLOAD_URL="https://raw.githubusercontent.com/7onnie/scripts/master/MeinScript.sh"
UPDATE_VERSION_URL="https://raw.githubusercontent.com/7onnie/scripts/master/VERSION"- SHA256-Checksummen für Verifizierung
- GPG-Signatur Support
- Prometheus Metrics Export
- Auto-Update für die Engine selbst
- Webhooks für Update-Benachrichtigungen
- Delta-Updates (nur Änderungen)
Contributions sind willkommen! Bitte:
- Fork das Repository
- Erstelle einen Feature-Branch (
git checkout -b feature/awesome-feature) - Commit deine Änderungen (
git commit -am 'Add awesome feature') - Push zum Branch (
git push origin feature/awesome-feature) - Erstelle einen Pull Request
MIT License - siehe LICENSE für Details.
- Issues: GitHub Issues
- Diskussionen: GitHub Discussions
- Initial Release
- 3 Update-Modi (GitHub Release, Git Pull, Direct Download)
- Bootstrap-Loader (minimal + fallback)
- Standalone-Version
- Vollständige Dokumentation
- Test-Suite
- GitHub Actions Workflows
- Beispiele für alle Modi
Made with ❤️ by the AutoUpdater Contributors