annotate src/libsndfile-1.0.27/Cfg/install-sh @ 40:1df64224f5ac

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