annotate src/libsamplerate-0.1.9/Cfg/install-sh @ 41:481f5f8c5634

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