#!/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