summaryrefslogtreecommitdiffstats
path: root/support/download/cp
blob: 8f6bc06f4548ebd5eff644590a88807f70b3a781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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}
OpenPOWER on IntegriCloud