bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / build / install.sh
1 #!/bin/sh
2 #
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements.  See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License.  You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 #
19 # install.sh -- install a program, script or datafile
20 #
21 # Based on `install-sh' from the X Consortium's X11R5 distribution
22 # as of 89/12/18 which is freely available.
23 # Cleaned up for Apache's Autoconf-style Interface (APACI)
24 # by Ralf S. Engelschall <rse apache.org>
25
26 #
27 #   put in absolute paths if you don't have them in your path; 
28 #   or use env. vars.
29 #
30 mvprog="${MVPROG-mv}"
31 cpprog="${CPPROG-cp}"
32 chmodprog="${CHMODPROG-chmod}"
33 chownprog="${CHOWNPROG-chown}"
34 chgrpprog="${CHGRPPROG-chgrp}"
35 stripprog="${STRIPPROG-strip}"
36 rmprog="${RMPROG-rm}"
37
38 #
39 #   parse argument line
40 #
41 instcmd="$mvprog"
42 chmodcmd=""
43 chowncmd=""
44 chgrpcmd=""
45 stripcmd=""
46 rmcmd="$rmprog -f"
47 mvcmd="$mvprog"
48 ext=""
49 src=""
50 dst=""
51 while [ "x$1" != "x" ]; do
52     case $1 in
53         -c) instcmd="$cpprog"
54             shift; continue
55             ;;
56         -m) chmodcmd="$chmodprog $2"
57             shift; shift; continue
58             ;;
59         -o) chowncmd="$chownprog $2"
60             shift; shift; continue
61             ;;
62         -g) chgrpcmd="$chgrpprog $2"
63             shift; shift; continue
64             ;;
65         -s) stripcmd="$stripprog"
66             shift; continue
67             ;;
68         -S) stripcmd="$stripprog $2"
69             shift; shift; continue
70             ;;
71         -e) ext="$2"
72             shift; shift; continue
73             ;;
74         *)  if [ "x$src" = "x" ]; then
75                 src=$1
76             else
77                 dst=$1
78             fi
79             shift; continue
80             ;;
81     esac
82 done
83 if [ "x$src" = "x" ]; then
84      echo "install.sh: no input file specified"
85      exit 1
86 fi
87 if [ "x$dst" = "x" ]; then
88      echo "install.sh: no destination specified"
89      exit 1
90 fi
91
92 #
93 #  If destination is a directory, append the input filename; if
94 #  your system does not like double slashes in filenames, you may
95 #  need to add some logic
96 #
97 if [ -d $dst ]; then
98     dst="$dst/`basename $src`"
99 fi
100
101 #  Add a possible extension (such as ".exe") to src and dst
102 src="$src$ext"
103 dst="$dst$ext"
104
105 #  Make a temp file name in the proper directory.
106 dstdir=`dirname $dst`
107 dsttmp=$dstdir/#inst.$$#
108
109 #  Move or copy the file name to the temp name
110 $instcmd $src $dsttmp
111
112 #  And set any options; do chmod last to preserve setuid bits
113 if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
114 if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
115 if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
116 if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
117
118 #  Now rename the file to the real destination.
119 $rmcmd $dst
120 $mvcmd $dsttmp $dst
121
122 exit 0
123