#!/bin/bash
# Check Debian version, ensure Debian 12.x (bookworm) or 13.x (trixie)

set -e

if ! [[ -f /etc/debian_version ]] ; then
  echo "ERROR: Missing file /etc/debian_version. Exiting." >&2
  exit 1
fi

DEBIAN_VERSION=$(cut -d . -f1 /etc/debian_version)

case ${DEBIAN_VERSION} in
  12)
    echo "Looks like you are running Debian ${DEBIAN_VERSION} (bookworm). It is OK."
    ;;
  13)
    echo "Looks like you are running Debian ${DEBIAN_VERSION} (trixie). It is OK."
    ;;
  *)
    echo "ERROR: Unsupported Debian release: ${DEBIAN_VERSION}. Exiting." >&2
    exit 1
    ;;
esac
