annotate src/libogg-1.3.0/install-sh @ 1:05aa0afa9217

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