27 lines
451 B
Bash
Executable File
27 lines
451 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# We want to catch any command failure, and exit immediately
|
|
set -e
|
|
|
|
# Download helper for cp
|
|
# Call it with:
|
|
# $1: source file
|
|
# $2: output file
|
|
# And this environment:
|
|
# LOCALFILES: the cp command to call
|
|
|
|
source="${1}"
|
|
output="${2}"
|
|
|
|
tmp_output="$( mktemp "${output}.XXXXXX" )"
|
|
|
|
ret=1
|
|
if ${LOCALFILES} "${source}" "${tmp_output}"; then
|
|
mv "${tmp_output}" "${output}"
|
|
ret=0
|
|
fi
|
|
|
|
# Cleanup
|
|
rm -f "${tmp_output}"
|
|
exit ${ret}
|