annotate src/libsndfile-1.0.27/Cfg/install-sh @ 125:cd6cdf86811e

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