Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #!/bin/sh |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | # |
michael@0 | 8 | # install - install a program, script, or datafile |
michael@0 | 9 | # This comes from X11R5; it is not part of GNU. |
michael@0 | 10 | # |
michael@0 | 11 | # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ |
michael@0 | 12 | # |
michael@0 | 13 | # This script is compatible with the BSD install script, but was written |
michael@0 | 14 | # from scratch. |
michael@0 | 15 | # |
michael@0 | 16 | |
michael@0 | 17 | |
michael@0 | 18 | # set DOITPROG to echo to test this script |
michael@0 | 19 | |
michael@0 | 20 | # Don't use :- since 4.3BSD and earlier shells don't like it. |
michael@0 | 21 | doit="${DOITPROG-}" |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | # put in absolute paths if you don't have them in your path; or use env. vars. |
michael@0 | 25 | |
michael@0 | 26 | mvprog="${MVPROG-mv}" |
michael@0 | 27 | cpprog="${CPPROG-cp}" |
michael@0 | 28 | chmodprog="${CHMODPROG-chmod}" |
michael@0 | 29 | chownprog="${CHOWNPROG-chown}" |
michael@0 | 30 | chgrpprog="${CHGRPPROG-chgrp}" |
michael@0 | 31 | stripprog="${STRIPPROG-strip}" |
michael@0 | 32 | rmprog="${RMPROG-rm}" |
michael@0 | 33 | |
michael@0 | 34 | instcmd="$mvprog" |
michael@0 | 35 | chmodcmd="" |
michael@0 | 36 | chowncmd="" |
michael@0 | 37 | chgrpcmd="" |
michael@0 | 38 | stripcmd="" |
michael@0 | 39 | rmcmd="$rmprog -f" |
michael@0 | 40 | mvcmd="$mvprog" |
michael@0 | 41 | src="" |
michael@0 | 42 | dst="" |
michael@0 | 43 | |
michael@0 | 44 | while [ x"$1" != x ]; do |
michael@0 | 45 | case $1 in |
michael@0 | 46 | -c) instcmd="$cpprog" |
michael@0 | 47 | shift |
michael@0 | 48 | continue;; |
michael@0 | 49 | |
michael@0 | 50 | -m) chmodcmd="$chmodprog $2" |
michael@0 | 51 | shift |
michael@0 | 52 | shift |
michael@0 | 53 | continue;; |
michael@0 | 54 | |
michael@0 | 55 | -o) chowncmd="$chownprog $2" |
michael@0 | 56 | shift |
michael@0 | 57 | shift |
michael@0 | 58 | continue;; |
michael@0 | 59 | |
michael@0 | 60 | -g) chgrpcmd="$chgrpprog $2" |
michael@0 | 61 | shift |
michael@0 | 62 | shift |
michael@0 | 63 | continue;; |
michael@0 | 64 | |
michael@0 | 65 | -s) stripcmd="$stripprog" |
michael@0 | 66 | shift |
michael@0 | 67 | continue;; |
michael@0 | 68 | |
michael@0 | 69 | *) if [ x"$src" = x ] |
michael@0 | 70 | then |
michael@0 | 71 | src=$1 |
michael@0 | 72 | else |
michael@0 | 73 | dst=$1 |
michael@0 | 74 | fi |
michael@0 | 75 | shift |
michael@0 | 76 | continue;; |
michael@0 | 77 | esac |
michael@0 | 78 | done |
michael@0 | 79 | |
michael@0 | 80 | if [ x"$src" = x ] |
michael@0 | 81 | then |
michael@0 | 82 | echo "install: no input file specified" |
michael@0 | 83 | exit 1 |
michael@0 | 84 | fi |
michael@0 | 85 | |
michael@0 | 86 | if [ x"$dst" = x ] |
michael@0 | 87 | then |
michael@0 | 88 | echo "install: no destination specified" |
michael@0 | 89 | exit 1 |
michael@0 | 90 | fi |
michael@0 | 91 | |
michael@0 | 92 | |
michael@0 | 93 | # If destination is a directory, append the input filename; if your system |
michael@0 | 94 | # does not like double slashes in filenames, you may need to add some logic |
michael@0 | 95 | |
michael@0 | 96 | if [ -d $dst ] |
michael@0 | 97 | then |
michael@0 | 98 | dst="$dst"/`basename $src` |
michael@0 | 99 | fi |
michael@0 | 100 | |
michael@0 | 101 | # Make a temp file name in the proper directory. |
michael@0 | 102 | |
michael@0 | 103 | dstdir=`dirname $dst` |
michael@0 | 104 | dsttmp=$dstdir/#inst.$$# |
michael@0 | 105 | |
michael@0 | 106 | # Move or copy the file name to the temp name |
michael@0 | 107 | |
michael@0 | 108 | $doit $instcmd $src $dsttmp |
michael@0 | 109 | |
michael@0 | 110 | # and set any options; do chmod last to preserve setuid bits |
michael@0 | 111 | |
michael@0 | 112 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi |
michael@0 | 113 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi |
michael@0 | 114 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi |
michael@0 | 115 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi |
michael@0 | 116 | |
michael@0 | 117 | # Now rename the file to the real destination. |
michael@0 | 118 | |
michael@0 | 119 | $doit $rmcmd $dst |
michael@0 | 120 | $doit $mvcmd $dsttmp $dst |
michael@0 | 121 | |
michael@0 | 122 | |
michael@0 | 123 | exit 0 |