#!/bin/sh
######################################################################### 
#									# 
#   File: scorpion/bin/install 
#				 					# 
#   Copyright (C) 1991 Karen Shannon
#									# 
#   The Scorpion System is free software in the public domain; you can  # 
#   redistribute it and/or modify it as you wish. We ask that you 	# 
#   retain credits referencing the University of Arizona and that you	# 
#   identify any changes you make.					# 
#									# 
#   Report problems to scorpion-project@cs.arizona.edu			# 
#   Direct all inquiries to:	The Scorpion Project			# 
#				Department of Computer Science		# 
#				Gould-Simpson Building			# 
#				University of Arizona			# 
#				Tucson, AZ 85721			# 
#				U.S.A.					# 
#									# 
#   Revision Log:							# 
#	$Log:$ 
#									# 
#   Edit Log:								# 
#									# 
######################################################################### 

#! /bin/sh
#
#	@(#)install.sh 1.1 86/07/08 SMI; from UCB 4.7 9/7/85
#
cmd=/bin/cp
CP="/bin/cp"
CHMOD="/bin/chmod 755"
CHOWN="/etc/chown -f root"
CHGRP="/bin/chgrp -f staff"
STRIP="/usr/bin/strip"
stripfile=""
while true ; do
	case $1 in
		-s )	stripfile="yes"
			STRIP="$2"
			shift
			shift
			;;
		-c )	cmd="$2"
			shift
			shift
			;;
		-m )	CHMOD="$2"
			shift
			shift
			;;
		-o )	CHOWN="$2"
			shift
			shift
			;;
		-g )	CHGRP="$2"
			shift
			shift
			;;
		* )	break
			;;
	esac
done

if [ ! ${2-""} ]
then	echo "install: no destination specified"
	exit 1
fi
if [ ${3-""} ]
then	echo "install: too many files specified -> $*"
	exit 1
fi
if [ $1 = $2 -o $2 = . ]
then	echo "install: can't move $1 onto itself"
	exit 1
fi
if [ '!' -f $1 ]
then	echo "install: can't open $1"
	exit 1
fi
if [ -d $2 ]
then	file=$2/`basename $1`
else	file=$2
fi
/bin/rm -f $file
$cmd $1 $file
if [ $stripfile ]
then	$STRIP $file
fi
$CHOWN $file
$CHGRP $file
$CHMOD $file
