#!/bin/sh
#
# installFile - install the file as specified
#
# SYNOPSIS: installFile [-m mode] [-o owner] [-g group] source dest


# This file is overriden when install is not present or broken(UnixWare 7)

# Note the LOG value is set in installTreeps

DEST="`lastArg $@`"
FILE_PATH="$DEST"

# remove last arg from list of args

ARGS=`getAllButLastArg $*`

if [ ! -z "$PREFIX" ]
then
	DEST="$PREFIX$DEST"
fi

if [ ! -z "$INSTALL_ROOT" ]
then
	DEST="$INSTALL_ROOT$DEST"
fi

DIR=`dirname $DEST`

if [ ! -d "$DIR" ]
then
	DIR_PATH=`dirname $FILE_PATH`
	installDir $DIR_PATH
fi

if [ ! -d "$DIR" ]
then
	echo "Can't install to $DIR"
	exit 1
fi

if install $ARGS $DEST
then
	mkInstallEntry $FILE_PATH >> $LOG
	echo "$DEST"
else
	echo -n "?"
fi

