2 # @(#) Installing script accepting bsd-style arguments
4 # $Id: install.SH,v 3.0.1.1 1993/08/19 06:42:10 ram Exp $
6 # Copyright (c) 1991-1993, Raphael Manfredi
8 # You may redistribute only under the terms of the Artistic Licence,
9 # as specified in the README file that comes with the distribution.
10 # You may reuse parts of this distribution only within the terms of
11 # that same Artistic Licence; a copy of which may be found at the root
12 # of the source tree for dist 3.0.
14 # $Log: install.SH,v $
15 # Revision 3.0.1.1 1993/08/19 06:42:10 ram
16 # patch1: leading config.sh searching was not aborting properly
18 # Revision 3.0 1993/08/18 12:04:08 ram
19 # Baseline for dist 3.0 netwide release.
22 chown='/usr/bin/chown'
23 chmod='/usr/bin/chmod'
24 chgrp='/usr/bin/chgrp'
43 if $test ! -d "$name"; then
44 create="$name $create";
45 name=`echo $name | $sed -e "s|^[^/]*$||"`;
46 name=`echo $name | $sed -e "s|\(.*\)/.*|\1|"`;
51 for file in $create; do
52 mkdir $file && $test $verbose &&
53 echo "install: created directory $file" >&2;
84 -d) newdir="$newdir$2 "
104 # if -d option is used, we have to create the path given
105 if $test ! x$newdir = x
113 exit 0 # -d is the only action
118 echo "install: no input file specified" >&2
124 echo "install: no destination specified" >&2
128 srcbase=`basename $src`
129 dstbase=`basename $dst`
131 # If the destination is a directory, the target name is srcbase...
132 if $test -d $dst; then
135 dst="`echo $dst | sed 's,^\(.*\)/.*$,\1,'`"
136 if $test ! -d $dst; then
142 # If the src has a directory, extract the dir name...
143 if $test "$src" != "$srcbase" -a "$src" != "./$srcbase"; then
144 src="`echo $src | sed 's,^\(.*\)/.*$,\1,'`"
149 # dst is the destination directory and dstbase the base name.
150 # srcbase is the base name of source and src the source dir.
152 srcpth=`(cd $src; pwd)`/$srcbase
153 destpth=`(cd $dst; pwd)`/$dstbase
154 if $test x$srcpth = x$destpth; then
156 echo "install: destination and source are identical"
164 if $test -f $dst/$dstbase; then
165 $rm -f $dst/$dstbase && $test $verbose &&
166 echo "install: $dst/$dstbase removed"
168 if $test -f $dst/$dstbase; then
169 $mv $dst/$dstbase $dst/OLD$dstbase && $test $verbose &&
170 echo "install: $dst/$dstbase renamed as OLD$dstbase"
173 cp $srcbase $dst/$dstbase && $test $verbose &&
174 echo "install: $srcbase installed as $dst/$dstbase"
176 if $test ! x$dostrip = x; then
177 strip $dst/$dstbase 2>/dev/null && $test $verbose &&
178 echo "install: stripped $dst/$dstbase"
181 if $test ! x$uid = x; then
182 $chown $uid $dst/$dstbase
184 if $test ! x$gid = x; then
185 $chgrp $gid $dst/$dstbase
187 if $test ! x$mode = x
189 $chmod $mode $dst/$dstbase