#!/bin/bash
################################################################################
#
# make_desktop_entry - creates custom desktop menu into install path
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006, 2007 Yaakov Selkowitz
# Provided by the Cygwin Ports project <http://cygwinports.dotsrc.org/>
#
# cygport is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cygport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cygport.  If not, see <http://www.gnu.org/licenses/>.
#
# $Id: make_desktop_entry 4155 2008-08-07 04:58:41Z yselkowitz $
#
################################################################################
set -e

dodir /usr/share/applications

if (( $# < 2 ))
then
	error "make_desktop_entry requires a minimum of two arguments"
fi

cat > ${D}/usr/share/applications/${1%% *}.desktop <<-_EOF
	[Desktop Entry]
	Encoding=UTF-8
	Name=${2}
	Type=Application
	Comment=${5}
	Exec=${1}
	TryExec=${1}
	Path=
	Icon=${3}
	Categories=${4};
	_EOF
