#!/usr/bin/env bash set -euo pipefail PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" require_ubuntu() { if [[ ! -f /etc/os-release ]]; then echo "Unsupported OS: missing /etc/os-release" exit 1 fi # shellcheck disable=SC1091 source /etc/os-release if [[ "${ID:-}" != "ubuntu" ]]; then echo "This one-click installer currently supports Ubuntu only." exit 1 fi } ensure_executable_scripts() { chmod +x "${PROJECT_DIR}/scripts/install-ubuntu.sh" chmod +x "${PROJECT_DIR}/scripts/bootstrap-dev.sh" chmod +x "${PROJECT_DIR}/scripts/migrate-dev.sh" chmod +x "${PROJECT_DIR}/scripts/ensure-env-ports.sh" chmod +x "${PROJECT_DIR}/scripts/docker-compose.sh" } main() { require_ubuntu ensure_executable_scripts echo "YakPanel one-click installer started..." cd "${PROJECT_DIR}" "${PROJECT_DIR}/scripts/install-ubuntu.sh" echo echo "YakPanel installation completed." dotenv_get() { grep -E "^${1}=" "${PROJECT_DIR}/.env" 2>/dev/null | tail -1 | cut -d= -f2- | tr -d '\r'; } if [[ -f "${PROJECT_DIR}/.env" ]]; then echo "API health: http://localhost:$(dotenv_get API_PORT)/health" echo "MinIO console: http://localhost:$(dotenv_get MINIO_CONSOLE_PORT)" echo "NATS monitor: http://localhost:$(dotenv_get NATS_MONITOR_PORT)" echo "(All host ports are in .env; defaults avoid PostgreSQL/Redis on 5432/6379.)" fi } main "$@"