#!/usr/bin/env bash # Installe les unités systemd *utilisateur* pour smart-ide-global-api puis smart-ide-sso-gateway. # Prérequis : config/services.local.env (copie de config/services.local.env.example), builds npm # (packages/smart-ide-upstreams, services/smart-ide-global-api, services/smart-ide-sso-gateway). # Usage : ./scripts/install-smart-ide-gateway-systemd-user.sh # Puis : systemctl --user start smart-ide-global-api smart-ide-sso-gateway set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" UNIT_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user" GLOBAL_IN="${ROOT}/systemd/user/smart-ide-global-api.service.in" SSO_IN="${ROOT}/systemd/user/smart-ide-sso-gateway.service.in" GLOBAL_OUT="${UNIT_DIR}/smart-ide-global-api.service" SSO_OUT="${UNIT_DIR}/smart-ide-sso-gateway.service" mkdir -p "$UNIT_DIR" sed "s|@SMART_IDE_ROOT@|$ROOT|g" "$GLOBAL_IN" >"$GLOBAL_OUT" sed "s|@SMART_IDE_ROOT@|$ROOT|g" "$SSO_IN" >"$SSO_OUT" chmod 0644 "$GLOBAL_OUT" "$SSO_OUT" systemctl --user daemon-reload systemctl --user enable smart-ide-global-api.service systemctl --user enable smart-ide-sso-gateway.service echo "Unités : $GLOBAL_OUT" echo " $SSO_OUT" echo "Démarrage : systemctl --user start smart-ide-global-api smart-ide-sso-gateway" echo "État : systemctl --user status smart-ide-global-api smart-ide-sso-gateway"