0
|
1 #! /bin/sh |
|
2 |
|
3 # Fetch, build, install, and start a new version of the DCC just |
|
4 # as it was configured last time. |
|
5 |
|
6 # This script should only be used after the DCC has been correctly configured. |
|
7 |
|
8 # If this script fails in its efforts to use wget, curl, fetch, or ftp |
|
9 # to download a new tarball, then manually download a tarball to |
|
10 # build subdirectory in the DCC home directory, probably @prefix@/build. |
|
11 # This script unpacks the newest DCC tarball it finds in that directory, |
|
12 # which will probably be the manually download file. |
|
13 |
|
14 |
|
15 # This script should usually not be used if large configuration changes are |
|
16 # needed. Instead use `./configure ...; make install` as usual. That will |
|
17 # create a new version of this script with the ./configure settings captured. |
|
18 # However, -eENV=VAL and -cCONF=VAL can be used to tweak an installation, |
|
19 # as in `updatedcc -c--with-uid=dcc` `updatedcc -c--without-uid` |
|
20 # or `updatedcc -e DBGFLAGS=-g` |
|
21 |
|
22 # -e ENV=VAL set environment variable ENV to VAL before running ./configure |
|
23 |
|
24 # -c CONF=VAL add "CONF=VAL" to the end of the settings given ./configure |
|
25 |
|
26 # -s base-URL fetch the tarball using base-URL instead of the default. |
|
27 # The name of the tarball is appended to base-URL. |
|
28 |
|
29 # -V x.y.z try to fetch version x.y.z of the tarball instead of the |
|
30 # the most recent verison |
|
31 |
|
32 # -C pfile fetch theDCC source using parameters in pfile |
|
33 |
|
34 # -T tgt target instead of "install" for `make` |
|
35 |
|
36 # -U only fetch, unpack, and configure the tarball. Do not compile |
|
37 # or install the software. |
|
38 |
|
39 # -K cron (kron) mode; configure, compile, and install only |
|
40 # if the fetched version differs, and be silent when |
|
41 # nothing is done |
|
42 |
|
43 # -x debug |
|
44 # -v verbose |
|
45 |
|
46 |
|
47 # This script should be run as root, but can be run as the non-root |
|
48 # user that runs dccm and dccd. If not run as root, it cannot install |
|
49 # man pages or user commands including cdcc and dccproc. |
|
50 |
|
51 # The following environment variables are set by this script to their values |
|
52 # when ./configure or this script was last run: |
|
53 # Unsetting variables that are not set often yields a non-zero command status |
|
54 # so do this before watching for error from mkdir and so forth |
|
55 export @UPDATEDCC_ENV@ |
|
56 unset @UPDATEDCC_ENV@ |
|
57 ENV_SET="@UPDATEDCC_ENV_SET@" |
|
58 @UPDATEDCC_ENV_SET@ |
|
59 @UPDATEDCC_ENV_EXPORT@ |
|
60 |
|
61 |
|
62 # Copyright (c) 2008 by Rhyolite Software, LLC |
|
63 # |
|
64 # This agreement is not applicable to any entity which sells anti-spam |
|
65 # solutions to others or provides an anti-spam solution as part of a |
|
66 # security solution sold to other entities, or to a private network |
|
67 # which employs the DCC or uses data provided by operation of the DCC |
|
68 # but does not provide corresponding data to other users. |
|
69 # |
|
70 # Permission to use, copy, modify, and distribute this software without |
|
71 # changes for any purpose with or without fee is hereby granted, provided |
|
72 # that the above copyright notice and this permission notice appear in all |
|
73 # copies and any distributed versions or copies are either unchanged |
|
74 # or not called anything similar to "DCC" or "Distributed Checksum |
|
75 # Clearinghouse". |
|
76 # |
|
77 # Parties not eligible to receive a license under this agreement can |
|
78 # obtain a commercial license to use DCC by contacting Rhyolite Software |
|
79 # at sales@rhyolite.com. |
|
80 # |
|
81 # A commercial license would be for Distributed Checksum and Reputation |
|
82 # Clearinghouse software. That software includes additional features. This |
|
83 # free license for Distributed ChecksumClearinghouse Software does not in any |
|
84 # way grant permision to use Distributed Checksum and Reputation Clearinghouse |
|
85 # software |
|
86 # |
|
87 # THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL |
|
88 # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
|
89 # OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC |
|
90 # BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES |
|
91 # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
|
92 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
|
93 # ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
|
94 # SOFTWARE. |
|
95 # Rhyolite Software DCC 1.3.103-1.111 $Revision$ |
|
96 # @configure_input@ |
|
97 |
|
98 # English messages so grep can suppress them; |
|
99 # simple collating sequence for sort |
|
100 # sane gcc error messages |
|
101 LC_ALL=C; export LC_ALL |
|
102 |
|
103 |
|
104 RELEASE=1.3.103 |
|
105 HTTP_REFERER=DCC-$RELEASE-script; export HTTP_REFERER |
|
106 |
|
107 DCC_HOMEDIR=@prefix@ |
|
108 DCC_LIBEXEC=@libexecdir@ # in case dcc_conf has disappeared |
|
109 . $DCC_HOMEDIR/dcc_conf |
|
110 BDIR=$DCC_HOMEDIR/build |
|
111 DCCDIR=$BDIR/dcc |
|
112 OK_MARK=$BDIR/.updatedcc_ok |
|
113 BURLS= |
|
114 VERSION= |
|
115 |
|
116 ME=`basename $0` |
|
117 USAGE="$ME: [-xvUK] [-e ENV=VAL] [-c CONF=VAL] [-s base-URL] [-V x.y.z]\\ |
|
118 [-C pfile] [-T make-tgt]" |
|
119 VERBOSE= |
|
120 DEBUG= |
|
121 UNPACK= |
|
122 CRON= |
|
123 CONFS= |
|
124 PFILE="@UPDATEDCC_PFILE@" |
|
125 MAKE_TGT=install |
|
126 while getopts "xvUKe:c:s:V:p:C:T:" c; do |
|
127 case $c in |
|
128 x) set -x; DEBUG=-x VERBOSE=yes;; |
|
129 v) VERBOSE=yes;; |
|
130 U) UNPACK=yes;; |
|
131 K) CRON=yes;; |
|
132 e) # quote any odd characters |
|
133 SETTING=`echo "$OPTARG" | sed -e 's/\([^-_/:=+,.a-zA-Z0-9]\)/\\\\\1/g'` |
|
134 eval "$SETTING" |
|
135 export `expr "$OPTARG" : '\([^=]*\).*' || true` |
|
136 ENV_SET="$ENV_SET $SETTING" |
|
137 ;; |
|
138 c) CONFS="$CONFS $OPTARG";; |
|
139 s) BURLS="$BURLS $OPTARG";; |
|
140 V) VERSION=`expr "X$OPTARG" : 'X\([1-9]\.[1-9][0-9]*\.[1-9][0-9]*\)'` |
|
141 if test "$VERSION" != "$OPTARG"; then |
|
142 echo "invalid -V $OPTARG" 1>&2; exit 1; |
|
143 fi |
|
144 ;; |
|
145 C) PFILE="$OPTARG";; |
|
146 T) MAKE_TGT="$OPTARG";; |
|
147 p) echo "All 3 DCC tarballs are now the same";; |
|
148 *) echo "$USAGE" 1>&2; exit 1;; |
|
149 esac |
|
150 done |
|
151 shift `expr $OPTIND - 1 || true` |
|
152 if test "$#" -ne 0; then |
|
153 echo "$USAGE" 1>&2; exit 1 |
|
154 fi |
|
155 |
|
156 if test -z "$VERBOSE"; then |
|
157 WGETQUIET='-nv' |
|
158 CURLQUIET= |
|
159 CONFQUIET='--quiet' |
|
160 MQUIET= |
|
161 else |
|
162 WGETQUIET= |
|
163 CURLQUIET= |
|
164 CONFQUIET= |
|
165 MQUIET='#' |
|
166 fi |
|
167 |
|
168 # assume cron mode if stdin is not a tty |
|
169 if test -z "$CRON" && test -n "`tty 2>&1 | grep 'not a tty'`"; then |
|
170 echo "assume -K because stdin is not a tty" |
|
171 CRON=assumed |
|
172 fi |
|
173 exec </dev/null |
|
174 if test -n "$CRON"; then |
|
175 # be quite in cron mode unless told otherwise |
|
176 if test -z "$VERBOSE" -a "$CRON" != assumed; then |
|
177 WGETQUIET='-q' |
|
178 CURLQUIET='-s' |
|
179 exec >/dev/null |
|
180 fi |
|
181 exec 3>&1 # preserve stdout in case cron mode does work |
|
182 |
|
183 if test -n "$UNPACK"; then |
|
184 echo "-u (unpack only) and -K (cron mode) are incompatible" 1>&2 |
|
185 exit 1 |
|
186 fi |
|
187 if test -n "$VERSION"; then |
|
188 echo "-V$VERSION and -K (cron mode) are incompatible" 1>&2 |
|
189 exit 1 |
|
190 fi |
|
191 # Do nothing if we have run recently. |
|
192 # Pick a somewhat random number of days to reduce the crowds that |
|
193 # otherwise happen on anniversaries of releases. |
|
194 DAYS=`ps | cksum | sed -e 's/ /9/g' -e 's/[^0-9]*\([0-9]\{1,6\}\).*/\1/'` |
|
195 DAYS=`expr '(' $DAYS % 3 ')' + 6` |
|
196 if test -d $DCCDIR \ |
|
197 && test -n "`find $OK_MARK -mtime -$DAYS 2>/dev/null`"; then |
|
198 echo "less than $DAYS days since the last updatedcc -K; stop" |
|
199 exit 0 |
|
200 fi |
|
201 fi |
|
202 |
|
203 |
|
204 # see if we have permission |
|
205 set -e |
|
206 if test ! -d $BDIR; then |
|
207 rm -f $BDIR || true |
|
208 mkdir $BDIR |
|
209 fi |
|
210 cd $BDIR |
|
211 if test ! -d $DCCDIR; then |
|
212 rm -f $DCCDIR || true |
|
213 mkdir $DCCDIR |
|
214 fi |
|
215 set +e |
|
216 for NM in "$DCC_HOMEDIR" "$DCC_LIBEXEC"; do |
|
217 if test -n "$NM" -a ! -w "$NM"; then |
|
218 echo "cannot write $NM; must $ME be run as root?" 1>&2 |
|
219 exit 1 |
|
220 fi |
|
221 done |
|
222 find $DCCDIR -type d | while read SUBDIR; do |
|
223 if test ! -w $SUBDIR; then |
|
224 echo "cannot write $SUBDIR; must $ME be run as root?" 1>&2 |
|
225 # but maybe this is ok |
|
226 break |
|
227 fi |
|
228 done |
|
229 |
|
230 if test -z "$PFILE"; then |
|
231 if test -n "@UPDATEDCC_PFILE@"; then |
|
232 CONFS="--without-updatedcc-pfile $CONFS" |
|
233 fi |
|
234 # quietly use $DCC_HOMEDIR/.updatedcc_pfile if it exists |
|
235 if test -s "$DCC_HOMEDIR/.updatedcc_pfile"; then |
|
236 PFILE="$DCC_HOMEDIR/.updatedcc_pfile" |
|
237 fi |
|
238 else |
|
239 PFILE=`echo $PFILE | sed "s@^[^/]@$DCC_HOMEDIR/&@"` |
|
240 # add it to the configuration if it is not the default |
|
241 if test "$PFILE" != "$DCC_HOMEDIR/.updatedcc_pfile"; then |
|
242 CONFS="--with-updatedcc-pfile=$PFILE $CONFS" |
|
243 fi |
|
244 fi |
|
245 if test -f "$PFILE" -a ! -r "$PFILE"; then |
|
246 echo "cannot read $PFILE; must $ME be run as root?" 1>&2 |
|
247 fi |
|
248 if test -n "$PFILE"; then |
|
249 . $PFILE |
|
250 fi |
|
251 |
|
252 if test -z "$BURLS"; then |
|
253 # $SERVER is set from $DCC_HOMEDIR/.updatedcc_pfile |
|
254 if test -n "$SERVER"; then |
|
255 BURLS="$SERVER" |
|
256 else |
|
257 BURLS="http://www.dcc-servers.net/dcc/source http://www.rhyolite.com/dcc/source ftp://ftp.dcc-servers.net/src/dcc ftp://ftp.rhyolite.com/src/dcc" |
|
258 fi |
|
259 fi |
|
260 |
|
261 if test -z "$VERSION"; then |
|
262 DLTBALL="dcc.tar.Z" |
|
263 TBALL= |
|
264 TBALL_PATH="$DLTBALL" |
|
265 else |
|
266 DLTBALL="dcc-$VERSION.tar.Z" |
|
267 TBALL="$DLTBALL" |
|
268 TBALL_PATH="old/$DLTBALL" |
|
269 fi |
|
270 # don't blab the password needlessly |
|
271 print_url () { |
|
272 PURL=`echo "$2" | sed -e 's%^\([fhtp]*://\)[^/@:]\{1,\}:[^/@:]\{1,\}@%\1%'` |
|
273 echo "using $1 to get $PURL" |
|
274 } |
|
275 |
|
276 |
|
277 TRAPS="0 1 2 15" |
|
278 stop_dccd () { |
|
279 if test "$DCC_UPDATEDCC_FAST" = yes; then |
|
280 return |
|
281 fi |
|
282 DCC_UPDATEDCC_FAST= export DCC_UPDATEDCC_FAST |
|
283 |
|
284 # trapped signals on some systems must start by turning themselves off, |
|
285 # especially #0 |
|
286 trap "trap $TRAPS; echo 'stopping update; please wait'; $DCC_RESTART" $TRAPS |
|
287 |
|
288 # start stopping dccd now in the hope that it will have released the |
|
289 # sockets and database files by the time we need to restart it. |
|
290 $DCC_LIBEXEC/stop-dccd $DEBUG |
|
291 # switch to a working server |
|
292 @bindir@/cdcc -q rtt >/dev/null 2>&1 || true |
|
293 } |
|
294 |
|
295 if test -n "$UNPACK"; then |
|
296 DCC_RESTART= |
|
297 else |
|
298 DCC_RESTART="$DCC_LIBEXEC/rcDCC $DEBUG start" |
|
299 if test -z "$CRON"; then |
|
300 # let compiling be slow instead of stopping the server in cron mode |
|
301 stop_dccd |
|
302 fi |
|
303 fi |
|
304 |
|
305 |
|
306 # use fetch, wget, curl, or ftp that understands URLs |
|
307 # notice '-c --with-fetch_cmd=X' |
|
308 PGM=`echo "X $confs" | sed -n -e 's/.*--with-fetch[-_]cmd=\([^ ]*\)/\1/p'` |
|
309 if test -z "$PGM"; then |
|
310 PGM=@FETCH_CMD@ |
|
311 fi |
|
312 PGM_B=`basename $PGM` |
|
313 SUCCESS= |
|
314 oldTZ=$TZ; TZ=UTC; export TZ # Solaris FTP is confused by dates |
|
315 if test "$PGM_B" = wget; then |
|
316 for BURL in $BURLS; do |
|
317 URL="$BURL/$TBALL_PATH" |
|
318 print_url "$PGM_B" "$URL" |
|
319 # Do not use --mirror because -r results in a 0 exit status |
|
320 # even on failure. |
|
321 # Do not use --no-remove-listing, -nr, or --dont-remove-listing |
|
322 # because none of them are supported by all versions of wget. |
|
323 # At least some versions of wget exit with 0 after having done |
|
324 # nothing but emitting a usage message. |
|
325 if $PGM $WGETQUIET -nd --no-host-directories -N \ |
|
326 --retr-symlinks --passive-ftp @FETCH_WGET_OPTS@ "$URL"; then |
|
327 if test -s $DLTBALL; then |
|
328 # notice if we get an HTTP error document with or without |
|
329 # HTTP headers |
|
330 if test -z "`sed -n -e 2q \ |
|
331 -e 's/.*DOCTYPE.*/HTML/p' \ |
|
332 -e 's/<HEAD>/HTML/p' -e 's/<head>/HTML/p' \ |
|
333 $DLTBALL`"; then |
|
334 SUCCESS="yes" |
|
335 break |
|
336 fi |
|
337 # do not leave a broken file |
|
338 rm -f $DLTBALL |
|
339 fi |
|
340 fi |
|
341 echo |
|
342 done |
|
343 PGM_B= |
|
344 fi |
|
345 |
|
346 if test "$PGM_B" = fetch; then |
|
347 for BURL in $BURLS; do |
|
348 URL="$BURL/$TBALL_PATH" |
|
349 print_url "$PGM_B" "$URL" |
|
350 if $PGM -p -q -m "$URL"; then |
|
351 if test -s $DLTBALL; then |
|
352 SUCCESS="yes" |
|
353 break |
|
354 fi |
|
355 fi |
|
356 echo |
|
357 done |
|
358 PGM_B= |
|
359 fi |
|
360 |
|
361 if test "$PGM_B" = curl; then |
|
362 for BURL in $BURLS; do |
|
363 URL="$BURL/$TBALL_PATH" |
|
364 print_url "$PGM_B" "$URL" |
|
365 if $PGM @FETCH_CURL_OPTS@ -R --connect-timeout 30 --max-time 600 \ |
|
366 $CURLQUIET "$URL" -o $DLTBALL; then |
|
367 # --fail does not work on at least some versions of curl |
|
368 if test -s $DLTBALL; then |
|
369 # notice if we get an HTTP error document with or without |
|
370 # HTTP headers |
|
371 if test -z "`sed -n -e 2q \ |
|
372 -e 's/.*DOCTYPE.*/HTML/p' \ |
|
373 -e 's/<HEAD>/HTML/p' -e 's/<head>/HTML/p' \ |
|
374 $DLTBALL`"; then |
|
375 SUCCESS="yes" |
|
376 break |
|
377 fi |
|
378 # do not leave a broken file |
|
379 rm -f $DLTBALL |
|
380 fi |
|
381 fi |
|
382 echo |
|
383 done |
|
384 PGM_B= |
|
385 fi |
|
386 |
|
387 # try FTP if it is the right choice or the right choice has not worked |
|
388 if test "$PGM_B" = ftp -o ! -s $DLTBALL; then |
|
389 if test "$PGM_B" != ftp ; then |
|
390 PGM_B=ftp |
|
391 PGM=ftp |
|
392 fi |
|
393 for BURL in $BURLS; do |
|
394 URL="$BURL/$TBALL_PATH" |
|
395 print_url "$PGM_B" "$URL" |
|
396 if $PGM -p "$URL"; then |
|
397 if test -s $DLTBALL; then |
|
398 SUCCESS="yes" |
|
399 break |
|
400 fi |
|
401 fi |
|
402 echo |
|
403 done |
|
404 # if that did not work, try ancient anonymous FTP |
|
405 if test ! -s $DLTBALL; then |
|
406 for URL in $BURLS; do |
|
407 HOST=`expr "$URL" : "ftp://\([^/]*\)/"` |
|
408 SRC=`expr "$URL" : "ftp://[^/]*/\(.*\)"` |
|
409 if test -z "$HOST" -o -z "$SRC"; then |
|
410 continue |
|
411 fi |
|
412 USR=`expr "$HOST" : "\([^/:]*\):"` |
|
413 if test -z "$USR"; then |
|
414 USR=anonymous |
|
415 PASSWD=`hostname` |
|
416 else |
|
417 PASSWD=`expr "$HOST" : "$USR:\(.*\)@.*"` |
|
418 HOST=`expr "$HOST" : ".*@\(.*\)"` |
|
419 fi |
|
420 echo "try old anonymous FTP with $HOST and $SRC" |
|
421 (echo "user $USR $PASSWD "; \ |
|
422 echo "binary"; \ |
|
423 echo "get $SRC/$DLTBALL $DLTBALL") \ |
|
424 | ftp -n $HOST |
|
425 if test -s $DLTBALL; then |
|
426 SUCCESS="yes" |
|
427 break |
|
428 fi |
|
429 # some versions of ftp like to leave empty files |
|
430 rm -f $DLTBALL |
|
431 done |
|
432 fi |
|
433 PGM_B= |
|
434 fi |
|
435 |
|
436 if test -n "$PGM_B"; then |
|
437 echo "unrecognized fetch program $PGM_B" 1>&2; exit 1 |
|
438 fi |
|
439 if test -z "$oldTZ"; then |
|
440 unset TZ |
|
441 else |
|
442 TZ=$oldTZ |
|
443 fi |
|
444 if test -z "$SUCCESS" -o ! -s $DLTBALL; then |
|
445 echo |
|
446 echo "failed to fetch a new copy of $DLTBALL" 1>&2 |
|
447 if test -n "$PFILE"; then |
|
448 echo "is $PFILE correct?" 1>&2 |
|
449 fi |
|
450 # try to install an existing tar ball if not in cron mode |
|
451 if test -n "$CRON"; then |
|
452 exit 1 |
|
453 fi |
|
454 echo |
|
455 fi |
|
456 set -e |
|
457 |
|
458 # pick the newest tarball, possibly one fetched manually and already present |
|
459 # instead of the official tarball fetched by this script. |
|
460 if test -z "$TBALL"; then |
|
461 TBALL=`ls -Lt dcc*.tar.Z | head -1` |
|
462 fi |
|
463 if test ! -s "$TBALL"; then |
|
464 echo "failed to fetch tarball; nothing to install" 1>&2 |
|
465 exit 1 |
|
466 fi |
|
467 |
|
468 NEW_DCC=`zcat "$TBALL" | tar -tf - \ |
|
469 | sed -n -e '2q' -e 's@\(dcc-[0-9.]*\)/.*@\1@p'` |
|
470 if test -z "$NEW_DCC"; then |
|
471 echo "failed to find version in $TBALL" 1>&2 |
|
472 exit 1 |
|
473 fi |
|
474 |
|
475 # finished if we should only install new versions |
|
476 if test -n "$CRON"; then |
|
477 exec 1>&3 # restore stdout |
|
478 if test "$NEW_DCC" = "dcc-$RELEASE" \ |
|
479 && test -z "`find $TBALL -follow -newer $DCCDIR`"; then |
|
480 echo "new $TBALL is the same version $RELEASE; stop" |
|
481 touch $OK_MARK |
|
482 exit 0 |
|
483 fi |
|
484 stop_dccd |
|
485 fi |
|
486 |
|
487 # Move the unpacked tarball into the build directory named dcc |
|
488 # while preserving any foreign files. |
|
489 # Empty the target build directory of old DCC source and generated files. |
|
490 MNM=.manifest |
|
491 if test -d dcc; then |
|
492 if test ! -f dcc/$MNM; then |
|
493 if test `find dcc -type f -print | wc -l` -gt 50; then |
|
494 # deal with old versions without .manifest files |
|
495 echo delete $DCCDIR |
|
496 rm -rf dcc |
|
497 fi |
|
498 else |
|
499 cd dcc |
|
500 set +e |
|
501 @DCCMAKE@ purge >/dev/null 2>&1 |
|
502 cd $BDIR |
|
503 rmdir dcc 2>/dev/null |
|
504 set -e |
|
505 if test -d dcc; then |
|
506 find dcc -type f -print \ |
|
507 | sed -e '1s/./preserving &/' -e '2,$s/./ &/' |
|
508 cd $BDIR |
|
509 fi |
|
510 fi |
|
511 fi |
|
512 |
|
513 echo "unpack $TBALL into $DCCDIR" |
|
514 rm -rf $NEW_DCC |
|
515 zcat $TBALL | tar -xf - 2>&1 | head |
|
516 |
|
517 if test -n "$UNPACK"; then |
|
518 echo "will configure but *NOT* build or install $NEW_DCC" |
|
519 else |
|
520 echo "will configure, build, and install $NEW_DCC" |
|
521 fi |
|
522 if test ! -d dcc; then |
|
523 rm -rf dcc |
|
524 mv $NEW_DCC dcc |
|
525 else |
|
526 # install top directories for preserved files first |
|
527 find $NEW_DCC -name $MNM -print | sort | while read NM; do |
|
528 DIR=`expr $NM : "$NEW_DCC/\(.*\)/$MNM" || true` |
|
529 if test -z "$DIR"; then |
|
530 DIR=. |
|
531 fi |
|
532 if test ! -d $NEW_DCC/$DIR; then |
|
533 # we already moved this directory |
|
534 continue |
|
535 fi |
|
536 # if we can, move the entire directory from the directory in the |
|
537 # unpacked tarball to the corresponding build directory |
|
538 if test ! -d $DCCDIR/$DIR; then |
|
539 # first remove a possible stray file with the target name |
|
540 rm -f $DCCDIR/$DIR || true |
|
541 mv $NEW_DCC/$DIR $DCCDIR/$DIR |
|
542 continue |
|
543 fi |
|
544 # otherwise move individual files from the unpacked tarball directory |
|
545 cd $NEW_DCC/$DIR |
|
546 mv `cat $MNM` $DCCDIR/$DIR |
|
547 cd $BDIR |
|
548 done |
|
549 rm -rf $NEW_DCC |
|
550 fi |
|
551 |
|
552 cd $DCCDIR |
|
553 |
|
554 # turn off FreeBSD blather about object directories |
|
555 if test -z "$MAKEOBJDIRPREFIX"; then |
|
556 MAKEOBJDIRPREFIX=; export MAKEOBJDIRPREFIX |
|
557 fi |
|
558 |
|
559 if test -n "$ENV_SET"; then |
|
560 echo "+ $ENV_SET" |
|
561 fi |
|
562 echo "+ ./configure @UPDATEDCC_PARMS@ $CONFQUIET $CONFS" |
|
563 ./configure @UPDATEDCC_PARMS@ $CONFQUIET $CONFS |
|
564 |
|
565 if test -n "$UNPACK"; then |
|
566 exit |
|
567 fi |
|
568 trap "trap $TRAPS; echo 'stopping; please wait'; \ |
|
569 $DCC_RESTART; @DCCMAKE@ purge >/dev/null 2>&1" $TRAPS |
|
570 |
|
571 @DCCMAKE@ $MAKE_TGT \ |
|
572 | sed -e "$MQUIET/^[a-z0-9_]*.c: In function .*/d" \ |
|
573 -e "$MQUIET/ warning: .%.. yields only last 2 digits of year/d" \ |
|
574 -e "$MQUIET/^make.*is up to date/d" \ |
|
575 -e "$MQUIET/^make.*Nothing to be done for/d" \ |
|
576 -e "$MQUIET/^[a-z\/]*cc/s/-W[-a-z]*//g" \ |
|
577 -e "$MQUIET/^[a-z\/]*cc/s@-m[0-9a-z=]*@@g" \ |
|
578 -e "$MQUIET/^[a-z\/]*cc/s@-D_FILE_OFFSET_BITS=64@@g" \ |
|
579 -e "$MQUIET/^[a-z\/]*cc/s@-D_LARGEFILE_SOURCE@@g" \ |
|
580 -e "$MQUIET/^[a-z\/]*cc/s@-D_REENTRANT@@g" \ |
|
581 -e "$MQUIET/^[a-z\/]*cc/s@-I[-a-zA-Z0-9/.]*@@g" \ |
|
582 -e "$MQUIET/^[a-z\/]*cc/s@-I[-a-zA-Z0-9/.]*@@g" \ |
|
583 -e "$MQUIET/^[a-z\/]*cc/s@-fno-strict-aliasing@@g" \ |
|
584 -e "$MQUIET/^[a-z\/]*cc/s@-pipe@@g" \ |
|
585 -e "$MQUIET/^building static .* library/d" \ |
|
586 -e "$MQUIET/^ranlib/d" \ |
|
587 -e "$MQUIET/^rm -f \.depend/d" \ |
|
588 -e "$MQUIET/^mkdep/d" \ |
|
589 -e "$MQUIET/^echo .* >> \.depend/d" \ |
|
590 -e "$MQUIET/^g*cc/s@[ ]\{1,\}@ @g" |
|
591 |
|
592 touch $OK_MARK |
|
593 |
|
594 # finally start the new version and switch back to the local server |
|
595 trap $TRAPS |
|
596 $DCC_RESTART |
|
597 @bindir@/cdcc -q rtt >/dev/null 2>&1 |