install-sh revision 9f606849
19f606849Smrg#!/bin/sh 29f606849Smrg# install - install a program, script, or datafile 39f606849Smrg 49f606849Smrgscriptversion=2006-10-14.15 59f606849Smrg 69f606849Smrg# This originates from X11R5 (mit/util/scripts/install.sh), which was 79f606849Smrg# later released in X11R6 (xc/config/util/install.sh) with the 89f606849Smrg# following copyright and license. 99f606849Smrg# 109f606849Smrg# Copyright (C) 1994 X Consortium 119f606849Smrg# 129f606849Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy 139f606849Smrg# of this software and associated documentation files (the "Software"), to 149f606849Smrg# deal in the Software without restriction, including without limitation the 159f606849Smrg# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 169f606849Smrg# sell copies of the Software, and to permit persons to whom the Software is 179f606849Smrg# furnished to do so, subject to the following conditions: 189f606849Smrg# 199f606849Smrg# The above copyright notice and this permission notice shall be included in 209f606849Smrg# all copies or substantial portions of the Software. 219f606849Smrg# 229f606849Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 239f606849Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 249f606849Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 259f606849Smrg# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 269f606849Smrg# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 279f606849Smrg# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 289f606849Smrg# 299f606849Smrg# Except as contained in this notice, the name of the X Consortium shall not 309f606849Smrg# be used in advertising or otherwise to promote the sale, use or other deal- 319f606849Smrg# ings in this Software without prior written authorization from the X Consor- 329f606849Smrg# tium. 339f606849Smrg# 349f606849Smrg# 359f606849Smrg# FSF changes to this file are in the public domain. 369f606849Smrg# 379f606849Smrg# Calling this script install-sh is preferred over install.sh, to prevent 389f606849Smrg# `make' implicit rules from creating a file called install from it 399f606849Smrg# when there is no Makefile. 409f606849Smrg# 419f606849Smrg# This script is compatible with the BSD install script, but was written 429f606849Smrg# from scratch. 439f606849Smrg 449f606849Smrgnl=' 459f606849Smrg' 469f606849SmrgIFS=" "" $nl" 479f606849Smrg 489f606849Smrg# set DOITPROG to echo to test this script 499f606849Smrg 509f606849Smrg# Don't use :- since 4.3BSD and earlier shells don't like it. 519f606849Smrgdoit="${DOITPROG-}" 529f606849Smrgif test -z "$doit"; then 539f606849Smrg doit_exec=exec 549f606849Smrgelse 559f606849Smrg doit_exec=$doit 569f606849Smrgfi 579f606849Smrg 589f606849Smrg# Put in absolute file names if you don't have them in your path; 599f606849Smrg# or use environment vars. 609f606849Smrg 619f606849Smrgmvprog="${MVPROG-mv}" 629f606849Smrgcpprog="${CPPROG-cp}" 639f606849Smrgchmodprog="${CHMODPROG-chmod}" 649f606849Smrgchownprog="${CHOWNPROG-chown}" 659f606849Smrgchgrpprog="${CHGRPPROG-chgrp}" 669f606849Smrgstripprog="${STRIPPROG-strip}" 679f606849Smrgrmprog="${RMPROG-rm}" 689f606849Smrgmkdirprog="${MKDIRPROG-mkdir}" 699f606849Smrg 709f606849Smrgposix_glob= 719f606849Smrgposix_mkdir= 729f606849Smrg 739f606849Smrg# Desired mode of installed file. 749f606849Smrgmode=0755 759f606849Smrg 769f606849Smrgchmodcmd=$chmodprog 779f606849Smrgchowncmd= 789f606849Smrgchgrpcmd= 799f606849Smrgstripcmd= 809f606849Smrgrmcmd="$rmprog -f" 819f606849Smrgmvcmd="$mvprog" 829f606849Smrgsrc= 839f606849Smrgdst= 849f606849Smrgdir_arg= 859f606849Smrgdstarg= 869f606849Smrgno_target_directory= 879f606849Smrg 889f606849Smrgusage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE 899f606849Smrg or: $0 [OPTION]... SRCFILES... DIRECTORY 909f606849Smrg or: $0 [OPTION]... -t DIRECTORY SRCFILES... 919f606849Smrg or: $0 [OPTION]... -d DIRECTORIES... 929f606849Smrg 939f606849SmrgIn the 1st form, copy SRCFILE to DSTFILE. 949f606849SmrgIn the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 959f606849SmrgIn the 4th, create DIRECTORIES. 969f606849Smrg 979f606849SmrgOptions: 989f606849Smrg-c (ignored) 999f606849Smrg-d create directories instead of installing files. 1009f606849Smrg-g GROUP $chgrpprog installed files to GROUP. 1019f606849Smrg-m MODE $chmodprog installed files to MODE. 1029f606849Smrg-o USER $chownprog installed files to USER. 1039f606849Smrg-s $stripprog installed files. 1049f606849Smrg-t DIRECTORY install into DIRECTORY. 1059f606849Smrg-T report an error if DSTFILE is a directory. 1069f606849Smrg--help display this help and exit. 1079f606849Smrg--version display version info and exit. 1089f606849Smrg 1099f606849SmrgEnvironment variables override the default commands: 1109f606849Smrg CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG 1119f606849Smrg" 1129f606849Smrg 1139f606849Smrgwhile test $# -ne 0; do 1149f606849Smrg case $1 in 1159f606849Smrg -c) shift 1169f606849Smrg continue;; 1179f606849Smrg 1189f606849Smrg -d) dir_arg=true 1199f606849Smrg shift 1209f606849Smrg continue;; 1219f606849Smrg 1229f606849Smrg -g) chgrpcmd="$chgrpprog $2" 1239f606849Smrg shift 1249f606849Smrg shift 1259f606849Smrg continue;; 1269f606849Smrg 1279f606849Smrg --help) echo "$usage"; exit $?;; 1289f606849Smrg 1299f606849Smrg -m) mode=$2 1309f606849Smrg shift 1319f606849Smrg shift 1329f606849Smrg case $mode in 1339f606849Smrg *' '* | *' '* | *' 1349f606849Smrg'* | *'*'* | *'?'* | *'['*) 1359f606849Smrg echo "$0: invalid mode: $mode" >&2 1369f606849Smrg exit 1;; 1379f606849Smrg esac 1389f606849Smrg continue;; 1399f606849Smrg 1409f606849Smrg -o) chowncmd="$chownprog $2" 1419f606849Smrg shift 1429f606849Smrg shift 1439f606849Smrg continue;; 1449f606849Smrg 1459f606849Smrg -s) stripcmd=$stripprog 1469f606849Smrg shift 1479f606849Smrg continue;; 1489f606849Smrg 1499f606849Smrg -t) dstarg=$2 1509f606849Smrg shift 1519f606849Smrg shift 1529f606849Smrg continue;; 1539f606849Smrg 1549f606849Smrg -T) no_target_directory=true 1559f606849Smrg shift 1569f606849Smrg continue;; 1579f606849Smrg 1589f606849Smrg --version) echo "$0 $scriptversion"; exit $?;; 1599f606849Smrg 1609f606849Smrg --) shift 1619f606849Smrg break;; 1629f606849Smrg 1639f606849Smrg -*) echo "$0: invalid option: $1" >&2 1649f606849Smrg exit 1;; 1659f606849Smrg 1669f606849Smrg *) break;; 1679f606849Smrg esac 1689f606849Smrgdone 1699f606849Smrg 1709f606849Smrgif test $# -ne 0 && test -z "$dir_arg$dstarg"; then 1719f606849Smrg # When -d is used, all remaining arguments are directories to create. 1729f606849Smrg # When -t is used, the destination is already specified. 1739f606849Smrg # Otherwise, the last argument is the destination. Remove it from $@. 1749f606849Smrg for arg 1759f606849Smrg do 1769f606849Smrg if test -n "$dstarg"; then 1779f606849Smrg # $@ is not empty: it contains at least $arg. 1789f606849Smrg set fnord "$@" "$dstarg" 1799f606849Smrg shift # fnord 1809f606849Smrg fi 1819f606849Smrg shift # arg 1829f606849Smrg dstarg=$arg 1839f606849Smrg done 1849f606849Smrgfi 1859f606849Smrg 1869f606849Smrgif test $# -eq 0; then 1879f606849Smrg if test -z "$dir_arg"; then 1889f606849Smrg echo "$0: no input file specified." >&2 1899f606849Smrg exit 1 1909f606849Smrg fi 1919f606849Smrg # It's OK to call `install-sh -d' without argument. 1929f606849Smrg # This can happen when creating conditional directories. 1939f606849Smrg exit 0 1949f606849Smrgfi 1959f606849Smrg 1969f606849Smrgif test -z "$dir_arg"; then 1979f606849Smrg trap '(exit $?); exit' 1 2 13 15 1989f606849Smrg 1999f606849Smrg # Set umask so as not to create temps with too-generous modes. 2009f606849Smrg # However, 'strip' requires both read and write access to temps. 2019f606849Smrg case $mode in 2029f606849Smrg # Optimize common cases. 2039f606849Smrg *644) cp_umask=133;; 2049f606849Smrg *755) cp_umask=22;; 2059f606849Smrg 2069f606849Smrg *[0-7]) 2079f606849Smrg if test -z "$stripcmd"; then 2089f606849Smrg u_plus_rw= 2099f606849Smrg else 2109f606849Smrg u_plus_rw='% 200' 2119f606849Smrg fi 2129f606849Smrg cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; 2139f606849Smrg *) 2149f606849Smrg if test -z "$stripcmd"; then 2159f606849Smrg u_plus_rw= 2169f606849Smrg else 2179f606849Smrg u_plus_rw=,u+rw 2189f606849Smrg fi 2199f606849Smrg cp_umask=$mode$u_plus_rw;; 2209f606849Smrg esac 2219f606849Smrgfi 2229f606849Smrg 2239f606849Smrgfor src 2249f606849Smrgdo 2259f606849Smrg # Protect names starting with `-'. 2269f606849Smrg case $src in 2279f606849Smrg -*) src=./$src ;; 2289f606849Smrg esac 2299f606849Smrg 2309f606849Smrg if test -n "$dir_arg"; then 2319f606849Smrg dst=$src 2329f606849Smrg dstdir=$dst 2339f606849Smrg test -d "$dstdir" 2349f606849Smrg dstdir_status=$? 2359f606849Smrg else 2369f606849Smrg 2379f606849Smrg # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 2389f606849Smrg # might cause directories to be created, which would be especially bad 2399f606849Smrg # if $src (and thus $dsttmp) contains '*'. 2409f606849Smrg if test ! -f "$src" && test ! -d "$src"; then 2419f606849Smrg echo "$0: $src does not exist." >&2 2429f606849Smrg exit 1 2439f606849Smrg fi 2449f606849Smrg 2459f606849Smrg if test -z "$dstarg"; then 2469f606849Smrg echo "$0: no destination specified." >&2 2479f606849Smrg exit 1 2489f606849Smrg fi 2499f606849Smrg 2509f606849Smrg dst=$dstarg 2519f606849Smrg # Protect names starting with `-'. 2529f606849Smrg case $dst in 2539f606849Smrg -*) dst=./$dst ;; 2549f606849Smrg esac 2559f606849Smrg 2569f606849Smrg # If destination is a directory, append the input filename; won't work 2579f606849Smrg # if double slashes aren't ignored. 2589f606849Smrg if test -d "$dst"; then 2599f606849Smrg if test -n "$no_target_directory"; then 2609f606849Smrg echo "$0: $dstarg: Is a directory" >&2 2619f606849Smrg exit 1 2629f606849Smrg fi 2639f606849Smrg dstdir=$dst 2649f606849Smrg dst=$dstdir/`basename "$src"` 2659f606849Smrg dstdir_status=0 2669f606849Smrg else 2679f606849Smrg # Prefer dirname, but fall back on a substitute if dirname fails. 2689f606849Smrg dstdir=` 2699f606849Smrg (dirname "$dst") 2>/dev/null || 2709f606849Smrg expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 2719f606849Smrg X"$dst" : 'X\(//\)[^/]' \| \ 2729f606849Smrg X"$dst" : 'X\(//\)$' \| \ 2739f606849Smrg X"$dst" : 'X\(/\)' \| . 2>/dev/null || 2749f606849Smrg echo X"$dst" | 2759f606849Smrg sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 2769f606849Smrg s//\1/ 2779f606849Smrg q 2789f606849Smrg } 2799f606849Smrg /^X\(\/\/\)[^/].*/{ 2809f606849Smrg s//\1/ 2819f606849Smrg q 2829f606849Smrg } 2839f606849Smrg /^X\(\/\/\)$/{ 2849f606849Smrg s//\1/ 2859f606849Smrg q 2869f606849Smrg } 2879f606849Smrg /^X\(\/\).*/{ 2889f606849Smrg s//\1/ 2899f606849Smrg q 2909f606849Smrg } 2919f606849Smrg s/.*/./; q' 2929f606849Smrg ` 2939f606849Smrg 2949f606849Smrg test -d "$dstdir" 2959f606849Smrg dstdir_status=$? 2969f606849Smrg fi 2979f606849Smrg fi 2989f606849Smrg 2999f606849Smrg obsolete_mkdir_used=false 3009f606849Smrg 3019f606849Smrg if test $dstdir_status != 0; then 3029f606849Smrg case $posix_mkdir in 3039f606849Smrg '') 3049f606849Smrg # Create intermediate dirs using mode 755 as modified by the umask. 3059f606849Smrg # This is like FreeBSD 'install' as of 1997-10-28. 3069f606849Smrg umask=`umask` 3079f606849Smrg case $stripcmd.$umask in 3089f606849Smrg # Optimize common cases. 3099f606849Smrg *[2367][2367]) mkdir_umask=$umask;; 3109f606849Smrg .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; 3119f606849Smrg 3129f606849Smrg *[0-7]) 3139f606849Smrg mkdir_umask=`expr $umask + 22 \ 3149f606849Smrg - $umask % 100 % 40 + $umask % 20 \ 3159f606849Smrg - $umask % 10 % 4 + $umask % 2 3169f606849Smrg `;; 3179f606849Smrg *) mkdir_umask=$umask,go-w;; 3189f606849Smrg esac 3199f606849Smrg 3209f606849Smrg # With -d, create the new directory with the user-specified mode. 3219f606849Smrg # Otherwise, rely on $mkdir_umask. 3229f606849Smrg if test -n "$dir_arg"; then 3239f606849Smrg mkdir_mode=-m$mode 3249f606849Smrg else 3259f606849Smrg mkdir_mode= 3269f606849Smrg fi 3279f606849Smrg 3289f606849Smrg posix_mkdir=false 3299f606849Smrg case $umask in 3309f606849Smrg *[123567][0-7][0-7]) 3319f606849Smrg # POSIX mkdir -p sets u+wx bits regardless of umask, which 3329f606849Smrg # is incompatible with FreeBSD 'install' when (umask & 300) != 0. 3339f606849Smrg ;; 3349f606849Smrg *) 3359f606849Smrg tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ 3369f606849Smrg trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 3379f606849Smrg 3389f606849Smrg if (umask $mkdir_umask && 3399f606849Smrg exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 3409f606849Smrg then 3419f606849Smrg if test -z "$dir_arg" || { 3429f606849Smrg # Check for POSIX incompatibilities with -m. 3439f606849Smrg # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or 3449f606849Smrg # other-writeable bit of parent directory when it shouldn't. 3459f606849Smrg # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. 3469f606849Smrg ls_ld_tmpdir=`ls -ld "$tmpdir"` 3479f606849Smrg case $ls_ld_tmpdir in 3489f606849Smrg d????-?r-*) different_mode=700;; 3499f606849Smrg d????-?--*) different_mode=755;; 3509f606849Smrg *) false;; 3519f606849Smrg esac && 3529f606849Smrg $mkdirprog -m$different_mode -p -- "$tmpdir" && { 3539f606849Smrg ls_ld_tmpdir_1=`ls -ld "$tmpdir"` 3549f606849Smrg test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" 3559f606849Smrg } 3569f606849Smrg } 3579f606849Smrg then posix_mkdir=: 3589f606849Smrg fi 3599f606849Smrg rmdir "$tmpdir/d" "$tmpdir" 3609f606849Smrg else 3619f606849Smrg # Remove any dirs left behind by ancient mkdir implementations. 3629f606849Smrg rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null 3639f606849Smrg fi 3649f606849Smrg trap '' 0;; 3659f606849Smrg esac;; 3669f606849Smrg esac 3679f606849Smrg 3689f606849Smrg if 3699f606849Smrg $posix_mkdir && ( 3709f606849Smrg umask $mkdir_umask && 3719f606849Smrg $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" 3729f606849Smrg ) 3739f606849Smrg then : 3749f606849Smrg else 3759f606849Smrg 3769f606849Smrg # The umask is ridiculous, or mkdir does not conform to POSIX, 3779f606849Smrg # or it failed possibly due to a race condition. Create the 3789f606849Smrg # directory the slow way, step by step, checking for races as we go. 3799f606849Smrg 3809f606849Smrg case $dstdir in 3819f606849Smrg /*) prefix=/ ;; 3829f606849Smrg -*) prefix=./ ;; 3839f606849Smrg *) prefix= ;; 3849f606849Smrg esac 3859f606849Smrg 3869f606849Smrg case $posix_glob in 3879f606849Smrg '') 3889f606849Smrg if (set -f) 2>/dev/null; then 3899f606849Smrg posix_glob=true 3909f606849Smrg else 3919f606849Smrg posix_glob=false 3929f606849Smrg fi ;; 3939f606849Smrg esac 3949f606849Smrg 3959f606849Smrg oIFS=$IFS 3969f606849Smrg IFS=/ 3979f606849Smrg $posix_glob && set -f 3989f606849Smrg set fnord $dstdir 3999f606849Smrg shift 4009f606849Smrg $posix_glob && set +f 4019f606849Smrg IFS=$oIFS 4029f606849Smrg 4039f606849Smrg prefixes= 4049f606849Smrg 4059f606849Smrg for d 4069f606849Smrg do 4079f606849Smrg test -z "$d" && continue 4089f606849Smrg 4099f606849Smrg prefix=$prefix$d 4109f606849Smrg if test -d "$prefix"; then 4119f606849Smrg prefixes= 4129f606849Smrg else 4139f606849Smrg if $posix_mkdir; then 4149f606849Smrg (umask=$mkdir_umask && 4159f606849Smrg $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break 4169f606849Smrg # Don't fail if two instances are running concurrently. 4179f606849Smrg test -d "$prefix" || exit 1 4189f606849Smrg else 4199f606849Smrg case $prefix in 4209f606849Smrg *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; 4219f606849Smrg *) qprefix=$prefix;; 4229f606849Smrg esac 4239f606849Smrg prefixes="$prefixes '$qprefix'" 4249f606849Smrg fi 4259f606849Smrg fi 4269f606849Smrg prefix=$prefix/ 4279f606849Smrg done 4289f606849Smrg 4299f606849Smrg if test -n "$prefixes"; then 4309f606849Smrg # Don't fail if two instances are running concurrently. 4319f606849Smrg (umask $mkdir_umask && 4329f606849Smrg eval "\$doit_exec \$mkdirprog $prefixes") || 4339f606849Smrg test -d "$dstdir" || exit 1 4349f606849Smrg obsolete_mkdir_used=true 4359f606849Smrg fi 4369f606849Smrg fi 4379f606849Smrg fi 4389f606849Smrg 4399f606849Smrg if test -n "$dir_arg"; then 4409f606849Smrg { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && 4419f606849Smrg { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && 4429f606849Smrg { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || 4439f606849Smrg test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 4449f606849Smrg else 4459f606849Smrg 4469f606849Smrg # Make a couple of temp file names in the proper directory. 4479f606849Smrg dsttmp=$dstdir/_inst.$$_ 4489f606849Smrg rmtmp=$dstdir/_rm.$$_ 4499f606849Smrg 4509f606849Smrg # Trap to clean up those temp files at exit. 4519f606849Smrg trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 4529f606849Smrg 4539f606849Smrg # Copy the file name to the temp name. 4549f606849Smrg (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && 4559f606849Smrg 4569f606849Smrg # and set any options; do chmod last to preserve setuid bits. 4579f606849Smrg # 4589f606849Smrg # If any of these fail, we abort the whole thing. If we want to 4599f606849Smrg # ignore errors from any of these, just make sure not to ignore 4609f606849Smrg # errors from the above "$doit $cpprog $src $dsttmp" command. 4619f606849Smrg # 4629f606849Smrg { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ 4639f606849Smrg && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ 4649f606849Smrg && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ 4659f606849Smrg && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && 4669f606849Smrg 4679f606849Smrg # Now rename the file to the real destination. 4689f606849Smrg { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ 4699f606849Smrg || { 4709f606849Smrg # The rename failed, perhaps because mv can't rename something else 4719f606849Smrg # to itself, or perhaps because mv is so ancient that it does not 4729f606849Smrg # support -f. 4739f606849Smrg 4749f606849Smrg # Now remove or move aside any old file at destination location. 4759f606849Smrg # We try this two ways since rm can't unlink itself on some 4769f606849Smrg # systems and the destination file might be busy for other 4779f606849Smrg # reasons. In this case, the final cleanup might fail but the new 4789f606849Smrg # file should still install successfully. 4799f606849Smrg { 4809f606849Smrg if test -f "$dst"; then 4819f606849Smrg $doit $rmcmd -f "$dst" 2>/dev/null \ 4829f606849Smrg || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ 4839f606849Smrg && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ 4849f606849Smrg || { 4859f606849Smrg echo "$0: cannot unlink or rename $dst" >&2 4869f606849Smrg (exit 1); exit 1 4879f606849Smrg } 4889f606849Smrg else 4899f606849Smrg : 4909f606849Smrg fi 4919f606849Smrg } && 4929f606849Smrg 4939f606849Smrg # Now rename the file to the real destination. 4949f606849Smrg $doit $mvcmd "$dsttmp" "$dst" 4959f606849Smrg } 4969f606849Smrg } || exit 1 4979f606849Smrg 4989f606849Smrg trap '' 0 4999f606849Smrg fi 5009f606849Smrgdone 5019f606849Smrg 5029f606849Smrg# Local variables: 5039f606849Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 5049f606849Smrg# time-stamp-start: "scriptversion=" 5059f606849Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 5069f606849Smrg# time-stamp-end: "$" 5079f606849Smrg# End: 508