annotate src/fftw-3.3.8/install-sh @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents d0c2a83c1364
children
rev   line source
Chris@82 1 #!/bin/sh
Chris@82 2 # install - install a program, script, or datafile
Chris@82 3
Chris@82 4 scriptversion=2014-09-12.12; # UTC
Chris@82 5
Chris@82 6 # This originates from X11R5 (mit/util/scripts/install.sh), which was
Chris@82 7 # later released in X11R6 (xc/config/util/install.sh) with the
Chris@82 8 # following copyright and license.
Chris@82 9 #
Chris@82 10 # Copyright (C) 1994 X Consortium
Chris@82 11 #
Chris@82 12 # Permission is hereby granted, free of charge, to any person obtaining a copy
Chris@82 13 # of this software and associated documentation files (the "Software"), to
Chris@82 14 # deal in the Software without restriction, including without limitation the
Chris@82 15 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
Chris@82 16 # sell copies of the Software, and to permit persons to whom the Software is
Chris@82 17 # furnished to do so, subject to the following conditions:
Chris@82 18 #
Chris@82 19 # The above copyright notice and this permission notice shall be included in
Chris@82 20 # all copies or substantial portions of the Software.
Chris@82 21 #
Chris@82 22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Chris@82 23 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Chris@82 24 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Chris@82 25 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
Chris@82 26 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
Chris@82 27 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@82 28 #
Chris@82 29 # Except as contained in this notice, the name of the X Consortium shall not
Chris@82 30 # be used in advertising or otherwise to promote the sale, use or other deal-
Chris@82 31 # ings in this Software without prior written authorization from the X Consor-
Chris@82 32 # tium.
Chris@82 33 #
Chris@82 34 #
Chris@82 35 # FSF changes to this file are in the public domain.
Chris@82 36 #
Chris@82 37 # Calling this script install-sh is preferred over install.sh, to prevent
Chris@82 38 # 'make' implicit rules from creating a file called install from it
Chris@82 39 # when there is no Makefile.
Chris@82 40 #
Chris@82 41 # This script is compatible with the BSD install script, but was written
Chris@82 42 # from scratch.
Chris@82 43
Chris@82 44 tab=' '
Chris@82 45 nl='
Chris@82 46 '
Chris@82 47 IFS=" $tab$nl"
Chris@82 48
Chris@82 49 # Set DOITPROG to "echo" to test this script.
Chris@82 50
Chris@82 51 doit=${DOITPROG-}
Chris@82 52 doit_exec=${doit:-exec}
Chris@82 53
Chris@82 54 # Put in absolute file names if you don't have them in your path;
Chris@82 55 # or use environment vars.
Chris@82 56
Chris@82 57 chgrpprog=${CHGRPPROG-chgrp}
Chris@82 58 chmodprog=${CHMODPROG-chmod}
Chris@82 59 chownprog=${CHOWNPROG-chown}
Chris@82 60 cmpprog=${CMPPROG-cmp}
Chris@82 61 cpprog=${CPPROG-cp}
Chris@82 62 mkdirprog=${MKDIRPROG-mkdir}
Chris@82 63 mvprog=${MVPROG-mv}
Chris@82 64 rmprog=${RMPROG-rm}
Chris@82 65 stripprog=${STRIPPROG-strip}
Chris@82 66
Chris@82 67 posix_mkdir=
Chris@82 68
Chris@82 69 # Desired mode of installed file.
Chris@82 70 mode=0755
Chris@82 71
Chris@82 72 chgrpcmd=
Chris@82 73 chmodcmd=$chmodprog
Chris@82 74 chowncmd=
Chris@82 75 mvcmd=$mvprog
Chris@82 76 rmcmd="$rmprog -f"
Chris@82 77 stripcmd=
Chris@82 78
Chris@82 79 src=
Chris@82 80 dst=
Chris@82 81 dir_arg=
Chris@82 82 dst_arg=
Chris@82 83
Chris@82 84 copy_on_change=false
Chris@82 85 is_target_a_directory=possibly
Chris@82 86
Chris@82 87 usage="\
Chris@82 88 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
Chris@82 89 or: $0 [OPTION]... SRCFILES... DIRECTORY
Chris@82 90 or: $0 [OPTION]... -t DIRECTORY SRCFILES...
Chris@82 91 or: $0 [OPTION]... -d DIRECTORIES...
Chris@82 92
Chris@82 93 In the 1st form, copy SRCFILE to DSTFILE.
Chris@82 94 In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
Chris@82 95 In the 4th, create DIRECTORIES.
Chris@82 96
Chris@82 97 Options:
Chris@82 98 --help display this help and exit.
Chris@82 99 --version display version info and exit.
Chris@82 100
Chris@82 101 -c (ignored)
Chris@82 102 -C install only if different (preserve the last data modification time)
Chris@82 103 -d create directories instead of installing files.
Chris@82 104 -g GROUP $chgrpprog installed files to GROUP.
Chris@82 105 -m MODE $chmodprog installed files to MODE.
Chris@82 106 -o USER $chownprog installed files to USER.
Chris@82 107 -s $stripprog installed files.
Chris@82 108 -t DIRECTORY install into DIRECTORY.
Chris@82 109 -T report an error if DSTFILE is a directory.
Chris@82 110
Chris@82 111 Environment variables override the default commands:
Chris@82 112 CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
Chris@82 113 RMPROG STRIPPROG
Chris@82 114 "
Chris@82 115
Chris@82 116 while test $# -ne 0; do
Chris@82 117 case $1 in
Chris@82 118 -c) ;;
Chris@82 119
Chris@82 120 -C) copy_on_change=true;;
Chris@82 121
Chris@82 122 -d) dir_arg=true;;
Chris@82 123
Chris@82 124 -g) chgrpcmd="$chgrpprog $2"
Chris@82 125 shift;;
Chris@82 126
Chris@82 127 --help) echo "$usage"; exit $?;;
Chris@82 128
Chris@82 129 -m) mode=$2
Chris@82 130 case $mode in
Chris@82 131 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
Chris@82 132 echo "$0: invalid mode: $mode" >&2
Chris@82 133 exit 1;;
Chris@82 134 esac
Chris@82 135 shift;;
Chris@82 136
Chris@82 137 -o) chowncmd="$chownprog $2"
Chris@82 138 shift;;
Chris@82 139
Chris@82 140 -s) stripcmd=$stripprog;;
Chris@82 141
Chris@82 142 -t)
Chris@82 143 is_target_a_directory=always
Chris@82 144 dst_arg=$2
Chris@82 145 # Protect names problematic for 'test' and other utilities.
Chris@82 146 case $dst_arg in
Chris@82 147 -* | [=\(\)!]) dst_arg=./$dst_arg;;
Chris@82 148 esac
Chris@82 149 shift;;
Chris@82 150
Chris@82 151 -T) is_target_a_directory=never;;
Chris@82 152
Chris@82 153 --version) echo "$0 $scriptversion"; exit $?;;
Chris@82 154
Chris@82 155 --) shift
Chris@82 156 break;;
Chris@82 157
Chris@82 158 -*) echo "$0: invalid option: $1" >&2
Chris@82 159 exit 1;;
Chris@82 160
Chris@82 161 *) break;;
Chris@82 162 esac
Chris@82 163 shift
Chris@82 164 done
Chris@82 165
Chris@82 166 # We allow the use of options -d and -T together, by making -d
Chris@82 167 # take the precedence; this is for compatibility with GNU install.
Chris@82 168
Chris@82 169 if test -n "$dir_arg"; then
Chris@82 170 if test -n "$dst_arg"; then
Chris@82 171 echo "$0: target directory not allowed when installing a directory." >&2
Chris@82 172 exit 1
Chris@82 173 fi
Chris@82 174 fi
Chris@82 175
Chris@82 176 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
Chris@82 177 # When -d is used, all remaining arguments are directories to create.
Chris@82 178 # When -t is used, the destination is already specified.
Chris@82 179 # Otherwise, the last argument is the destination. Remove it from $@.
Chris@82 180 for arg
Chris@82 181 do
Chris@82 182 if test -n "$dst_arg"; then
Chris@82 183 # $@ is not empty: it contains at least $arg.
Chris@82 184 set fnord "$@" "$dst_arg"
Chris@82 185 shift # fnord
Chris@82 186 fi
Chris@82 187 shift # arg
Chris@82 188 dst_arg=$arg
Chris@82 189 # Protect names problematic for 'test' and other utilities.
Chris@82 190 case $dst_arg in
Chris@82 191 -* | [=\(\)!]) dst_arg=./$dst_arg;;
Chris@82 192 esac
Chris@82 193 done
Chris@82 194 fi
Chris@82 195
Chris@82 196 if test $# -eq 0; then
Chris@82 197 if test -z "$dir_arg"; then
Chris@82 198 echo "$0: no input file specified." >&2
Chris@82 199 exit 1
Chris@82 200 fi
Chris@82 201 # It's OK to call 'install-sh -d' without argument.
Chris@82 202 # This can happen when creating conditional directories.
Chris@82 203 exit 0
Chris@82 204 fi
Chris@82 205
Chris@82 206 if test -z "$dir_arg"; then
Chris@82 207 if test $# -gt 1 || test "$is_target_a_directory" = always; then
Chris@82 208 if test ! -d "$dst_arg"; then
Chris@82 209 echo "$0: $dst_arg: Is not a directory." >&2
Chris@82 210 exit 1
Chris@82 211 fi
Chris@82 212 fi
Chris@82 213 fi
Chris@82 214
Chris@82 215 if test -z "$dir_arg"; then
Chris@82 216 do_exit='(exit $ret); exit $ret'
Chris@82 217 trap "ret=129; $do_exit" 1
Chris@82 218 trap "ret=130; $do_exit" 2
Chris@82 219 trap "ret=141; $do_exit" 13
Chris@82 220 trap "ret=143; $do_exit" 15
Chris@82 221
Chris@82 222 # Set umask so as not to create temps with too-generous modes.
Chris@82 223 # However, 'strip' requires both read and write access to temps.
Chris@82 224 case $mode in
Chris@82 225 # Optimize common cases.
Chris@82 226 *644) cp_umask=133;;
Chris@82 227 *755) cp_umask=22;;
Chris@82 228
Chris@82 229 *[0-7])
Chris@82 230 if test -z "$stripcmd"; then
Chris@82 231 u_plus_rw=
Chris@82 232 else
Chris@82 233 u_plus_rw='% 200'
Chris@82 234 fi
Chris@82 235 cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
Chris@82 236 *)
Chris@82 237 if test -z "$stripcmd"; then
Chris@82 238 u_plus_rw=
Chris@82 239 else
Chris@82 240 u_plus_rw=,u+rw
Chris@82 241 fi
Chris@82 242 cp_umask=$mode$u_plus_rw;;
Chris@82 243 esac
Chris@82 244 fi
Chris@82 245
Chris@82 246 for src
Chris@82 247 do
Chris@82 248 # Protect names problematic for 'test' and other utilities.
Chris@82 249 case $src in
Chris@82 250 -* | [=\(\)!]) src=./$src;;
Chris@82 251 esac
Chris@82 252
Chris@82 253 if test -n "$dir_arg"; then
Chris@82 254 dst=$src
Chris@82 255 dstdir=$dst
Chris@82 256 test -d "$dstdir"
Chris@82 257 dstdir_status=$?
Chris@82 258 else
Chris@82 259
Chris@82 260 # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
Chris@82 261 # might cause directories to be created, which would be especially bad
Chris@82 262 # if $src (and thus $dsttmp) contains '*'.
Chris@82 263 if test ! -f "$src" && test ! -d "$src"; then
Chris@82 264 echo "$0: $src does not exist." >&2
Chris@82 265 exit 1
Chris@82 266 fi
Chris@82 267
Chris@82 268 if test -z "$dst_arg"; then
Chris@82 269 echo "$0: no destination specified." >&2
Chris@82 270 exit 1
Chris@82 271 fi
Chris@82 272 dst=$dst_arg
Chris@82 273
Chris@82 274 # If destination is a directory, append the input filename; won't work
Chris@82 275 # if double slashes aren't ignored.
Chris@82 276 if test -d "$dst"; then
Chris@82 277 if test "$is_target_a_directory" = never; then
Chris@82 278 echo "$0: $dst_arg: Is a directory" >&2
Chris@82 279 exit 1
Chris@82 280 fi
Chris@82 281 dstdir=$dst
Chris@82 282 dst=$dstdir/`basename "$src"`
Chris@82 283 dstdir_status=0
Chris@82 284 else
Chris@82 285 dstdir=`dirname "$dst"`
Chris@82 286 test -d "$dstdir"
Chris@82 287 dstdir_status=$?
Chris@82 288 fi
Chris@82 289 fi
Chris@82 290
Chris@82 291 obsolete_mkdir_used=false
Chris@82 292
Chris@82 293 if test $dstdir_status != 0; then
Chris@82 294 case $posix_mkdir in
Chris@82 295 '')
Chris@82 296 # Create intermediate dirs using mode 755 as modified by the umask.
Chris@82 297 # This is like FreeBSD 'install' as of 1997-10-28.
Chris@82 298 umask=`umask`
Chris@82 299 case $stripcmd.$umask in
Chris@82 300 # Optimize common cases.
Chris@82 301 *[2367][2367]) mkdir_umask=$umask;;
Chris@82 302 .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
Chris@82 303
Chris@82 304 *[0-7])
Chris@82 305 mkdir_umask=`expr $umask + 22 \
Chris@82 306 - $umask % 100 % 40 + $umask % 20 \
Chris@82 307 - $umask % 10 % 4 + $umask % 2
Chris@82 308 `;;
Chris@82 309 *) mkdir_umask=$umask,go-w;;
Chris@82 310 esac
Chris@82 311
Chris@82 312 # With -d, create the new directory with the user-specified mode.
Chris@82 313 # Otherwise, rely on $mkdir_umask.
Chris@82 314 if test -n "$dir_arg"; then
Chris@82 315 mkdir_mode=-m$mode
Chris@82 316 else
Chris@82 317 mkdir_mode=
Chris@82 318 fi
Chris@82 319
Chris@82 320 posix_mkdir=false
Chris@82 321 case $umask in
Chris@82 322 *[123567][0-7][0-7])
Chris@82 323 # POSIX mkdir -p sets u+wx bits regardless of umask, which
Chris@82 324 # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
Chris@82 325 ;;
Chris@82 326 *)
Chris@82 327 # $RANDOM is not portable (e.g. dash); use it when possible to
Chris@82 328 # lower collision chance
Chris@82 329 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
Chris@82 330 trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
Chris@82 331
Chris@82 332 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so
Chris@82 333 # create the $tmpdir first (and fail if unsuccessful) to make sure
Chris@82 334 # that nobody tries to guess the $tmpdir name.
Chris@82 335 if (umask $mkdir_umask &&
Chris@82 336 $mkdirprog $mkdir_mode "$tmpdir" &&
Chris@82 337 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
Chris@82 338 then
Chris@82 339 if test -z "$dir_arg" || {
Chris@82 340 # Check for POSIX incompatibilities with -m.
Chris@82 341 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
Chris@82 342 # other-writable bit of parent directory when it shouldn't.
Chris@82 343 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
Chris@82 344 test_tmpdir="$tmpdir/a"
Chris@82 345 ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
Chris@82 346 case $ls_ld_tmpdir in
Chris@82 347 d????-?r-*) different_mode=700;;
Chris@82 348 d????-?--*) different_mode=755;;
Chris@82 349 *) false;;
Chris@82 350 esac &&
Chris@82 351 $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
Chris@82 352 ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
Chris@82 353 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
Chris@82 354 }
Chris@82 355 }
Chris@82 356 then posix_mkdir=:
Chris@82 357 fi
Chris@82 358 rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
Chris@82 359 else
Chris@82 360 # Remove any dirs left behind by ancient mkdir implementations.
Chris@82 361 rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
Chris@82 362 fi
Chris@82 363 trap '' 0;;
Chris@82 364 esac;;
Chris@82 365 esac
Chris@82 366
Chris@82 367 if
Chris@82 368 $posix_mkdir && (
Chris@82 369 umask $mkdir_umask &&
Chris@82 370 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
Chris@82 371 )
Chris@82 372 then :
Chris@82 373 else
Chris@82 374
Chris@82 375 # The umask is ridiculous, or mkdir does not conform to POSIX,
Chris@82 376 # or it failed possibly due to a race condition. Create the
Chris@82 377 # directory the slow way, step by step, checking for races as we go.
Chris@82 378
Chris@82 379 case $dstdir in
Chris@82 380 /*) prefix='/';;
Chris@82 381 [-=\(\)!]*) prefix='./';;
Chris@82 382 *) prefix='';;
Chris@82 383 esac
Chris@82 384
Chris@82 385 oIFS=$IFS
Chris@82 386 IFS=/
Chris@82 387 set -f
Chris@82 388 set fnord $dstdir
Chris@82 389 shift
Chris@82 390 set +f
Chris@82 391 IFS=$oIFS
Chris@82 392
Chris@82 393 prefixes=
Chris@82 394
Chris@82 395 for d
Chris@82 396 do
Chris@82 397 test X"$d" = X && continue
Chris@82 398
Chris@82 399 prefix=$prefix$d
Chris@82 400 if test -d "$prefix"; then
Chris@82 401 prefixes=
Chris@82 402 else
Chris@82 403 if $posix_mkdir; then
Chris@82 404 (umask=$mkdir_umask &&
Chris@82 405 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
Chris@82 406 # Don't fail if two instances are running concurrently.
Chris@82 407 test -d "$prefix" || exit 1
Chris@82 408 else
Chris@82 409 case $prefix in
Chris@82 410 *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
Chris@82 411 *) qprefix=$prefix;;
Chris@82 412 esac
Chris@82 413 prefixes="$prefixes '$qprefix'"
Chris@82 414 fi
Chris@82 415 fi
Chris@82 416 prefix=$prefix/
Chris@82 417 done
Chris@82 418
Chris@82 419 if test -n "$prefixes"; then
Chris@82 420 # Don't fail if two instances are running concurrently.
Chris@82 421 (umask $mkdir_umask &&
Chris@82 422 eval "\$doit_exec \$mkdirprog $prefixes") ||
Chris@82 423 test -d "$dstdir" || exit 1
Chris@82 424 obsolete_mkdir_used=true
Chris@82 425 fi
Chris@82 426 fi
Chris@82 427 fi
Chris@82 428
Chris@82 429 if test -n "$dir_arg"; then
Chris@82 430 { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
Chris@82 431 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
Chris@82 432 { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
Chris@82 433 test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
Chris@82 434 else
Chris@82 435
Chris@82 436 # Make a couple of temp file names in the proper directory.
Chris@82 437 dsttmp=$dstdir/_inst.$$_
Chris@82 438 rmtmp=$dstdir/_rm.$$_
Chris@82 439
Chris@82 440 # Trap to clean up those temp files at exit.
Chris@82 441 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
Chris@82 442
Chris@82 443 # Copy the file name to the temp name.
Chris@82 444 (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
Chris@82 445
Chris@82 446 # and set any options; do chmod last to preserve setuid bits.
Chris@82 447 #
Chris@82 448 # If any of these fail, we abort the whole thing. If we want to
Chris@82 449 # ignore errors from any of these, just make sure not to ignore
Chris@82 450 # errors from the above "$doit $cpprog $src $dsttmp" command.
Chris@82 451 #
Chris@82 452 { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
Chris@82 453 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
Chris@82 454 { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
Chris@82 455 { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
Chris@82 456
Chris@82 457 # If -C, don't bother to copy if it wouldn't change the file.
Chris@82 458 if $copy_on_change &&
Chris@82 459 old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
Chris@82 460 new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
Chris@82 461 set -f &&
Chris@82 462 set X $old && old=:$2:$4:$5:$6 &&
Chris@82 463 set X $new && new=:$2:$4:$5:$6 &&
Chris@82 464 set +f &&
Chris@82 465 test "$old" = "$new" &&
Chris@82 466 $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
Chris@82 467 then
Chris@82 468 rm -f "$dsttmp"
Chris@82 469 else
Chris@82 470 # Rename the file to the real destination.
Chris@82 471 $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
Chris@82 472
Chris@82 473 # The rename failed, perhaps because mv can't rename something else
Chris@82 474 # to itself, or perhaps because mv is so ancient that it does not
Chris@82 475 # support -f.
Chris@82 476 {
Chris@82 477 # Now remove or move aside any old file at destination location.
Chris@82 478 # We try this two ways since rm can't unlink itself on some
Chris@82 479 # systems and the destination file might be busy for other
Chris@82 480 # reasons. In this case, the final cleanup might fail but the new
Chris@82 481 # file should still install successfully.
Chris@82 482 {
Chris@82 483 test ! -f "$dst" ||
Chris@82 484 $doit $rmcmd -f "$dst" 2>/dev/null ||
Chris@82 485 { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
Chris@82 486 { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
Chris@82 487 } ||
Chris@82 488 { echo "$0: cannot unlink or rename $dst" >&2
Chris@82 489 (exit 1); exit 1
Chris@82 490 }
Chris@82 491 } &&
Chris@82 492
Chris@82 493 # Now rename the file to the real destination.
Chris@82 494 $doit $mvcmd "$dsttmp" "$dst"
Chris@82 495 }
Chris@82 496 fi || exit 1
Chris@82 497
Chris@82 498 trap '' 0
Chris@82 499 fi
Chris@82 500 done
Chris@82 501
Chris@82 502 # Local variables:
Chris@82 503 # eval: (add-hook 'write-file-hooks 'time-stamp)
Chris@82 504 # time-stamp-start: "scriptversion="
Chris@82 505 # time-stamp-format: "%:y-%02m-%02d.%02H"
Chris@82 506 # time-stamp-time-zone: "UTC"
Chris@82 507 # time-stamp-end: "; # UTC"
Chris@82 508 # End: