@@ -7,6 +7,7 @@ set -e
#
# Options:
# -q Be quiet.
+# -C Only check that the source file exists.
# -o FILE Copy to file FILE.
# -f FILE Copy from basename file FILE.
# -u DIR Copy from FILE in DIR.
@@ -20,9 +21,11 @@ set -e
# Make 'cp' verbose by default, so it behaves a bit like the others.
verbose=-v
+checkonly=false
while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=;;
+ C) checkonly=true;;
o) output="${OPTARG}";;
f) file="${OPTARG}";;
u) dir="${OPTARG}";;
@@ -39,4 +42,12 @@ _localfiles() {
eval ${LOCALFILES} "${@}"
}
-_localfiles ${verbose} "'${dir##file://}/${file}'" "'${output}'"
+# Remove any scheme prefix
+dir="${dir##file://}"
+
+if ${checkonly}; then
+ test -f "'${dir}/${file}'"
+ exit 0
+fi
+
+_localfiles ${verbose} "'${dir}/${file}'" "'${output}'"