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
10
# http://www.apache.org/licenses/LICENSE-2.0
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.
19
# install.sh -- install a program, script or datafile
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>
27
# put in absolute paths if you don't have them in your path;
32
chmodprog="${CHMODPROG-chmod}"
33
chownprog="${CHOWNPROG-chown}"
34
chgrpprog="${CHGRPPROG-chgrp}"
35
stripprog="${STRIPPROG-strip}"
51
while [ "x$1" != "x" ]; do
56
-m) chmodcmd="$chmodprog $2"
57
shift; shift; continue
59
-o) chowncmd="$chownprog $2"
60
shift; shift; continue
62
-g) chgrpcmd="$chgrpprog $2"
63
shift; shift; continue
65
-s) stripcmd="$stripprog"
68
-S) stripcmd="$stripprog $2"
69
shift; shift; continue
72
shift; shift; continue
74
*) if [ "x$src" = "x" ]; then
83
if [ "x$src" = "x" ]; then
84
echo "install.sh: no input file specified"
87
if [ "x$dst" = "x" ]; then
88
echo "install.sh: no destination specified"
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
98
dst="$dst/`basename $src`"
101
# Add a possible extension (such as ".exe") to src and dst
105
# Make a temp file name in the proper directory.
106
dstdir=`dirname $dst`
107
dsttmp=$dstdir/#inst.$$#
109
# Move or copy the file name to the temp name
110
$instcmd $src $dsttmp
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
118
# Now rename the file to the real destination.