#!/bin/bash
################################################################################
#
# newdoc - installs file into documentation directory with new name
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006 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: newdoc 5517 2009-01-18 09:37:55Z yselkowitz $
#
################################################################################
set -e

case "${_docinto_dir}" in
	'')	docdir=/usr/share/doc/${P} ;;
	/*)	docdir=/usr/share/doc${_docinto_dir} ;;
	*)	docdir=/usr/share/doc/${P}/${_docinto_dir} ;;
esac

dodir ${docdir}

if [ ! -e ${1} ]
then
	error "file ${1} does not exist"
fi

/bin/install -m0644 ${1} ${D}${docdir}/${2} || error "newdoc ${1} failed"
