diff options
Diffstat (limited to 'src/lib/libcrypto/util/install.sh')
| -rw-r--r-- | src/lib/libcrypto/util/install.sh | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/src/lib/libcrypto/util/install.sh b/src/lib/libcrypto/util/install.sh new file mode 100644 index 0000000000..e1d0c982df --- /dev/null +++ b/src/lib/libcrypto/util/install.sh | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # install - install a program, script, or datafile | ||
| 4 | # This comes from X11R5; it is not part of GNU. | ||
| 5 | # | ||
| 6 | # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ | ||
| 7 | # | ||
| 8 | # This script is compatible with the BSD install script, but was written | ||
| 9 | # from scratch. | ||
| 10 | # | ||
| 11 | |||
| 12 | |||
| 13 | # set DOITPROG to echo to test this script | ||
| 14 | |||
| 15 | doit="${DOITPROG:-}" | ||
| 16 | |||
| 17 | |||
| 18 | # put in absolute paths if you don't have them in your path; or use env. vars. | ||
| 19 | |||
| 20 | mvprog="${MVPROG:-mv}" | ||
| 21 | cpprog="${CPPROG:-cp}" | ||
| 22 | chmodprog="${CHMODPROG:-chmod}" | ||
| 23 | chownprog="${CHOWNPROG:-chown}" | ||
| 24 | chgrpprog="${CHGRPPROG:-chgrp}" | ||
| 25 | stripprog="${STRIPPROG:-strip}" | ||
| 26 | rmprog="${RMPROG:-rm}" | ||
| 27 | |||
| 28 | instcmd="$mvprog" | ||
| 29 | chmodcmd="" | ||
| 30 | chowncmd="" | ||
| 31 | chgrpcmd="" | ||
| 32 | stripcmd="" | ||
| 33 | rmcmd="$rmprog -f" | ||
| 34 | src="" | ||
| 35 | dst="" | ||
| 36 | |||
| 37 | while [ x"$1" != x ]; do | ||
| 38 | case $1 in | ||
| 39 | -c) instcmd="$cpprog" | ||
| 40 | shift | ||
| 41 | continue;; | ||
| 42 | |||
| 43 | -m) chmodcmd="$chmodprog $2" | ||
| 44 | shift | ||
| 45 | shift | ||
| 46 | continue;; | ||
| 47 | |||
| 48 | -o) chowncmd="$chownprog $2" | ||
| 49 | shift | ||
| 50 | shift | ||
| 51 | continue;; | ||
| 52 | |||
| 53 | -g) chgrpcmd="$chgrpprog $2" | ||
| 54 | shift | ||
| 55 | shift | ||
| 56 | continue;; | ||
| 57 | |||
| 58 | -s) stripcmd="$stripprog" | ||
| 59 | shift | ||
| 60 | continue;; | ||
| 61 | |||
| 62 | *) if [ x"$src" = x ] | ||
| 63 | then | ||
| 64 | src=$1 | ||
| 65 | else | ||
| 66 | dst=$1 | ||
| 67 | fi | ||
| 68 | shift | ||
| 69 | continue;; | ||
| 70 | esac | ||
| 71 | done | ||
| 72 | |||
| 73 | if [ x"$src" = x ] | ||
| 74 | then | ||
| 75 | echo "install: no input file specified" | ||
| 76 | exit 1 | ||
| 77 | fi | ||
| 78 | |||
| 79 | if [ x"$dst" = x ] | ||
| 80 | then | ||
| 81 | echo "install: no destination specified" | ||
| 82 | exit 1 | ||
| 83 | fi | ||
| 84 | |||
| 85 | |||
| 86 | # if destination is a directory, append the input filename; if your system | ||
| 87 | # does not like double slashes in filenames, you may need to add some logic | ||
| 88 | |||
| 89 | if [ -d $dst ] | ||
| 90 | then | ||
| 91 | dst="$dst"/`basename $src` | ||
| 92 | fi | ||
| 93 | |||
| 94 | |||
| 95 | # get rid of the old one and mode the new one in | ||
| 96 | |||
| 97 | $doit $rmcmd $dst | ||
| 98 | $doit $instcmd $src $dst | ||
| 99 | |||
| 100 | |||
| 101 | # and set any options; do chmod last to preserve setuid bits | ||
| 102 | |||
| 103 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; fi | ||
| 104 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; fi | ||
| 105 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; fi | ||
| 106 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; fi | ||
| 107 | |||
| 108 | exit 0 | ||
