Add one-command Unraid start script with template auto-open

This commit is contained in:
J0Z1L 2026-02-27 23:18:28 +01:00
parent 87a680326e
commit fe3601cb5b
2 changed files with 92 additions and 3 deletions

View file

@ -36,12 +36,39 @@ Danach erreichbar unter: [http://localhost:3000](http://localhost:3000)
## Unraid: Build + Template automatisch aktualisieren/anlegen
Einmalig:
```bash
chmod +x scripts/run-unraid.sh
./scripts/run-unraid.sh
chmod +x start.sh scripts/run-unraid.sh
```
Optional mit eigenen Werten:
Danach reicht:
```bash
./start.sh
```
`start.sh` macht:
- optional `git pull --ff-only` (deaktivierbar mit `SKIP_GIT_PULL=1`)
- Build vom Docker-Image
- Unraid-Template automatisch erstellen/aktualisieren
- direkten Sprung zur Unraid Template-Seite: `Docker/AddContainer?xmlTemplate=user/...`
Optional kannst du Werte in `.env.unraid` (oder `.env`) ablegen, z. B.:
```bash
SPOTIFY_CLIENT_ID=xxx
SPOTIFY_CLIENT_SECRET=yyy
LIDARR_URL=http://192.168.1.50:8686
LIDARR_API_KEY=zzz
LIDARR_ROOT_FOLDER=/music
IMAGE_REPO=ghcr.io/dein-user/lidarr-spotify-frontend
IMAGE_TAG=latest
UNRAID_URL=http://tower
```
Alternativ direkt per Umgebungsvariablen:
```bash
SPOTIFY_CLIENT_ID=xxx \
@ -51,6 +78,13 @@ LIDARR_API_KEY=zzz \
LIDARR_ROOT_FOLDER=/music \
IMAGE_REPO=ghcr.io/dein-user/lidarr-spotify-frontend \
IMAGE_TAG=latest \
UNRAID_URL=http://tower \
./start.sh
```
Direkt `run-unraid.sh` ausführen (ohne Auto-Open/ohne git pull):
```bash
./scripts/run-unraid.sh
```

55
start.sh Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -euo pipefail
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
RUN_SCRIPT="${PROJECT_ROOT}/scripts/run-unraid.sh"
if [[ ! -x "${RUN_SCRIPT}" ]]; then
chmod +x "${RUN_SCRIPT}"
fi
if [[ "${SKIP_GIT_PULL:-0}" != "1" ]] && command -v git >/dev/null 2>&1; then
if git -C "${PROJECT_ROOT}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "==> Aktualisiere Git-Stand (git pull --ff-only)"
git -C "${PROJECT_ROOT}" pull --ff-only || echo "Hinweis: git pull fehlgeschlagen, fahre mit lokalem Stand fort."
fi
fi
for env_file in "${PROJECT_ROOT}/.env.unraid" "${PROJECT_ROOT}/.env"; do
if [[ -f "${env_file}" ]]; then
echo "==> Lade Umgebungswerte aus ${env_file}"
# shellcheck disable=SC1090
set -a; source "${env_file}"; set +a
break
fi
done
"${RUN_SCRIPT}"
TEMPLATE_NAME="${TEMPLATE_NAME:-my-lidarr-spotify-frontend.xml}"
UNRAID_URL="${UNRAID_URL:-}"
if [[ -z "${UNRAID_URL}" ]]; then
if command -v hostname >/dev/null 2>&1; then
HOST_IP="$(hostname -I 2>/dev/null | awk '{print $1}')"
if [[ -n "${HOST_IP}" ]]; then
UNRAID_URL="http://${HOST_IP}"
fi
fi
fi
if [[ -z "${UNRAID_URL}" ]]; then
UNRAID_URL="http://tower"
fi
UNRAID_URL="${UNRAID_URL%/}"
TARGET_URL="${UNRAID_URL}/Docker/AddContainer?xmlTemplate=user/${TEMPLATE_NAME}"
echo "==> Template direkt aufrufen:"
echo "${TARGET_URL}"
if command -v xdg-open >/dev/null 2>&1; then
xdg-open "${TARGET_URL}" >/dev/null 2>&1 || true
elif command -v open >/dev/null 2>&1; then
open "${TARGET_URL}" >/dev/null 2>&1 || true
fi