More minor IPI work.
[dragonfly/vkernel-mp.git] / contrib / sendmail-8.14 / devtools / bin / install.sh
blob59a3771b6dad607dc6a61dc05c1364c2e5f73a62
1 #!/bin/sh
3 # Copyright (c) 1998, 1999, 2001 Sendmail, Inc. and its suppliers.
4 # All rights reserved.
6 # By using this file, you agree to the terms and conditions set
7 # forth in the LICENSE file which can be found at the top level of
8 # the sendmail distribution.
11 # $Id: install.sh,v 8.14 2001/03/16 23:37:31 gshapiro Exp $
13 # Set default program
14 program=mv
15 owner=""
16 group=""
17 mode=""
18 strip=""
20 # chown program -- ultrix keeps it in /etc/chown and /usr/etc/chown
21 if [ -f /etc/chown ]
22 then
23 chown=/etc/chown
24 elif [ -f /usr/etc/chown ]
25 then
26 chown=/usr/etc/chown
27 else
28 chown=chown
31 # Check arguments
32 while [ ! -z "$1" ]
34 case $1
36 -o) owner=$2
37 shift; shift
40 -g) group=$2
41 shift; shift
44 -m) mode=$2
45 shift; shift
48 -c) program=cp
49 shift
52 -s) strip="strip"
53 shift
56 -*) echo $0: Unknown option $1
57 exit 1
60 *) break
62 esac
63 done
65 # Check source file
66 if [ -z "$1" ]
67 then
68 echo "Source file required" >&2
69 exit 1
70 elif [ -f $1 -o $1 = /dev/null ]
71 then
72 src=$1
73 else
74 echo "Source file must be a regular file or /dev/null" >&2
75 exit 1
78 # Check destination
79 if [ -z "$2" ]
80 then
81 echo "Destination required" >&2
82 exit 1
83 elif [ -d $2 ]
84 then
85 srcfile=`basename $src`
86 dst=$2/$srcfile
87 else
88 dst=$2
91 # Do install operation
92 $program $src $dst
93 if [ $? != 0 ]
94 then
95 exit 1
98 # Strip if requested
99 if [ ! -z "$strip" ]
100 then
101 $strip $dst
104 # Change owner if requested
105 if [ ! -z "$owner" ]
106 then
107 $chown $owner $dst
108 if [ $? != 0 ]
109 then
110 exit 1
114 # Change group if requested
115 if [ ! -z "$group" ]
116 then
117 chgrp $group $dst
118 if [ $? != 0 ]
119 then
120 exit 1
124 # Change mode if requested
125 if [ ! -z "$mode" ]
126 then
127 chmod $mode $dst
128 if [ $? != 0 ]
129 then
130 exit 1
134 exit 0