#!/bin/sh
#
#       Output a debian control file for debian dkms file
#

PKG_NAME="intel-i915-prerelease"
PKG_VER="1.0"
REL_NAME="1"
REL_TYPE=""
DEP_PKG_NAME=""

helpFunction()
{
	echo ""
	echo "Usage: $0 -n packagename -v packageversion -r releaseversion -p prerelease/opensource"
	echo -e "\t-n packagename"
	echo -e "\t-v packageversion"
	echo -e "\t-r releaseversion"
	echo -e "\t-p Release Type : prerelease/opensource"
	echo -e "\t-z Package Type : binary/dkms"
	exit 1
}

while getopts "n:v:r:p:z:" opt
do
	case "$opt" in
		n ) PKG_NAME="$OPTARG" ;;
		v ) PKG_VER="$OPTARG" ;;
		r ) REL_NAME="$OPTARG" ;;
		p ) REL_TYPE="$OPTARG" ;;
		z )
			PKG_TYPE="$OPTARG"
			if [ "$PKG_TYPE" = "binary" ]; then
				DKMS=DEL
				BIN=
			else
				DKMS=
				BIN=DEL
			fi
			;;
		? ) helpFunction ;; # Print helpFunction
	esac
done

sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
	Source: $PKG_NAME
	Section: kernel
	Priority: optional
	Maintainer: Intel Linux Graphics Team <linux-graphics@intel.com>
	Build-Depends:
	 debhelper (>=9),
$DKMS	 dkms,
	Standards-Version: 4.3.0
	Homepage: https://www.intel.com
	Vcs-Browser: https://www.intel.com
	Vcs-Git: https://www.intel.com

	Package: $PKG_NAME
	Architecture: all
	Depends:
$DKMS	 dkms,
	 flex,
	 bison,
	 libc6-dev | libc-dev,
	Provides:
	 i915-modules,
	 intel-platform-vsec-dkms,
	 intel-platform-cse-dkms,
	Conflicts:
	 intel-gpgpu-dkms-ubuntu-5.17-oem,
	 intel-gpgpu-dkms-ubuntu-5.14-oem,
	 intel-platform-vsec-dkms,
	 intel-platform-cse-dkms,
	Replaces:
	 intel-gpgpu-dkms-ubuntu-5.17-oem,
	 intel-gpgpu-dkms-ubuntu-5.14-oem,
	 intel-platform-vsec-dkms,
	 intel-platform-cse-dkms,
	Description: Out of tree i915 driver.
EOF
