annotate install-sh @ 271:7b3a80021b7c piper-nopiper

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