| [3225] | 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # install - install a program, script, or datafile
|
|---|
| 4 | #
|
|---|
| 5 | # This originates from X11R5 (mit/util/scripts/install.sh), which was
|
|---|
| 6 | # later released in X11R6 (xc/config/util/install.sh) with the
|
|---|
| 7 | # following copyright and license.
|
|---|
| 8 | #
|
|---|
| 9 | # Copyright (C) 1994 X Consortium
|
|---|
| 10 | #
|
|---|
| 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy
|
|---|
| 12 | # of this software and associated documentation files (the "Software"), to
|
|---|
| 13 | # deal in the Software without restriction, including without limitation the
|
|---|
| 14 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|---|
| 15 | # sell copies of the Software, and to permit persons to whom the Software is
|
|---|
| 16 | # furnished to do so, subject to the following conditions:
|
|---|
| 17 | #
|
|---|
| 18 | # The above copyright notice and this permission notice shall be included in
|
|---|
| 19 | # all copies or substantial portions of the Software.
|
|---|
| 20 | #
|
|---|
| 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|---|
| 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|---|
| 23 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|---|
| 24 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|---|
| 25 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
|---|
| 26 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|---|
| 27 | #
|
|---|
| 28 | # Except as contained in this notice, the name of the X Consortium shall not
|
|---|
| 29 | # be used in advertising or otherwise to promote the sale, use or other deal-
|
|---|
| 30 | # ings in this Software without prior written authorization from the X Consor-
|
|---|
| 31 | # tium.
|
|---|
| 32 | #
|
|---|
| 33 | #
|
|---|
| 34 | # FSF changes to this file are in the public domain.
|
|---|
| 35 | #
|
|---|
| 36 | # Calling this script install-sh is preferred over install.sh, to prevent
|
|---|
| 37 | # `make' implicit rules from creating a file called install from it
|
|---|
| 38 | # when there is no Makefile.
|
|---|
| 39 | #
|
|---|
| 40 | # This script is compatible with the BSD install script, but was written
|
|---|
| 41 | # from scratch. It can only install one file at a time, a restriction
|
|---|
| 42 | # shared with many OS's install programs.
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | # set DOITPROG to echo to test this script
|
|---|
| 46 |
|
|---|
| 47 | # Don't use :- since 4.3BSD and earlier shells don't like it.
|
|---|
| 48 | doit="${DOITPROG-}"
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 | # put in absolute paths if you don't have them in your path; or use env. vars.
|
|---|
| 52 |
|
|---|
| 53 | mvprog="${MVPROG-mv}"
|
|---|
| 54 | cpprog="${CPPROG-cp}"
|
|---|
| 55 | chmodprog="${CHMODPROG-chmod}"
|
|---|
| 56 | chownprog="${CHOWNPROG-chown}"
|
|---|
| 57 | chgrpprog="${CHGRPPROG-chgrp}"
|
|---|
| 58 | stripprog="${STRIPPROG-strip}"
|
|---|
| 59 | rmprog="${RMPROG-rm}"
|
|---|
| 60 | mkdirprog="${MKDIRPROG-mkdir}"
|
|---|
| 61 |
|
|---|
| 62 | transformbasename=""
|
|---|
| 63 | transform_arg=""
|
|---|
| 64 | instcmd="$mvprog"
|
|---|
| 65 | chmodcmd="$chmodprog 0755"
|
|---|
| 66 | chowncmd=""
|
|---|
| 67 | chgrpcmd=""
|
|---|
| 68 | stripcmd=""
|
|---|
| 69 | rmcmd="$rmprog -f"
|
|---|
| 70 | mvcmd="$mvprog"
|
|---|
| 71 | src=""
|
|---|
| 72 | dst=""
|
|---|
| 73 | dir_arg=""
|
|---|
| 74 |
|
|---|
| 75 | while [ x"$1" != x ]; do
|
|---|
| 76 | case $1 in
|
|---|
| 77 | -c) instcmd=$cpprog
|
|---|
| 78 | shift
|
|---|
| 79 | continue;;
|
|---|
| 80 |
|
|---|
| 81 | -d) dir_arg=true
|
|---|
| 82 | shift
|
|---|
| 83 | continue;;
|
|---|
| 84 |
|
|---|
| 85 | -m) chmodcmd="$chmodprog $2"
|
|---|
| 86 | shift
|
|---|
| 87 | shift
|
|---|
| 88 | continue;;
|
|---|
| 89 |
|
|---|
| 90 | -o) chowncmd="$chownprog $2"
|
|---|
| 91 | shift
|
|---|
| 92 | shift
|
|---|
| 93 | continue;;
|
|---|
| 94 |
|
|---|
| 95 | -g) chgrpcmd="$chgrpprog $2"
|
|---|
| 96 | shift
|
|---|
| 97 | shift
|
|---|
| 98 | continue;;
|
|---|
| 99 |
|
|---|
| 100 | -s) stripcmd=$stripprog
|
|---|
| 101 | shift
|
|---|
| 102 | continue;;
|
|---|
| 103 |
|
|---|
| 104 | -t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
|---|
| 105 | shift
|
|---|
| 106 | continue;;
|
|---|
| 107 |
|
|---|
| 108 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
|---|
| 109 | shift
|
|---|
| 110 | continue;;
|
|---|
| 111 |
|
|---|
| 112 | *) if [ x"$src" = x ]
|
|---|
| 113 | then
|
|---|
| 114 | src=$1
|
|---|
| 115 | else
|
|---|
| 116 | # this colon is to work around a 386BSD /bin/sh bug
|
|---|
| 117 | :
|
|---|
| 118 | dst=$1
|
|---|
| 119 | fi
|
|---|
| 120 | shift
|
|---|
| 121 | continue;;
|
|---|
| 122 | esac
|
|---|
| |
|---|