From 2c20f25837e60352f910742fe9c912c5f7fa1d5f Mon Sep 17 00:00:00 2001 From: Marco Wende Date: Wed, 16 Sep 2026 16:04:38 +0200 Subject: [PATCH] =?UTF-8?q?Start-Script=20f=C3=BCr=20macOS=20(start-macos.?= =?UTF-8?q?command)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bequemer Launcher für den Mac: prüft pwsh, installiert bei Bedarf einmalig Microsoft.Graph.Authentication, gibt einen belegten Port frei (auf macOS kein Auto-Kill) und startet Start.ps1; Argumente (-Port/-NoBrowser) werden durchgereicht. .gitattributes erzwingt LF für *.sh/*.command, damit der Shebang auf macOS nicht durch CRLF zerschossen wird. Co-Authored-By: Claude Opus 4.8 --- .gitattributes | 4 ++++ start-macos.command | 54 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .gitattributes create mode 100755 start-macos.command diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a6060bb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Shell-Scripts muessen LF behalten - CRLF zerschiesst den Shebang auf macOS/Linux +# ("bad interpreter"). Gilt unabhaengig von core.autocrlf. +*.sh text eol=lf +*.command text eol=lf diff --git a/start-macos.command b/start-macos.command new file mode 100755 index 0000000..3fa59b6 --- /dev/null +++ b/start-macos.command @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# +# Intune Manager - Start auf macOS (funktioniert auch unter Linux). +# +# Verwendung: +# - Im Finder doppelklicken (Datei muss ausfuehrbar sein: chmod +x start-macos.command) +# - oder im Terminal: ./start-macos.command +# ./start-macos.command -Port 8090 +# ./start-macos.command -NoBrowser +# +# Alle Argumente werden unveraendert an Start.ps1 durchgereicht. +# +set -euo pipefail + +# In das Verzeichnis dieses Scripts wechseln (= Repo-Root), egal von wo gestartet. +cd "$(dirname "$0")" + +echo "==============================================" +echo " Intune Manager - Start (macOS)" +echo "==============================================" + +# 1) PowerShell 7 vorhanden? +if ! command -v pwsh >/dev/null 2>&1; then + echo "FEHLER: PowerShell 7 (pwsh) ist nicht installiert." + echo " Installieren mit: brew install --cask powershell" + exit 1 +fi + +# 2) Graph-Auth-Modul vorhanden? Sonst einmalig installieren. +if ! pwsh -NoProfile -Command "if (Get-Module -ListAvailable Microsoft.Graph.Authentication) { exit 0 } else { exit 1 }"; then + echo "Installiere Microsoft.Graph.Authentication (einmalig, CurrentUser)..." + pwsh -NoProfile -Command "Install-Module Microsoft.Graph.Authentication -Scope CurrentUser -Force" +fi + +# 3) Port aus den Argumenten lesen (Default 8077) - nur fuer die Port-Freigabe unten. +PORT=8077 +args=("$@") +for ((i=0; i<${#args[@]}; i++)); do + if [[ "${args[$i]}" == "-Port" && $((i+1)) -lt ${#args[@]} ]]; then + PORT="${args[$((i+1))]}" + fi +done + +# 4) Belegten Port freigeben (auf macOS gibt es keinen automatischen Instanz-Kill). +if lsof -ti ":$PORT" >/dev/null 2>&1; then + echo "Port $PORT ist belegt - beende alte Instanz..." + lsof -ti ":$PORT" | xargs kill 2>/dev/null || true + sleep 1 +fi + +# 5) Server starten. Argumente 1:1 an Start.ps1 weitergeben. +echo "Starte Server auf http://localhost:$PORT/ (Beenden mit Ctrl+C)" +echo "" +exec pwsh -NoProfile -File ./Start.ps1 "$@"