#!/usr/bin/env bash set -euo pipefail CONTAINER_NAME="stirling-pdf" URL="http://127.0.0.1:8080" BASE_DIR="$HOME/.local/share/stirling-pdf" BIN_DIR="$HOME/.local/bin" APP_DIR="$HOME/.local/share/applications" sudo dnf install -y podman chromium curl libnotify mkdir -p "$BASE_DIR/configs" "$BASE_DIR/logs" "$BASE_DIR/pipeline" "$BASE_DIR/tessdata" "$BASE_DIR/chromium-profile" "$BIN_DIR" "$APP_DIR" podman stop "$CONTAINER_NAME" >/dev/null 2>&1 || true podman rm "$CONTAINER_NAME" >/dev/null 2>&1 || true podman run -d \ --name "$CONTAINER_NAME" \ -p 127.0.0.1:8080:8080 \ -v "$BASE_DIR/configs:/configs:Z" \ -v "$BASE_DIR/logs:/logs:Z" \ -v "$BASE_DIR/pipeline:/pipeline:Z" \ -v "$BASE_DIR/tessdata:/usr/share/tessdata:Z" \ -e SECURITY_ENABLELOGIN=false \ docker.io/stirlingtools/stirling-pdf:latest podman stop "$CONTAINER_NAME" >/dev/null 2>&1 || true cat > "$BIN_DIR/stirling-pdf-app" <<'APP_EOF' #!/usr/bin/env bash set -euo pipefail CONTAINER_NAME="stirling-pdf" URL="http://127.0.0.1:8080" PROFILE_DIR="$HOME/.local/share/stirling-pdf/chromium-profile" BROWSER_BIN="$(command -v chromium-browser || command -v chromium || command -v google-chrome || true)" if [[ -z "$BROWSER_BIN" ]]; then notify-send "Stirling PDF" "Kein Chromium/Chrome-Browser gefunden." exit 1 fi mkdir -p "$PROFILE_DIR" podman start "$CONTAINER_NAME" >/dev/null 2>&1 || true for i in {1..60}; do if curl -fsS "$URL" >/dev/null 2>&1; then "$BROWSER_BIN" \ --app="$URL" \ --user-data-dir="$PROFILE_DIR" \ --disable-background-networking \ --disable-sync \ --disable-features=PushMessaging,MediaRouter,OptimizationHints,OnDeviceModel \ --disable-component-update \ --disable-gpu \ --no-first-run \ --no-default-browser-check \ --password-store=basic \ >/dev/null 2>&1 podman stop "$CONTAINER_NAME" >/dev/null 2>&1 || true exit 0 fi sleep 1 done notify-send "Stirling PDF" "Stirling PDF ist nicht rechtzeitig gestartet." podman stop "$CONTAINER_NAME" >/dev/null 2>&1 || true exit 1 APP_EOF chmod +x "$BIN_DIR/stirling-pdf-app" cat > "$APP_DIR/stirling-pdf.desktop" </dev/null || true echo "Installation complete. Start with: Super -> Stirling PDF"