1968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold#!/bin/sh
2968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold#
3968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# install - install a program, script, or datafile
4968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# This comes from X11R5 (mit/util/scripts/install.sh).
5968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold#
6968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Copyright 1991 by the Massachusetts Institute of Technology
7968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold#
8968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Permission to use, copy, modify, distribute, and sell this software and its
9968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# documentation for any purpose is hereby granted without fee, provided that
10968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# the above copyright notice appear in all copies and that both that
11968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# copyright notice and this permission notice appear in supporting
12968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# documentation, and that the name of M.I.T. not be used in advertising or
13968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# publicity pertaining to distribution of the software without specific,
14968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# written prior permission.  M.I.T. makes no representations about the
15968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# suitability of this software for any purpose.  It is provided "as is"
16968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# without express or implied warranty.
17968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold#
18968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Calling this script install-sh is preferred over install.sh, to prevent
19968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# `make' implicit rules from creating a file called install from it
20968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# when there is no Makefile.
21968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold#
22968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# This script is compatible with the BSD install script, but was written
23968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# from scratch.  It can only install one file at a time, a restriction
24968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# shared with many OS's install programs.
25968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
26968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
27968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# set DOITPROG to echo to test this script
28968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
29968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Don't use :- since 4.3BSD and earlier shells don't like it.
30968bf19396ad404e89420f5d67900fce13f4186cGilad Arnolddoit="${DOITPROG-}"
31968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
32968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
33968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# put in absolute paths if you don't have them in your path; or use env. vars.
34968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
35968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldmvprog="${MVPROG-mv}"
36968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldcpprog="${CPPROG-cp}"
37968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldchmodprog="${CHMODPROG-chmod}"
38968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldchownprog="${CHOWNPROG-chown}"
39968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldchgrpprog="${CHGRPPROG-chgrp}"
40968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldstripprog="${STRIPPROG-strip}"
41968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldrmprog="${RMPROG-rm}"
42968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldmkdirprog="${MKDIRPROG-mkdir}"
43968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
44968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldtransformbasename=""
45968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldtransform_arg=""
46968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldinstcmd="$mvprog"
47968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldchmodcmd="$chmodprog 0755"
48968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldchowncmd=""
49968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldchgrpcmd=""
50968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldstripcmd=""
51968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldrmcmd="$rmprog -f"
52968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldmvcmd="$mvprog"
53968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldsrc=""
54968bf19396ad404e89420f5d67900fce13f4186cGilad Arnolddst=""
55968bf19396ad404e89420f5d67900fce13f4186cGilad Arnolddir_arg=""
56968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
57968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldwhile [ x"$1" != x ]; do
58968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold    case $1 in
59968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	-c) instcmd="$cpprog"
60968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
61968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
62968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
63968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	-d) dir_arg=true
64968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
65968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
66968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
67968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	-m) chmodcmd="$chmodprog $2"
68968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
69968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
70968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
71968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
72968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	-o) chowncmd="$chownprog $2"
73968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
74968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
75968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
76968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
77968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	-g) chgrpcmd="$chgrpprog $2"
78968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
79968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
80968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
81968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
82968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	-s) stripcmd="$stripprog"
83968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
84968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
85968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
86968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
87968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
88968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
89968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
90968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
91968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
92968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
93968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
94968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	*)  if [ x"$src" = x ]
95968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    then
96968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		src=$1
97968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    else
98968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		# this colon is to work around a 386BSD /bin/sh bug
99968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		:
100968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		dst=$1
101968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    fi
102968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    shift
103968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	    continue;;
104968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold    esac
105968bf19396ad404e89420f5d67900fce13f4186cGilad Arnolddone
106968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
107968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldif [ x"$src" = x ]
108968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldthen
109968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	echo "install:	no input file specified"
110968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	exit 1
111968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldelse
112968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	true
113968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldfi
114968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
115968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldif [ x"$dir_arg" != x ]; then
116968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	dst=$src
117968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	src=""
118968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	
119968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ -d $dst ]; then
120968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		instcmd=:
121968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	else
122968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		instcmd=mkdir
123968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	fi
124968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldelse
125968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
126968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
127968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# might cause directories to be created, which would be especially bad 
128968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# if $src (and thus $dsttmp) contains '*'.
129968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
130968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ -f $src -o -d $src ]
131968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	then
132968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		true
133968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	else
134968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		echo "install:  $src does not exist"
135968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		exit 1
136968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	fi
137968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	
138968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$dst" = x ]
139968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	then
140968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		echo "install:	no destination specified"
141968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		exit 1
142968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	else
143968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		true
144968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	fi
145968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
146968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# If destination is a directory, append the input filename; if your system
147968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# does not like double slashes in filenames, you may need to add some logic
148968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
149968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ -d $dst ]
150968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	then
151968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		dst="$dst"/`basename $src`
152968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	else
153968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		true
154968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	fi
155968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldfi
156968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
157968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold## this sed command emulates the dirname command
158968bf19396ad404e89420f5d67900fce13f4186cGilad Arnolddstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
159968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
160968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Make sure that the destination directory exists.
161968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold#  this part is taken from Noah Friedman's mkinstalldirs script
162968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
163968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Skip lots of stat calls in the usual case.
164968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldif [ ! -d "$dstdir" ]; then
165968bf19396ad404e89420f5d67900fce13f4186cGilad ArnolddefaultIFS='	
166968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold'
167968bf19396ad404e89420f5d67900fce13f4186cGilad ArnoldIFS="${IFS-${defaultIFS}}"
168968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
169968bf19396ad404e89420f5d67900fce13f4186cGilad ArnoldoIFS="${IFS}"
170968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Some sh's can't handle IFS=/ for some reason.
171968bf19396ad404e89420f5d67900fce13f4186cGilad ArnoldIFS='%'
172968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldset - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
173968bf19396ad404e89420f5d67900fce13f4186cGilad ArnoldIFS="${oIFS}"
174968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
175968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldpathcomp=''
176968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
177968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldwhile [ $# -ne 0 ] ; do
178968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	pathcomp="${pathcomp}${1}"
179968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	shift
180968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
181968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ ! -d "${pathcomp}" ] ;
182968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold        then
183968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		$mkdirprog "${pathcomp}"
184968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	else
185968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		true
186968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	fi
187968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
188968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	pathcomp="${pathcomp}/"
189968bf19396ad404e89420f5d67900fce13f4186cGilad Arnolddone
190968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldfi
191968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
192968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldif [ x"$dir_arg" != x ]
193968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldthen
194968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	$doit $instcmd $dst &&
195968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
196968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
197968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
198968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
199968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
200968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldelse
201968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
202968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# If we're going to rename the final executable, determine the name now.
203968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
204968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$transformarg" = x ] 
205968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	then
206968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		dstfile=`basename $dst`
207968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	else
208968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		dstfile=`basename $dst $transformbasename | 
209968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold			sed $transformarg`$transformbasename
210968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	fi
211968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
212968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# don't allow the sed command to completely eliminate the filename
213968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
214968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$dstfile" = x ] 
215968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	then
216968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		dstfile=`basename $dst`
217968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	else
218968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold		true
219968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	fi
220968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
221968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Make a temp file name in the proper directory.
222968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
223968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	dsttmp=$dstdir/#inst.$$#
224968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
225968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Move or copy the file name to the temp name
226968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
227968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	$doit $instcmd $src $dsttmp &&
228968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
229968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	trap "rm -f ${dsttmp}" 0 &&
230968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
231968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# and set any options; do chmod last to preserve setuid bits
232968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
233968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# If any of these fail, we abort the whole thing.  If we want to
234968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# ignore errors from any of these, just make sure not to ignore
235968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# errors from the above "$doit $instcmd $src $dsttmp" command.
236968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
237968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
238968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
239968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
240968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
241968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
242968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold# Now rename the file to the real destination.
243968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
244968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	$doit $rmcmd -f $dstdir/$dstfile &&
245968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold	$doit $mvcmd $dsttmp $dstdir/$dstfile 
246968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
247968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldfi &&
248968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
249968bf19396ad404e89420f5d67900fce13f4186cGilad Arnold
250968bf19396ad404e89420f5d67900fce13f4186cGilad Arnoldexit 0
251