[comp.unix.xenix] "install" command

jl42+@andrew.cmu.edu (Jay Mathew Libove) (04/13/88)

There is a command on Berkeley systems called "install" which copies
a file, changes its modes, does careful copying, maybe even does owner
changes, and which some software distributions use. In such cases, it
is necessary to hand edit every use of the "install" command in a
makefile to the appropriate cp, mv, chown, chmod, chgrp, etc...
commands. What a nuisance.
Anyone got such a command for Xenix (or SysV in general?)
Thanks

Jay Libove
Arpa:   Jay.Libove@andrew.cmu.edu	Bitnet: Jay.Libove@drycas.bitnet
UUCP:   ...!{uunet, ucbvax, harvard}!andrew.cmu.edu!Jay.Libove
UUCP:   ...!{pitt | bellcore} !darth!libove!libove

geoff@ism780c.UUCP (Geoff Kimbrough) (04/14/88)

In article <QWMbkNy00VoDEdflM8@andrew.cmu.edu> jl42+@andrew.cmu.edu (Jay Mathew Libove) writes:
>There is a command on Berkeley systems called "install" which copies
>Anyone got such a command for Xenix (or SysV in general?)
	System V.3 has the install command in /etc.  I don't know why, but
	my guess is that since it's a shell script that may attempt to
	set the SUID bit on files owned by just about anybody, you have to
	run it as root to *guarantee* that it does the right thing.  put
	/etc in your PATH and you should be OK,  (don't know about Xenix,
	never used it.)
-- 
	 Geoffrey Kimbrough -- Director of Dangerous Activities
	INTERACTIVE Systems Corporation, Santa Monica, California
       sdcrdcf!ism780c!geoff || seismo!ism780c!geoff || ima!geoff
 "Every morning I read the obituaries, if I'm not listed, I go to work."

daveb@laidbak.UUCP (Dave Burton) (04/15/88)

In article <QWMbkNy00VoDEdflM8@andrew.cmu.edu> jl42+@andrew.cmu.edu (Jay Mathew Libove) writes:
|There is a command on Berkeley systems called "install" which copies
|a file, changes its modes, does careful copying, maybe even does owner
|changes, and which some software distributions use. In such cases, it
|is necessary to hand edit every use of the "install" command in a
|makefile to the appropriate cp, mv, chown, chmod, chgrp, etc...
|commands. What a nuisance.
|Anyone got such a command for Xenix (or SysV in general?)

The following is my rendition of install.
Near as I can tell, it works just like Berkeley's install.
I don't thinks it has any bugs, but you never know... :-)

cat >install <<'EOF'
:
#
# @(#)install	1.1 1/31/88
#
# install - install executables
#

PATH=/bin:/usr/bin
IFS=" 	
"

PROGNAME=`basename $0`
USAGE="usage: $PROGNAME [-cs] [-m mode] [-o owner] [-g group] binary location"
cmd=/bin/mv
mode=755
owner=bin
group=bin
strip=false

set -- `getopt 'csm:o:g:' $*`
if [ $? -ne 0 ]
then echo $USAGE >&2;exit 1
fi

for option
do
	case $option in
	-c)	cmd=/bin/cp;	shift;;
	-s)	strip=true;	shift;;
	-m)	mode=$2;	shift;shift;;
	-o)	owner=$2;	shift;shift;;
	-g)	group=$2;	shift;shift;;
	--)	shift;break;;
	esac
done

if [ $# -ne 2 ]
then echo $USAGE >&2;exit 1
fi

file=`basename $1`
loc=$2

if [ ! -f $file ]
then	echo "$PROGNAME: cannot access '$file'" >&2; exit 2
fi

set -- `ls -ldi $file`
finode=$1

if [ -d $loc ]
then	loc=${loc}/$file
fi

if [ -f $loc ]
then
	set -- `ls -ldi $loc`
	linode=$1
	if [ $file = $loc -o $finode = $linode ]
	then	echo "$PROGNAME: '$file' would copy onto itself" >&2; exit 2
	fi
fi

rm -f $loc

if $cmd $file $loc
then	:
else	echo "$PROGNAME: cannot put '$file' at '$lo

mike@cimcor.UUCP (Michael Grenier) (04/15/88)

From article <QWMbkNy00VoDEdflM8@andrew.cmu.edu>, by jl42+@andrew.cmu.edu (Jay Mathew Libove):
> There is a command on Berkeley systems called "install" which copies
> a file, changes its modes, does careful copying, maybe even does owner

> Anyone got such a command for Xenix (or SysV in general?)

Strange, System 5 does have the install command, at least this Microport
box does as well as the cpset command which allows the permission modes to
be placed on the command line. It shouldn't be hard to write though.

    -Mike Grenier

	{ihnp4, amdahl, rutgers}!bungia!cimcor!mike