#!/bin/sh # Ein-Befehl-Setup fuer fuesse.sexy — installiert bei Bedarf Node.js selbst. # Aufruf: ./install.sh (oder: sh install.sh) set -e echo "" echo "🦶 fuesse.sexy — Setup" echo "------------------------" # Root/sudo bestimmen (fuer Systempakete) if [ "$(id -u)" -eq 0 ]; then SUDO="" elif command -v sudo >/dev/null 2>&1; then SUDO="sudo" else SUDO="" fi NODE_MAJOR=20 # LTS install_node() { echo "" echo "📥 Node.js nicht gefunden — installiere Node ${NODE_MAJOR} automatisch ..." OS="$(uname -s)" if [ "$OS" = "Linux" ]; then if command -v apt-get >/dev/null 2>&1; then export DEBIAN_FRONTEND=noninteractive $SUDO apt-get update $SUDO apt-get install -y ca-certificates curl gnupg curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR}.x" | $SUDO bash - $SUDO apt-get install -y nodejs elif command -v dnf >/dev/null 2>&1; then curl -fsSL "https://rpm.nodesource.com/setup_${NODE_MAJOR}.x" | $SUDO bash - $SUDO dnf install -y nodejs elif command -v yum >/dev/null 2>&1; then curl -fsSL "https://rpm.nodesource.com/setup_${NODE_MAJOR}.x" | $SUDO bash - $SUDO yum install -y nodejs elif command -v apk >/dev/null 2>&1; then $SUDO apk add --no-cache nodejs npm elif command -v pacman >/dev/null 2>&1; then $SUDO pacman -Sy --noconfirm nodejs npm else echo "❌ Kein bekannter Paketmanager gefunden." echo " Bitte Node.js manuell installieren: https://nodejs.org/" exit 1 fi elif [ "$OS" = "Darwin" ]; then if command -v brew >/dev/null 2>&1; then brew install node else echo "❌ Homebrew nicht gefunden." echo " Bitte Node.js installieren: https://nodejs.org/ (LTS)" exit 1 fi else echo "❌ Unbekanntes System ($OS) — bitte Node.js manuell installieren." exit 1 fi } # 1) Node vorhanden? Sonst installieren. if command -v node >/dev/null 2>&1; then echo "✅ Node gefunden ($(node -v))" else install_node if ! command -v node >/dev/null 2>&1; then echo "❌ Node-Installation fehlgeschlagen. Bitte manuell installieren." exit 1 fi echo "✅ Node installiert ($(node -v))" fi # 2) npm vorhanden? if ! command -v npm >/dev/null 2>&1; then echo "❌ npm nicht gefunden (sollte mit Node kommen). Bitte npm installieren." exit 1 fi # 3) Abhaengigkeiten installieren echo "" echo "📦 Installiere Abhaengigkeiten (npm install) ..." npm install # 4) Fertig echo "" echo "🎉 Fertig! So startest du das Spiel:" echo "" echo " npm start" echo "" echo " Dann im Browser oeffnen: http://:3000" echo ""