install-sh revision a180a41bba1d50822df23fff0099e90b86638b89
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#!/bin/sh
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# install - install a program, script, or datafile
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# This comes from X11R5 (mit/util/scripts/install.sh).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Copyright 1991 by the Massachusetts Institute of Technology
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Permission to use, copy, modify, distribute, and sell this software and its
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# documentation for any purpose is hereby granted without fee, provided that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# the above copyright notice appear in all copies and that both that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# copyright notice and this permission notice appear in supporting
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# documentation, and that the name of M.I.T. not be used in advertising or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# publicity pertaining to distribution of the software without specific,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# written prior permission. M.I.T. makes no representations about the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# suitability of this software for any purpose. It is provided "as is"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# without express or implied warranty.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Calling this script install-sh is preferred over install.sh, to prevent
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# `make' implicit rules from creating a file called install from it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# when there is no Makefile.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# This script is compatible with the BSD install script, but was written
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# from scratch. It can only install one file at a time, a restriction
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# shared with many OS's install programs.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# set DOITPROG to echo to test this script
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Don't use :- since 4.3BSD and earlier shells don't like it.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncdoit="${DOITPROG-}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# put in absolute paths if you don't have them in your path; or use env. vars.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncmvprog="${MVPROG-mv}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynccpprog="${CPPROG-cp}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchmodprog="${CHMODPROG-chmod}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchownprog="${CHOWNPROG-chown}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchgrpprog="${CHGRPPROG-chgrp}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncstripprog="${STRIPPROG-strip}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncrmprog="${RMPROG-rm}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncmkdirprog="${MKDIRPROG-mkdir}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctransformbasename=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctransform_arg=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncinstcmd="$mvprog"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchmodcmd="$chmodprog 0755"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchowncmd=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchgrpcmd=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncstripcmd=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncrmcmd="$rmprog -f"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncmvcmd="$mvprog"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsrc=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncdst=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncdir_arg=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncwhile [ x"$1" != x ]; do
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync case $1 in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -c) instcmd="$cpprog"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -d) dir_arg=true
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -m) chmodcmd="$chmodprog $2"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -o) chowncmd="$chownprog $2"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -g) chgrpcmd="$chgrpprog $2"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -s) stripcmd="$stripprog"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -t=*) transformarg=`echo $1 | sed 's/-t=//'`
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *) if [ x"$src" = x ]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync src=$1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync # this colon is to work around a 386BSD /bin/sh bug
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync :
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync dst=$1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync continue;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync esac
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncdone
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncif [ x"$src" = x ]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncthen
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync echo "install: no input file specified"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync exit 1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncelse
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync :
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncfi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncif [ x"$dir_arg" != x ]; then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync dst=$src
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync src=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ -d $dst ]; then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync instcmd=:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync chmodcmd=""
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync instcmd=$mkdirprog
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncelse
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# might cause directories to be created, which would be especially bad
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# if $src (and thus $dsttmp) contains '*'.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ -f "$src" ] || [ -d "$src" ]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync :
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync echo "install: $src does not exist"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync exit 1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$dst" = x ]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync echo "install: no destination specified"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync exit 1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync :
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# If destination is a directory, append the input filename; if your system
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# does not like double slashes in filenames, you may need to add some logic
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ -d $dst ]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync dst="$dst"/`basename $src`
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync :
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncfi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync## this sed command emulates the dirname command
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncdstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Make sure that the destination directory exists.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# this part is taken from Noah Friedman's mkinstalldirs script
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Skip lots of stat calls in the usual case.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncif [ ! -d "$dstdir" ]; then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncdefaultIFS='
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync '
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIFS="${IFS-${defaultIFS}}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncoIFS="${IFS}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Some sh's can't handle IFS=/ for some reason.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIFS='%'
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncset - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIFS="${oIFS}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncpathcomp=''
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncwhile [ $# -ne 0 ] ; do
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pathcomp="${pathcomp}${1}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ ! -d "${pathcomp}" ] ;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync $mkdirprog "${pathcomp}"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync :
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pathcomp="${pathcomp}/"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncdone
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncfi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncif [ x"$dir_arg" != x ]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncthen
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync $doit $instcmd $dst &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncelse
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# If we're going to rename the final executable, determine the name now.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$transformarg" = x ]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync dstfile=`basename $dst`
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync dstfile=`basename $dst $transformbasename |
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync sed $transformarg`$transformbasename
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# don't allow the sed command to completely eliminate the filename
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$dstfile" = x ]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync then
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync dstfile=`basename $dst`
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync :
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fi
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Make a temp file name in the proper directory.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync dsttmp=$dstdir/#inst.$$#
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Move or copy the file name to the temp name
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync $doit $instcmd $src $dsttmp &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync trap "rm -f ${dsttmp}" 0 &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# and set any options; do chmod last to preserve setuid bits
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# If any of these fail, we abort the whole thing. If we want to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# ignore errors from any of these, just make sure not to ignore
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# errors from the above "$doit $instcmd $src $dsttmp" command.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync# Now rename the file to the real destination.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync $doit $rmcmd -f $dstdir/$dstfile &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync $doit $mvcmd $dsttmp $dstdir/$dstfile
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncfi &&
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncexit 0
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync