#!/usr/bin/env bash
set -euo pipefail

case "${SSH_ORIGINAL_COMMAND:-}" in
  health-check)
    systemctl is-active lake-lamp-authz.service
    systemctl is-active lake-lamp-action-broker.service
    ;;
  restore-authz|install-owner-access|restore-navigation-map|rollback-last-deploy)
    exec /usr/local/libexec/guanghu/jd-recovery-runner "${SSH_ORIGINAL_COMMAND}"
    ;;
  *)
    echo "recovery action denied" >&2
    exit 126
    ;;
esac
