annotate src/libsamplerate-0.1.9/Cfg/install-sh @ 126:4a7071416412

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