annotate lib/swig/swigwin-2.0.11/CCache/install-sh @ 2383:342b73a61a60

sub_407A1C - refactoring min-max
author zipi
date Sun, 22 Jun 2014 14:39:50 +0100
parents b3009adc0e2f
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 #! /bin/sh
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2 #
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 # install - install a program, script, or datafile
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4 # This comes from X11R5.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5 #
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6 # Calling this script install-sh is preferred over install.sh, to prevent
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7 # `make' implicit rules from creating a file called install from it
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8 # when there is no Makefile.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 #
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10 # This script is compatible with the BSD install script, but was written
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11 # from scratch.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 #
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 # set DOITPROG to echo to test this script
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17 # Don't use :- since 4.3BSD and earlier shells don't like it.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18 doit="${DOITPROG-}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21 # put in absolute paths if you don't have them in your path; or use env. vars.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 mvprog="${MVPROG-mv}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24 cpprog="${CPPROG-cp}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25 chmodprog="${CHMODPROG-chmod}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26 chownprog="${CHOWNPROG-chown}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27 chgrpprog="${CHGRPPROG-chgrp}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 stripprog="${STRIPPROG-strip}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29 rmprog="${RMPROG-rm}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30 mkdirprog="${MKDIRPROG-mkdir}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32 transformbasename=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33 transform_arg=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 instcmd="$mvprog"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 chmodcmd="$chmodprog 0755"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36 chowncmd=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37 chgrpcmd=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38 stripcmd=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 rmcmd="$rmprog -f"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40 mvcmd="$mvprog"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41 src=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42 dst=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 dir_arg=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 while [ x"$1" != x ]; do
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46 case $1 in
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 -c) instcmd="$cpprog"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51 -d) dir_arg=true
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55 -m) chmodcmd="$chmodprog $2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 -o) chowncmd="$chownprog $2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65 -g) chgrpcmd="$chgrpprog $2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70 -s) stripcmd="$stripprog"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74 -t=*) transformarg=`echo $1 | sed 's/-t=//'`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78 -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
82 *) if [ x"$src" = x ]
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
83 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
84 src=$1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
85 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
86 # this colon is to work around a 386BSD /bin/sh bug
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
87 :
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
88 dst=$1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
89 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
90 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
91 continue;;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
92 esac
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
93 done
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
94
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
95 if [ x"$src" = x ]
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
96 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
97 echo "install: no input file specified"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
98 exit 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
99 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
100 true
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
101 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
102
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
103 if [ x"$dir_arg" != x ]; then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
104 dst=$src
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
105 src=""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
106
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
107 if [ -d $dst ]; then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
108 instcmd=:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
109 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
110 instcmd=mkdir
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
111 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
112 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
113
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
114 # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
115 # might cause directories to be created, which would be especially bad
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
116 # if $src (and thus $dsttmp) contains '*'.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
117
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
118 if [ -f $src -o -d $src ]
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
119 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
120 true
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
121 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
122 echo "install: $src does not exist"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
123 exit 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
124 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
125
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
126 if [ x"$dst" = x ]
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
127 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
128 echo "install: no destination specified"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
129 exit 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
130 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
131 true
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
132 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
133
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
134 # If destination is a directory, append the input filename; if your system
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
135 # does not like double slashes in filenames, you may need to add some logic
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
136
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
137 if [ -d $dst ]
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
138 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
139 dst="$dst"/`basename $src`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
140 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
141 true
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
142 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
143 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
144
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
145 ## this sed command emulates the dirname command
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
146 dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
147
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
148 # Make sure that the destination directory exists.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
149 # this part is taken from Noah Friedman's mkinstalldirs script
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
150
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
151 # Skip lots of stat calls in the usual case.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
152 if [ ! -d "$dstdir" ]; then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
153 defaultIFS='
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
154 '
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
155 IFS="${IFS-${defaultIFS}}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
156
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
157 oIFS="${IFS}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
158 # Some sh's can't handle IFS=/ for some reason.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
159 IFS='%'
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
160 set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
161 IFS="${oIFS}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
162
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
163 pathcomp=''
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
164
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
165 while [ $# -ne 0 ] ; do
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
166 pathcomp="${pathcomp}${1}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
167 shift
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
168
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
169 if [ ! -d "${pathcomp}" ] ;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
170 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
171 $mkdirprog "${pathcomp}"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
172 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
173 true
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
174 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
175
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
176 pathcomp="${pathcomp}/"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
177 done
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
178 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
179
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
180 if [ x"$dir_arg" != x ]
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
181 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
182 $doit $instcmd $dst &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
183
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
184 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
185 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
186 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
187 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
188 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
189
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
190 # If we're going to rename the final executable, determine the name now.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
191
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
192 if [ x"$transformarg" = x ]
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
193 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
194 dstfile=`basename $dst`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
195 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
196 dstfile=`basename $dst $transformbasename |
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
197 sed $transformarg`$transformbasename
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
198 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
199
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
200 # don't allow the sed command to completely eliminate the filename
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
201
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
202 if [ x"$dstfile" = x ]
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
203 then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
204 dstfile=`basename $dst`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
205 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
206 true
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
207 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
208
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
209 # Make a temp file name in the proper directory.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
210
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
211 dsttmp=$dstdir/#inst.$$#
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
212
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
213 # Move or copy the file name to the temp name
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
214
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
215 $doit $instcmd $src $dsttmp &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
216
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
217 trap "rm -f ${dsttmp}" 0 &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
218
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
219 # and set any options; do chmod last to preserve setuid bits
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
220
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
221 # If any of these fail, we abort the whole thing. If we want to
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
222 # ignore errors from any of these, just make sure not to ignore
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
223 # errors from the above "$doit $instcmd $src $dsttmp" command.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
224
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
225 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
226 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
227 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
228 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
229
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
230 # Now rename the file to the real destination.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
231
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
232 $doit $rmcmd -f $dstdir/$dstfile &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
233 $doit $mvcmd $dsttmp $dstdir/$dstfile
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
234
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
235 fi &&
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
236
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
237
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
238 exit 0