detect_distro() {
  distro=""

  # shellcheck disable=SC2312
  if [ -f /etc/os-release ]; then
    distro=$(grep "^ID=" /etc/os-release | cut -d'=' -f2 | tr -d '"')
  elif [ -f /etc/lsb-release ]; then
    distro=$(grep "DISTRIB_ID" /etc/lsb-release | cut -d'=' -f2 | tr -d '"')
  elif command -v -- lsb_release >/dev/null 2>&1; then
    distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]')
  else
    distro="unknown"
  fi

  echo "${distro}"
}
