1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
#!/bin/sh
# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#
# @(#)install.sh 8.9 (Berkeley) 5/19/1998
# Set default program
program=mv
# chown program -- ultrix keeps it in /etc/chown and /usr/etc/chown
if [ -f /etc/chown ]
then
chown=/etc/chown
elif [ -f /usr/etc/chown ]
then
chown=/usr/etc/chown
else
chown=chown
fi
# Check arguments
while [ ! -z "$1" ]
do
case $1
in
-o) owner=$2
shift; shift
;;
-g) group=$2
shift; shift
;;
-m) mode=$2
shift; shift
;;
-c) program=cp
shift
;;
-s) strip="strip"
shift
;;
-*) echo $0: Unknown option $1
exit 1
;;
*) break
;;
esac
done
# Check source file
if [ -z "$1" ]
then
echo "Source file required" >&2
exit 1
elif [ -f $1 -o $1 = /dev/null ]
then
src=$1
else
echo "Source file must be a regular file or /dev/null" >&2
exit 1
fi
# Check destination
if [ -z "$2" ]
then
echo "Destination required" >&2
exit 1
elif [ -d $2 ]
then
dst=$2/$src
else
dst=$2
fi
# Do install operation
$program $src $dst
if [ $? != 0 ]
then
exit 1
fi
# Strip if requested
if [ ! -z "$strip" ]
then
$strip $dst
fi
# Change owner if requested
if [ ! -z "$owner" ]
then
$chown $owner $dst
if [ $? != 0 ]
then
exit 1
fi
fi
# Change group if requested
if [ ! -z "$group" ]
then
chgrp $group $dst
if [ $? != 0 ]
then
exit 1
fi
fi
# Change mode if requested
if [ ! -z "$mode" ]
then
chmod $mode $dst
if [ $? != 0 ]
then
exit 1
fi
fi
exit 0
|