#!/bin/sh
packrctl health --quiet
health_exit=$?
case "$health_exit" in
  0) printf '%s\n' 'Health ready; review operation authorization separately.' ;;
  1) printf '%s\n' 'Not ready: inspect packrctl health --json and component reasons.' ;;
  2) printf '%s\n' 'Check invocation arguments before another query.' ;;
  3) printf '%s\n' 'Ask the appliance operator to check endpoint and service.' ;;
  4) printf '%s\n' 'Ask the administrator to review the operator binding.' ;;
  *) printf '%s\n' 'Unexpected exit: retain the literal error for support.' ;;
esac
exit "$health_exit"