#!/bin/bash
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-src/portage/bin/doins,v 1.4 2003/02/22 16:59:08 carpaski Exp $

if [ $# -lt 1 ] ; then
	echo "${0}: at least one argument needed"
	exit 1
fi
if [ ! -d "${D}${INSDESTTREE}" ] ; then
	install -d "${D}${INSDESTTREE}"
fi

for x in "$@" ; do
	if [ -L "$x" ] ; then
		cp "$x" "${T}"
		mysrc="${T}"/`/usr/bin/basename "${x}"`
	elif [ -d "$x" ] ; then
		echo "doins: warning, skipping directory ${x}"
		continue
	else
		mysrc="${x}"
	fi
        install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}"
done
