| 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # install - install a program, script, or datafile
|
|---|
| 4 | # This comes from X11R5 (mit/util/scripts/install.sh).
|
|---|
| 5 | #
|
|---|
| 6 | # Copyright 1991 by the Massachusetts Institute of Technology
|
|---|
| 7 | #
|
|---|
| 8 | # Permission to use, copy, modify, distribute, and sell this software and its
|
|---|
| 9 | # documentation for any purpose is hereby granted without fee, provided that
|
|---|
| 10 | # the above copyright notice appear in all copies and that both that
|
|---|
| 11 | # copyright notice and this permission notice appear in supporting
|
|---|
| 12 | # documentation, and that the name of M.I.T. not be used in advertising or
|
|---|
| 13 | # publicity pertaining to distribution of the software without specific,
|
|---|
| 14 | # written prior permission. M.I.T. makes no representations about the
|
|---|
| 15 | # suitability of this software for any purpose. It is provided "as is"
|
|---|
| 16 | # without express or implied warranty.
|
|---|
| 17 | #
|
|---|
| 18 | # Calling this script install-sh is preferred over install.sh, to prevent
|
|---|
| 19 | # `make' implicit rules from creating a file called install from it
|
|---|
| 20 | # when there is no Makefile.
|
|---|
| 21 | #
|
|---|
| 22 | # This script is compatible with the BSD install script, but was written
|
|---|
| 23 | # from scratch. It can only install one file at a time, a restriction
|
|---|
| 24 | # shared with many OS's install programs.
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | # set DOITPROG to echo to test this script
|
|---|
| 28 |
|
|---|
| 29 | # Don't use :- since 4.3BSD and earlier shells don't like it.
|
|---|
| 30 | doit="${DOITPROG-}"
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | # put in absolute paths if you don't have them in your path; or use env. vars.
|
|---|
| 34 |
|
|---|
| 35 | mvprog="${MVPROG-mv}"
|
|---|
| 36 | cpprog="${CPPROG-cp}"
|
|---|
| 37 | chmodprog="${CHMODPROG-chmod}"
|
|---|
| 38 | chownprog="${CHOWNPROG-chown}"
|
|---|
| 39 | chgrpprog="${CHGRPPROG-chgrp}"
|
|---|
| 40 | stripprog="${STRIPPROG-strip}"
|
|---|
| 41 | rmprog="${RMPROG-rm}"
|
|---|
| 42 | mkdirprog="${MKDIRPROG-mkdir}"
|
|---|
| 43 |
|
|---|
| 44 | transformbasename=""
|
|---|
| 45 | transform_arg=""
|
|---|
| 46 | instcmd="$mvprog"
|
|---|
| 47 | chmodcmd="$chmodprog 0755"
|
|---|
| 48 | chowncmd=""
|
|---|
| 49 | chgrpcmd=""
|
|---|
| 50 | stripcmd=""
|
|---|
| 51 | rmcmd="$rmprog -f"
|
|---|
| 52 | mvcmd="$mvprog"
|
|---|
| 53 | src=""
|
|---|
| 54 | dst=""
|
|---|
| 55 | dir_arg=""
|
|---|
| 56 |
|
|---|
| 57 | while [ x"$1" != x ]; do
|
|---|
| 58 | case $1 in
|
|---|
| 59 | -c) instcmd="$cpprog"
|
|---|
| 60 | shift
|
|---|
| 61 | continue;;
|
|---|
| 62 |
|
|---|
| 63 | -d) dir_arg=true
|
|---|
| 64 | shift
|
|---|
| 65 | continue;;
|
|---|
| 66 |
|
|---|
| 67 | -m) chmodcmd="$chmodprog $2"
|
|---|
| 68 | shift
|
|---|
| 69 | shift
|
|---|
| 70 | continue;;
|
|---|
| 71 |
|
|---|
| 72 | -o) chowncmd="$chownprog $2"
|
|---|
| 73 | shift
|
|---|
| 74 | shift
|
|---|
| 75 | continue;;
|
|---|
| 76 |
|
|---|
| 77 | -g) chgrpcmd="$chgrpprog $2"
|
|---|
| 78 | shift
|
|---|
| 79 | shift
|
|---|
| 80 | continue;;
|
|---|
| 81 |
|
|---|
| 82 | -s) stripcmd="$stripprog"
|
|---|
| 83 | shift
|
|---|
| 84 | continue;;
|
|---|
| 85 |
|
|---|
| 86 | -t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
|---|
| 87 | shift
|
|---|
| 88 | continue;;
|
|---|
| 89 |
|
|---|
| 90 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
|---|
| 91 | shift
|
|---|
| 92 | continue;;
|
|---|
|
|---|