install.sh revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
# All Rights Reserved
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.12.1.1 */
# INSTALL COMMAND
USAGE="eval echo 'usage: install [options] file [dir1 ...]'; exit 2"
if [ $# -lt 2 ] ; then
fi
MODE=755
if [ -z "$GROUP" ]
then
fi
if [ -z "$OWNER" ]
then
fi
then
else
fi
for i in $*
do
then
case $i in
-*) echo "install: The -c, -f, -n options each require a directory following!"
exit 2;;
continue;;
esac
fi
case $i in
then
echo "install: -c dir: illegal option with $ARG option!"
exit 2
then
echo "install: -c dir: illegal option with $arg option!"
exit 2
elif test $# -lt 3
then
echo "install: -c option must have at least 3 args!"
exit 2
else
direct=$2
ARG=-c
shift; shift
fi;;
then
echo "install: -f dir: illegal option with $ARG option!"
exit 2
then
echo "install: -f dir: illegal option with $arg option!"
exit 2
elif test $# -lt 3
then
echo "install: -f option must have at least 3 args!"
exit 2
else
direct=$2
ARG=-f
shift; shift
fi;;
then
echo "install: -i: illegal option with $ARG option!"
exit 2
elif test $# -lt 3
then
echo "install: -i option requires at least 3 args!"
exit 2
else
DEFAULT=""
arg=-i
shift
fi;;
then
echo "install: -o: illegal option with $ARG option!"
exit 2
elif test $# -lt 2
then
else
arg=-o
shift
fi;;
then
echo "install: -n dir: illegal option with $ARG option!"
exit 2
elif test $# -lt 3
then
echo "install: -n option requires at least 3 args!"
exit 2
else
LASTRES=$2
FOUND=n
arg=-n
shift; shift
fi;;
then
echo "install: -d: illegal option with $ARG option!"
exit 2
then
echo "install: -d: illegal option with $arg option!"
exit 2
else
ARG=-d
shift
fi;;
-s) if test $# -lt 2
then
else
ECHO=:
shift
fi;;
then
echo "install: -u option available only to root -- ignored"
else
OWNER=$2
fi
shift; shift;;
then
echo "install: -g option available only to root -- ignored"
else
GROUP=$2
fi
shift; shift;;
-m) MODE=$2
shift; shift;;
*) break;;
esac
done
if [ x$ARG = x-d ]
then
if [ ! -d $i ]
then
mkdir -p $i
if [ $? = 0 ]
then
$ECHO "directory $i created"
else
echo "install: mkdir $i failed "
fi
else
fi
exit
fi
then
case $2 in
-*) $USAGE ;;
"") : ;;
esac
then
exit 2;;
then
if [ $? = 0 ]
then
else
exit 2
fi
fi
then
then
fi
then
fi
then
fi
else
exit 2
fi
exit;;
esac
else
if [ $? = 0 ]
then
else
exit 2
fi
fi
exit
fi
shift
PUTHERE=""
for i in $*
do
case $i in
-*) $USAGE ;;
esac
if [ "$PUTHERE" != "" ]
then break
fi
done
then
then
fi
fi
if [ "$PUTHERE" = "" ]
then
do
if [ "$PUTHERE" != "" ]
then break
fi
done
fi
if [ "$PUTHERE" != "" ]
then
then
if [ $? = 0 ]
then
else
exit 2
fi
fi
FOUND=y
then
then
fi
then
fi
then
fi
break
else
exit 2
fi
fi
"") echo "install: $FILE was not found anywhere!"
exit 2;;
y) : ;;
if [ $? = 0 ]
then
cd $LASTRES
else
exit 2
fi;;
esac