| 1 | #! /bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # install - install a program, script, or datafile
|
|---|
| 4 | # This comes from X11R5.
|
|---|
| 5 | #
|
|---|
| 6 | # Calling this script install-sh is preferred over install.sh, to prevent
|
|---|
| 7 | # `make' implicit rules from creating a file called install from it
|
|---|
| 8 | # when there is no Makefile.
|
|---|
| 9 | #
|
|---|
| 10 | # This script is compatible with the BSD install script, but was written
|
|---|
| 11 | # from scratch.
|
|---|
| 12 | #
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 | # set DOITPROG to echo to test this script
|
|---|
| 16 |
|
|---|
| 17 | # Don't use :- since 4.3BSD and earlier shells don't like it.
|
|---|
| 18 | doit="${DOITPROG-}"
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | # put in absolute paths if you don't have them in your path; or use env. vars.
|
|---|
| 22 |
|
|---|
| 23 | mvprog="${MVPROG-mv}"
|
|---|
| 24 | cpprog="${CPPROG-cp}"
|
|---|
| 25 | chmodprog="${CHMODPROG-chmod}"
|
|---|
| 26 | chownprog="${CHOWNPROG-chown}"
|
|---|
| 27 | chgrpprog="${CHGRPPROG-chgrp}"
|
|---|
| 28 | stripprog="${STRIPPROG-strip}"
|
|---|
| 29 | rmprog="${RMPROG-rm}"
|
|---|
| 30 | mkdirprog="${MKDIRPROG-mkdir}"
|
|---|
| 31 |
|
|---|
| 32 | transformbasename=""
|
|---|
| 33 | transform_arg=""
|
|---|
| 34 | instcmd="$mvprog"
|
|---|
| 35 | chmodcmd="$chmodprog 0755"
|
|---|
| 36 | chowncmd=""
|
|---|
| 37 | chgrpcmd=""
|
|---|
| 38 | stripcmd=""
|
|---|
| 39 | rmcmd="$rmprog -f"
|
|---|
| 40 | mvcmd="$mvprog"
|
|---|
| 41 | src=""
|
|---|
| 42 | dst=""
|
|---|
| 43 | dir_arg=""
|
|---|
| 44 |
|
|---|
| 45 | while [ x"$1" != x ]; do
|
|---|
| 46 | case $1 in
|
|---|
| 47 | -c) instcmd="$cpprog"
|
|---|
| 48 | shift
|
|---|
| 49 | continue;;
|
|---|
| 50 |
|
|---|
| 51 | -d) dir_arg=true
|
|---|
| 52 | shift
|
|---|
| 53 | continue;;
|
|---|
| 54 |
|
|---|
| 55 | -m) chmodcmd="$chmodprog $2"
|
|---|
| 56 | shift
|
|---|
| 57 | shift
|
|---|
| 58 | continue;;
|
|---|
| 59 |
|
|---|
| 60 | -o) chowncmd="$chownprog $2"
|
|---|
| 61 | shift
|
|---|
| 62 | shift
|
|---|
| 63 | continue;;
|
|---|
| 64 |
|
|---|
| 65 | -g) chgrpcmd="$chgrpprog $2"
|
|---|
| 66 | shift
|
|---|
| 67 | shift
|
|---|
| 68 | continue;;
|
|---|
| 69 |
|
|---|
| 70 | -s) stripcmd="$stripprog"
|
|---|
| 71 | shift
|
|---|
| 72 | continue;;
|
|---|
| 73 |
|
|---|
| 74 | -t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
|---|
| 75 | shift
|
|---|
| 76 | continue;;
|
|---|
| 77 |
|
|---|
| 78 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
|---|
| 79 | shift
|
|---|
| 80 | continue;;
|
|---|
| 81 |
|
|---|
| 82 | *) if [ x"$src" = x ]
|
|---|
| 83 | then
|
|---|
| 84 | src=$1
|
|---|
| 85 | else
|
|---|
| 86 | # this colon is to work around a 386BSD /bin/sh bug
|
|---|
| 87 | :
|
|---|
| 88 | dst=$1
|
|---|
| 89 | fi
|
|---|
|
|---|