-# $OpenBSD: scp.sh,v 1.15 2022/10/24 21:52:50 djm Exp $
+# $OpenBSD: scp.sh,v 1.16 2022/10/30 18:42:07 dtucker Exp $
# Placed in the Public Domain.
tid="scp"
DIR2=${COPY}.dd2
COPY3=${OBJ}/copy.glob[123]
DIR3=${COPY}.dd.glob[456]
+DIFFOPT="-rN"
SRC=`dirname ${SCRIPT}`
cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
rm -rf ${DIR2}
cp ${DATA} ${DIR}/copy
$SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed"
- diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+ diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
verbose "$tag: recursive local dir to local dir"
scpclean
rm -rf ${DIR2}
cp ${DATA} ${DIR}/copy
$SCP $scpopts -r ${DIR} ${DIR2} || fail "copy failed"
- diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+ diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
verbose "$tag: recursive remote dir to local dir"
scpclean
rm -rf ${DIR2}
cp ${DATA} ${DIR}/copy
$SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed"
- diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+ diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
verbose "$tag: unmatched glob file local->remote"
scpclean
cp ${DATA} ${DIR}/copy
cp ${DATA} ${DIR}/copy.glob[1234]
$SCP $scpopts -r ${DIR} somehost:${DIR3} || fail "copy failed"
- diff -rN ${DIR} ${DIR3} || fail "corrupted copy"
+ diff ${DIFFOPT} ${DIR} ${DIR3} || fail "corrupted copy"
verbose "$tag: unmatched glob dir recursive remote->local"
# NB. no clean
rm -rf ${DIR2}
$SCP $scpopts -r somehost:${DIR3} ${DIR2} || fail "copy failed"
- diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+ diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
verbose "$tag: shell metacharacters"
scpclean
chmod 660 ${DIR2}/copy
$SUDO chown root ${DIR2}/copy
$SCP -p $scpopts somehost:${DIR}/\* ${DIR2} >/dev/null 2>&1
- $SUDO diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+ $SUDO diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
$SUDO rm ${DIR2}/copy
fi