# -*- Mode: shell-script; -*-
################################################################################
#
# Driver for Solarflare network controllers and boards
# Copyright 2019 Solarflare Communications Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation, incorporated herein by reference.
#
################################################################################

sfc_disttag() {
  if [ -f /etc/redhat-release ]; then
    awk '
	/Red Hat Linux release/ { gsub(/\./,""); printf "RH%s\n", $5; exit }
	/Red Hat Enterprise Linux release/ { printf "RHEL%s\n", substr($6, 1, 1); exit }
	/Red Hat Enterprise Linux (WS|Server|Client|Workstation)/ { printf "RHEL%s\n", substr($7, 1, 1); exit }
	' /etc/redhat-release
  elif [ -f /etc/debian_version ]; then
      echo "Debian"`sed 's/\//-/g' /etc/debian_version`
  elif [ -x "$(command -v hostnamectl)" ]; then
    hostnamectl | awk '
	/SUSE Linux Enterprise Server/ { printf "SLES%s\n", $7; exit }
	'
  else
    echo "unsupportedOS"
    return 1
  fi
  return 0
}
