3 ## install.sh -- install a program, script or datafile
5 ## Based on `install-sh' from the X Consortium's X11R5 distribution
6 ## as of 89/12/18 which is freely available.
7 ## Cleaned up for Apache's Autoconf-style Interface (APACI)
8 ## by Ralf S. Engelschall <rse@apache.org>
11 # This script falls under the Apache License.
12 # See http://www.apache.org/docs/LICENSE
16 # put in absolute paths if you don't have them in your path;
21 chmodprog="${CHMODPROG-chmod}"
22 chownprog="${CHOWNPROG-chown}"
23 chgrpprog="${CHGRPPROG-chgrp}"
24 stripprog="${STRIPPROG-strip}"
40 while [ "x$1" != "x" ]; do
45 -m) chmodcmd="$chmodprog $2"
46 shift; shift; continue
48 -o) chowncmd="$chownprog $2"
49 shift; shift; continue
51 -g) chgrpcmd="$chgrpprog $2"
52 shift; shift; continue
54 -s) stripcmd="$stripprog"
57 -S) stripcmd="$stripprog $2"
58 shift; shift; continue
61 shift; shift; continue
63 *) if [ "x$src" = "x" ]; then
72 if [ "x$src" = "x" ]; then
73 echo "install.sh: no input file specified"
76 if [ "x$dst" = "x" ]; then
77 echo "install.sh: no destination specified"
82 # If destination is a directory, append the input filename; if
83 # your system does not like double slashes in filenames, you may
84 # need to add some logic
87 dst="$dst/`basename $src`"
90 # Add a possible extension (such as ".exe") to src and dst
94 # Make a temp file name in the proper directory.
96 dsttmp=$dstdir/#inst.$$#
98 # Move or copy the file name to the temp name
101 # And set any options; do chmod last to preserve setuid bits
102 if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
103 if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
104 if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
105 if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
107 # Now rename the file to the real destination.
115 ## install.sh -- install a program, script or datafile
117 ## Based on `install-sh' from the X Consortium's X11R5 distribution
118 ## as of 89/12/18 which is freely available.
119 ## Cleaned up for Apache's Autoconf-style Interface (APACI)
120 ## by Ralf S. Engelschall <rse@apache.org>
123 # This script falls under the Apache License.
124 # See http://www.apache.org/docs/LICENSE
128 # put in absolute paths if you don't have them in your path;
131 mvprog="${MVPROG-mv}"
132 cpprog="${CPPROG-cp}"
133 chmodprog="${CHMODPROG-chmod}"
134 chownprog="${CHOWNPROG-chown}"
135 chgrpprog="${CHGRPPROG-chgrp}"
136 stripprog="${STRIPPROG-strip}"
137 rmprog="${RMPROG-rm}"
140 # parse argument line
152 while [ "x$1" != "x" ]; do
154 -c) instcmd="$cpprog"
157 -m) chmodcmd="$chmodprog $2"
158 shift; shift; continue
160 -o) chowncmd="$chownprog $2"
161 shift; shift; continue
163 -g) chgrpcmd="$chgrpprog $2"
164 shift; shift; continue
166 -s) stripcmd="$stripprog"
169 -S) stripcmd="$stripprog $2"
170 shift; shift; continue
173 shift; shift; continue
175 *) if [ "x$src" = "x" ]; then
184 if [ "x$src" = "x" ]; then
185 echo "install.sh: no input file specified"
188 if [ "x$dst" = "x" ]; then
189 echo "install.sh: no destination specified"
194 # If destination is a directory, append the input filename; if
195 # your system does not like double slashes in filenames, you may
196 # need to add some logic
199 dst="$dst/`basename $src`"
202 # Add a possible extension (such as ".exe") to src and dst
206 # Make a temp file name in the proper directory.
207 dstdir=`dirname $dst`
208 dsttmp=$dstdir/#inst.$$#
210 # Move or copy the file name to the temp name
211 $instcmd $src $dsttmp
213 # And set any options; do chmod last to preserve setuid bits
214 if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
215 if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
216 if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
217 if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
219 # Now rename the file to the real destination.