Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/functions/functions.util | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/src/functions/functions.util b/src/functions/functions.util index 381208c..8c8f569 100644 --- a/src/functions/functions.util +++ b/src/functions/functions.util @@ -752,3 +752,22 @@ hex2dec() { dec2hex() { printf "%02x\n" "${1}" } + +copy() { + # This function just copy config files + assert [ $# -eq 2 ] + + local src=${1} + local dst=${2} + + # Check if ${dst} is a directory + if [ -d ${dst} ]; then + log ERROR "${dst} is a directory." + return ${EXIT_ERROR} + fi + + if ! fread "${src}" > "${dst}"; then + log ERROR "Could not copy data from ${src} to ${dst}" + return ${EXIT_ERROR} + fi +}