2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # install - install a program, script, or datafile
9 # This comes from X11R5; it is not part of GNU.
11 # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
13 # This script is compatible with the BSD install script, but was written
18 # set DOITPROG to echo to test this script
20 # Don't use :- since 4.3BSD and earlier shells don't like it.
24 # put in absolute paths if you don't have them in your path; or use env. vars.
28 chmodprog
="${CHMODPROG-chmod}"
29 chownprog
="${CHOWNPROG-chown}"
30 chgrpprog
="${CHGRPPROG-chgrp}"
31 stripprog
="${STRIPPROG-strip}"
44 while [ x
"$1" != x
]; do
50 -m) chmodcmd
="$chmodprog $2"
55 -o) chowncmd
="$chownprog $2"
60 -g) chgrpcmd
="$chgrpprog $2"
65 -s) stripcmd
="$stripprog"
82 echo "install: no input file specified"
88 echo "install: no destination specified"
93 # If destination is a directory, append the input filename; if your system
94 # does not like double slashes in filenames, you may need to add some logic
98 dst
="$dst"/`basename $src`
101 # Make a temp file name in the proper directory.
103 dstdir
=`dirname $dst`
104 dsttmp
=$dstdir/#inst.$$#
106 # Move or copy the file name to the temp name
108 $doit $instcmd $src $dsttmp
110 # and set any options; do chmod last to preserve setuid bits
112 if [ x
"$chowncmd" != x
]; then $doit $chowncmd $dsttmp; fi
113 if [ x
"$chgrpcmd" != x
]; then $doit $chgrpcmd $dsttmp; fi
114 if [ x
"$stripcmd" != x
]; then $doit $stripcmd $dsttmp; fi
115 if [ x
"$chmodcmd" != x
]; then $doit $chmodcmd $dsttmp; fi
117 # Now rename the file to the real destination.
120 $doit $mvcmd $dsttmp $dst