1247738Sbapt#!/bin/sh 2247738Sbapt# install - install a program, script, or datafile 3247738Sbapt 4247738Sbaptscriptversion=2009-04-28.21; # UTC 5247738Sbapt 6247738Sbapt# This originates from X11R5 (mit/util/scripts/install.sh), which was 7247738Sbapt# later released in X11R6 (xc/config/util/install.sh) with the 8247738Sbapt# following copyright and license. 9247738Sbapt# 10247738Sbapt# Copyright (C) 1994 X Consortium 11247738Sbapt# 12247738Sbapt# Permission is hereby granted, free of charge, to any person obtaining a copy 13247738Sbapt# of this software and associated documentation files (the "Software"), to 14247738Sbapt# deal in the Software without restriction, including without limitation the 15247738Sbapt# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16247738Sbapt# sell copies of the Software, and to permit persons to whom the Software is 17247738Sbapt# furnished to do so, subject to the following conditions: 18247738Sbapt# 19247738Sbapt# The above copyright notice and this permission notice shall be included in 20247738Sbapt# all copies or substantial portions of the Software. 21247738Sbapt# 22247738Sbapt# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23247738Sbapt# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24247738Sbapt# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25247738Sbapt# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26247738Sbapt# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27247738Sbapt# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28247738Sbapt# 29247738Sbapt# Except as contained in this notice, the name of the X Consortium shall not 30247738Sbapt# be used in advertising or otherwise to promote the sale, use or other deal- 31247738Sbapt# ings in this Software without prior written authorization from the X Consor- 32247738Sbapt# tium. 33247738Sbapt# 34247738Sbapt# 35247738Sbapt# FSF changes to this file are in the public domain. 36247738Sbapt# 37247738Sbapt# Calling this script install-sh is preferred over install.sh, to prevent 38247738Sbapt# `make' implicit rules from creating a file called install from it 39247738Sbapt# when there is no Makefile. 40247738Sbapt# 41247738Sbapt# This script is compatible with the BSD install script, but was written 42247738Sbapt# from scratch. 43247738Sbapt 44247738Sbaptnl=' 45247738Sbapt' 46247738SbaptIFS=" "" $nl" 47247738Sbapt 48247738Sbapt# set DOITPROG to echo to test this script 49247738Sbapt 50247738Sbapt# Don't use :- since 4.3BSD and earlier shells don't like it. 51247738Sbaptdoit=${DOITPROG-} 52247738Sbaptif test -z "$doit"; then 53247738Sbapt doit_exec=exec 54247738Sbaptelse 55247738Sbapt doit_exec=$doit 56247738Sbaptfi 57247738Sbapt 58247738Sbapt# Put in absolute file names if you don't have them in your path; 59247738Sbapt# or use environment vars. 60247738Sbapt 61247738Sbaptchgrpprog=${CHGRPPROG-chgrp} 62247738Sbaptchmodprog=${CHMODPROG-chmod} 63247738Sbaptchownprog=${CHOWNPROG-chown} 64247738Sbaptcmpprog=${CMPPROG-cmp} 65247738Sbaptcpprog=${CPPROG-cp} 66247738Sbaptmkdirprog=${MKDIRPROG-mkdir} 67247738Sbaptmvprog=${MVPROG-mv} 68247738Sbaptrmprog=${RMPROG-rm} 69247738Sbaptstripprog=${STRIPPROG-strip} 70247738Sbapt 71247738Sbaptposix_glob='?' 72247738Sbaptinitialize_posix_glob=' 73247738Sbapt test "$posix_glob" != "?" || { 74247738Sbapt if (set -f) 2>/dev/null; then 75247738Sbapt posix_glob= 76247738Sbapt else 77247738Sbapt posix_glob=: 78247738Sbapt fi 79247738Sbapt } 80247738Sbapt' 81247738Sbapt 82247738Sbaptposix_mkdir= 83247738Sbapt 84247738Sbapt# Desired mode of installed file. 85247738Sbaptmode=0755 86247738Sbapt 87247738Sbaptchgrpcmd= 88247738Sbaptchmodcmd=$chmodprog 89247738Sbaptchowncmd= 90247738Sbaptmvcmd=$mvprog 91247738Sbaptrmcmd="$rmprog -f" 92247738Sbaptstripcmd= 93247738Sbapt 94247738Sbaptsrc= 95247738Sbaptdst= 96247738Sbaptdir_arg= 97247738Sbaptdst_arg= 98247738Sbapt 99247738Sbaptcopy_on_change=false 100247738Sbaptno_target_directory= 101247738Sbapt 102247738Sbaptusage="\ 103247738SbaptUsage: $0 [OPTION]... [-T] SRCFILE DSTFILE 104247738Sbapt or: $0 [OPTION]... SRCFILES... DIRECTORY 105247738Sbapt or: $0 [OPTION]... -t DIRECTORY SRCFILES... 106247738Sbapt or: $0 [OPTION]... -d DIRECTORIES... 107247738Sbapt 108247738SbaptIn the 1st form, copy SRCFILE to DSTFILE. 109247738SbaptIn the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 110247738SbaptIn the 4th, create DIRECTORIES. 111247738Sbapt 112247738SbaptOptions: 113247738Sbapt --help display this help and exit. 114247738Sbapt --version display version info and exit. 115247738Sbapt 116247738Sbapt -c (ignored) 117247738Sbapt -C install only if different (preserve the last data modification time) 118247738Sbapt -d create directories instead of installing files. 119247738Sbapt -g GROUP $chgrpprog installed files to GROUP. 120247738Sbapt -m MODE $chmodprog installed files to MODE. 121247738Sbapt -o USER $chownprog installed files to USER. 122247738Sbapt -s $stripprog installed files. 123247738Sbapt -t DIRECTORY install into DIRECTORY. 124247738Sbapt -T report an error if DSTFILE is a directory. 125247738Sbapt 126247738SbaptEnvironment variables override the default commands: 127247738Sbapt CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG 128247738Sbapt RMPROG STRIPPROG 129247738Sbapt" 130247738Sbapt 131247738Sbaptwhile test $# -ne 0; do 132247738Sbapt case $1 in 133247738Sbapt -c) ;; 134247738Sbapt 135247738Sbapt -C) copy_on_change=true;; 136247738Sbapt 137247738Sbapt -d) dir_arg=true;; 138247738Sbapt 139247738Sbapt -g) chgrpcmd="$chgrpprog $2" 140247738Sbapt shift;; 141247738Sbapt 142247738Sbapt --help) echo "$usage"; exit $?;; 143247738Sbapt 144247738Sbapt -m) mode=$2 145247738Sbapt case $mode in 146247738Sbapt *' '* | *' '* | *' 147247738Sbapt'* | *'*'* | *'?'* | *'['*) 148247738Sbapt echo "$0: invalid mode: $mode" >&2 149247738Sbapt exit 1;; 150247738Sbapt esac 151247738Sbapt shift;; 152247738Sbapt 153247738Sbapt -o) chowncmd="$chownprog $2" 154247738Sbapt shift;; 155247738Sbapt 156247738Sbapt -s) stripcmd=$stripprog;; 157247738Sbapt 158247738Sbapt -t) dst_arg=$2 159247738Sbapt shift;; 160247738Sbapt 161247738Sbapt -T) no_target_directory=true;; 162247738Sbapt 163247738Sbapt --version) echo "$0 $scriptversion"; exit $?;; 164247738Sbapt 165247738Sbapt --) shift 166247738Sbapt break;; 167247738Sbapt 168247738Sbapt -*) echo "$0: invalid option: $1" >&2 169247738Sbapt exit 1;; 170247738Sbapt 171247738Sbapt *) break;; 172247738Sbapt esac 173247738Sbapt shift 174247738Sbaptdone 175247738Sbapt 176247738Sbaptif test $# -ne 0 && test -z "$dir_arg$dst_arg"; then 177247738Sbapt # When -d is used, all remaining arguments are directories to create. 178247738Sbapt # When -t is used, the destination is already specified. 179247738Sbapt # Otherwise, the last argument is the destination. Remove it from $@. 180247738Sbapt for arg 181247738Sbapt do 182247738Sbapt if test -n "$dst_arg"; then 183247738Sbapt # $@ is not empty: it contains at least $arg. 184247738Sbapt set fnord "$@" "$dst_arg" 185247738Sbapt shift # fnord 186247738Sbapt fi 187247738Sbapt shift # arg 188247738Sbapt dst_arg=$arg 189247738Sbapt done 190247738Sbaptfi 191247738Sbapt 192247738Sbaptif test $# -eq 0; then 193247738Sbapt if test -z "$dir_arg"; then 194247738Sbapt echo "$0: no input file specified." >&2 195247738Sbapt exit 1 196247738Sbapt fi 197247738Sbapt # It's OK to call `install-sh -d' without argument. 198247738Sbapt # This can happen when creating conditional directories. 199247738Sbapt exit 0 200247738Sbaptfi 201247738Sbapt 202247738Sbaptif test -z "$dir_arg"; then 203247738Sbapt trap '(exit $?); exit' 1 2 13 15 204247738Sbapt 205247738Sbapt # Set umask so as not to create temps with too-generous modes. 206247738Sbapt # However, 'strip' requires both read and write access to temps. 207247738Sbapt case $mode in 208247738Sbapt # Optimize common cases. 209247738Sbapt *644) cp_umask=133;; 210247738Sbapt *755) cp_umask=22;; 211247738Sbapt 212247738Sbapt *[0-7]) 213247738Sbapt if test -z "$stripcmd"; then 214247738Sbapt u_plus_rw= 215247738Sbapt else 216247738Sbapt u_plus_rw='% 200' 217247738Sbapt fi 218247738Sbapt cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; 219247738Sbapt *) 220247738Sbapt if test -z "$stripcmd"; then 221247738Sbapt u_plus_rw= 222247738Sbapt else 223247738Sbapt u_plus_rw=,u+rw 224247738Sbapt fi 225247738Sbapt cp_umask=$mode$u_plus_rw;; 226247738Sbapt esac 227247738Sbaptfi 228247738Sbapt 229247738Sbaptfor src 230247738Sbaptdo 231247738Sbapt # Protect names starting with `-'. 232247738Sbapt case $src in 233247738Sbapt -*) src=./$src;; 234247738Sbapt esac 235247738Sbapt 236247738Sbapt if test -n "$dir_arg"; then 237247738Sbapt dst=$src 238247738Sbapt dstdir=$dst 239247738Sbapt test -d "$dstdir" 240247738Sbapt dstdir_status=$? 241247738Sbapt else 242247738Sbapt 243247738Sbapt # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 244247738Sbapt # might cause directories to be created, which would be especially bad 245247738Sbapt # if $src (and thus $dsttmp) contains '*'. 246247738Sbapt if test ! -f "$src" && test ! -d "$src"; then 247247738Sbapt echo "$0: $src does not exist." >&2 248247738Sbapt exit 1 249247738Sbapt fi 250247738Sbapt 251247738Sbapt if test -z "$dst_arg"; then 252247738Sbapt echo "$0: no destination specified." >&2 253247738Sbapt exit 1 254247738Sbapt fi 255247738Sbapt 256247738Sbapt dst=$dst_arg 257247738Sbapt # Protect names starting with `-'. 258247738Sbapt case $dst in 259247738Sbapt -*) dst=./$dst;; 260247738Sbapt esac 261247738Sbapt 262247738Sbapt # If destination is a directory, append the input filename; won't work 263247738Sbapt # if double slashes aren't ignored. 264247738Sbapt if test -d "$dst"; then 265247738Sbapt if test -n "$no_target_directory"; then 266247738Sbapt echo "$0: $dst_arg: Is a directory" >&2 267247738Sbapt exit 1 268247738Sbapt fi 269247738Sbapt dstdir=$dst 270247738Sbapt dst=$dstdir/`basename "$src"` 271247738Sbapt dstdir_status=0 272247738Sbapt else 273247738Sbapt # Prefer dirname, but fall back on a substitute if dirname fails. 274247738Sbapt dstdir=` 275247738Sbapt (dirname "$dst") 2>/dev/null || 276247738Sbapt expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 277247738Sbapt X"$dst" : 'X\(//\)[^/]' \| \ 278247738Sbapt X"$dst" : 'X\(//\)$' \| \ 279247738Sbapt X"$dst" : 'X\(/\)' \| . 2>/dev/null || 280247738Sbapt echo X"$dst" | 281247738Sbapt sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 282247738Sbapt s//\1/ 283247738Sbapt q 284247738Sbapt } 285247738Sbapt /^X\(\/\/\)[^/].*/{ 286247738Sbapt s//\1/ 287247738Sbapt q 288247738Sbapt } 289247738Sbapt /^X\(\/\/\)$/{ 290247738Sbapt s//\1/ 291247738Sbapt q 292247738Sbapt } 293247738Sbapt /^X\(\/\).*/{ 294247738Sbapt s//\1/ 295247738Sbapt q 296247738Sbapt } 297247738Sbapt s/.*/./; q' 298247738Sbapt ` 299247738Sbapt 300247738Sbapt test -d "$dstdir" 301247738Sbapt dstdir_status=$? 302247738Sbapt fi 303247738Sbapt fi 304247738Sbapt 305247738Sbapt obsolete_mkdir_used=false 306247738Sbapt 307247738Sbapt if test $dstdir_status != 0; then 308247738Sbapt case $posix_mkdir in 309247738Sbapt '') 310247738Sbapt # Create intermediate dirs using mode 755 as modified by the umask. 311247738Sbapt # This is like FreeBSD 'install' as of 1997-10-28. 312247738Sbapt umask=`umask` 313247738Sbapt case $stripcmd.$umask in 314247738Sbapt # Optimize common cases. 315247738Sbapt *[2367][2367]) mkdir_umask=$umask;; 316247738Sbapt .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; 317247738Sbapt 318247738Sbapt *[0-7]) 319247738Sbapt mkdir_umask=`expr $umask + 22 \ 320247738Sbapt - $umask % 100 % 40 + $umask % 20 \ 321247738Sbapt - $umask % 10 % 4 + $umask % 2 322247738Sbapt `;; 323247738Sbapt *) mkdir_umask=$umask,go-w;; 324247738Sbapt esac 325247738Sbapt 326247738Sbapt # With -d, create the new directory with the user-specified mode. 327247738Sbapt # Otherwise, rely on $mkdir_umask. 328247738Sbapt if test -n "$dir_arg"; then 329247738Sbapt mkdir_mode=-m$mode 330247738Sbapt else 331247738Sbapt mkdir_mode= 332247738Sbapt fi 333247738Sbapt 334247738Sbapt posix_mkdir=false 335247738Sbapt case $umask in 336247738Sbapt *[123567][0-7][0-7]) 337247738Sbapt # POSIX mkdir -p sets u+wx bits regardless of umask, which 338247738Sbapt # is incompatible with FreeBSD 'install' when (umask & 300) != 0. 339247738Sbapt ;; 340247738Sbapt *) 341247738Sbapt tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ 342247738Sbapt trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 343247738Sbapt 344247738Sbapt if (umask $mkdir_umask && 345247738Sbapt exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 346247738Sbapt then 347247738Sbapt if test -z "$dir_arg" || { 348247738Sbapt # Check for POSIX incompatibilities with -m. 349247738Sbapt # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or 350247738Sbapt # other-writeable bit of parent directory when it shouldn't. 351247738Sbapt # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. 352247738Sbapt ls_ld_tmpdir=`ls -ld "$tmpdir"` 353247738Sbapt case $ls_ld_tmpdir in 354247738Sbapt d????-?r-*) different_mode=700;; 355247738Sbapt d????-?--*) different_mode=755;; 356247738Sbapt *) false;; 357247738Sbapt esac && 358247738Sbapt $mkdirprog -m$different_mode -p -- "$tmpdir" && { 359247738Sbapt ls_ld_tmpdir_1=`ls -ld "$tmpdir"` 360247738Sbapt test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" 361247738Sbapt } 362247738Sbapt } 363247738Sbapt then posix_mkdir=: 364247738Sbapt fi 365247738Sbapt rmdir "$tmpdir/d" "$tmpdir" 366247738Sbapt else 367247738Sbapt # Remove any dirs left behind by ancient mkdir implementations. 368247738Sbapt rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null 369247738Sbapt fi 370247738Sbapt trap '' 0;; 371247738Sbapt esac;; 372247738Sbapt esac 373247738Sbapt 374247738Sbapt if 375247738Sbapt $posix_mkdir && ( 376247738Sbapt umask $mkdir_umask && 377247738Sbapt $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" 378247738Sbapt ) 379247738Sbapt then : 380247738Sbapt else 381247738Sbapt 382247738Sbapt # The umask is ridiculous, or mkdir does not conform to POSIX, 383247738Sbapt # or it failed possibly due to a race condition. Create the 384247738Sbapt # directory the slow way, step by step, checking for races as we go. 385247738Sbapt 386247738Sbapt case $dstdir in 387247738Sbapt /*) prefix='/';; 388247738Sbapt -*) prefix='./';; 389247738Sbapt *) prefix='';; 390247738Sbapt esac 391247738Sbapt 392247738Sbapt eval "$initialize_posix_glob" 393247738Sbapt 394247738Sbapt oIFS=$IFS 395247738Sbapt IFS=/ 396247738Sbapt $posix_glob set -f 397247738Sbapt set fnord $dstdir 398247738Sbapt shift 399247738Sbapt $posix_glob set +f 400247738Sbapt IFS=$oIFS 401247738Sbapt 402247738Sbapt prefixes= 403247738Sbapt 404247738Sbapt for d 405247738Sbapt do 406247738Sbapt test -z "$d" && continue 407247738Sbapt 408247738Sbapt prefix=$prefix$d 409247738Sbapt if test -d "$prefix"; then 410247738Sbapt prefixes= 411247738Sbapt else 412247738Sbapt if $posix_mkdir; then 413247738Sbapt (umask=$mkdir_umask && 414247738Sbapt $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break 415247738Sbapt # Don't fail if two instances are running concurrently. 416247738Sbapt test -d "$prefix" || exit 1 417247738Sbapt else 418247738Sbapt case $prefix in 419247738Sbapt *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; 420247738Sbapt *) qprefix=$prefix;; 421247738Sbapt esac 422247738Sbapt prefixes="$prefixes '$qprefix'" 423247738Sbapt fi 424247738Sbapt fi 425247738Sbapt prefix=$prefix/ 426247738Sbapt done 427247738Sbapt 428247738Sbapt if test -n "$prefixes"; then 429247738Sbapt # Don't fail if two instances are running concurrently. 430247738Sbapt (umask $mkdir_umask && 431247738Sbapt eval "\$doit_exec \$mkdirprog $prefixes") || 432247738Sbapt test -d "$dstdir" || exit 1 433247738Sbapt obsolete_mkdir_used=true 434247738Sbapt fi 435247738Sbapt fi 436247738Sbapt fi 437247738Sbapt 438247738Sbapt if test -n "$dir_arg"; then 439247738Sbapt { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && 440247738Sbapt { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && 441247738Sbapt { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || 442247738Sbapt test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 443247738Sbapt else 444247738Sbapt 445247738Sbapt # Make a couple of temp file names in the proper directory. 446247738Sbapt dsttmp=$dstdir/_inst.$$_ 447247738Sbapt rmtmp=$dstdir/_rm.$$_ 448247738Sbapt 449247738Sbapt # Trap to clean up those temp files at exit. 450247738Sbapt trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 451247738Sbapt 452247738Sbapt # Copy the file name to the temp name. 453247738Sbapt (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && 454247738Sbapt 455247738Sbapt # and set any options; do chmod last to preserve setuid bits. 456247738Sbapt # 457247738Sbapt # If any of these fail, we abort the whole thing. If we want to 458247738Sbapt # ignore errors from any of these, just make sure not to ignore 459247738Sbapt # errors from the above "$doit $cpprog $src $dsttmp" command. 460247738Sbapt # 461247738Sbapt { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && 462247738Sbapt { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && 463247738Sbapt { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && 464247738Sbapt { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && 465247738Sbapt 466247738Sbapt # If -C, don't bother to copy if it wouldn't change the file. 467247738Sbapt if $copy_on_change && 468247738Sbapt old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && 469247738Sbapt new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && 470247738Sbapt 471247738Sbapt eval "$initialize_posix_glob" && 472247738Sbapt $posix_glob set -f && 473247738Sbapt set X $old && old=:$2:$4:$5:$6 && 474247738Sbapt set X $new && new=:$2:$4:$5:$6 && 475247738Sbapt $posix_glob set +f && 476247738Sbapt 477247738Sbapt test "$old" = "$new" && 478247738Sbapt $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 479247738Sbapt then 480247738Sbapt rm -f "$dsttmp" 481247738Sbapt else 482247738Sbapt # Rename the file to the real destination. 483247738Sbapt $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || 484247738Sbapt 485247738Sbapt # The rename failed, perhaps because mv can't rename something else 486247738Sbapt # to itself, or perhaps because mv is so ancient that it does not 487247738Sbapt # support -f. 488247738Sbapt { 489247738Sbapt # Now remove or move aside any old file at destination location. 490247738Sbapt # We try this two ways since rm can't unlink itself on some 491247738Sbapt # systems and the destination file might be busy for other 492247738Sbapt # reasons. In this case, the final cleanup might fail but the new 493247738Sbapt # file should still install successfully. 494247738Sbapt { 495247738Sbapt test ! -f "$dst" || 496247738Sbapt $doit $rmcmd -f "$dst" 2>/dev/null || 497247738Sbapt { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && 498247738Sbapt { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } 499247738Sbapt } || 500247738Sbapt { echo "$0: cannot unlink or rename $dst" >&2 501247738Sbapt (exit 1); exit 1 502247738Sbapt } 503247738Sbapt } && 504247738Sbapt 505247738Sbapt # Now rename the file to the real destination. 506247738Sbapt $doit $mvcmd "$dsttmp" "$dst" 507247738Sbapt } 508247738Sbapt fi || exit 1 509247738Sbapt 510247738Sbapt trap '' 0 511247738Sbapt fi 512247738Sbaptdone 513247738Sbapt 514247738Sbapt# Local variables: 515247738Sbapt# eval: (add-hook 'write-file-hooks 'time-stamp) 516247738Sbapt# time-stamp-start: "scriptversion=" 517247738Sbapt# time-stamp-format: "%:y-%02m-%02d.%02H" 518247738Sbapt# time-stamp-time-zone: "UTC" 519247738Sbapt# time-stamp-end: "; # UTC" 520247738Sbapt# End: 521