From 97bfb66302f719c885e350938187c9af176278bc Mon Sep 17 00:00:00 2001 From: Lutz Bender Date: Wed, 12 Oct 2022 15:37:02 +0200 Subject: [PATCH] fix copying files and folders --- helperFunctions.sh | 4 +++- runs/restore.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/helperFunctions.sh b/helperFunctions.sh index e76d004284..dd26d9e377 100755 --- a/helperFunctions.sh +++ b/helperFunctions.sh @@ -102,7 +102,9 @@ openwbDebugLog() { export -f openwbDebugLog openwbRunLoggingOutput() { - $1 2>&1 | while read -r line + functionName="$1" + shift + $functionName "$@" 2>&1 | while read -r line do # use path to /var/log as link in ramdisk may not be set up yet! echo "$(date +"%Y-%m-%d %H:%M:%S"): $1: $line" >> "/var/log/openWB.log" diff --git a/runs/restore.sh b/runs/restore.sh index b84ae688a9..625ac29f11 100755 --- a/runs/restore.sh +++ b/runs/restore.sh @@ -27,7 +27,9 @@ LOGFILE="$OPENWBBASEDIR/web/tools/upload/restore.log" fi echo "****************************************" echo "Step 4: replacing old files..." - mv -v -f "${WORKINGDIR}${OPENWBBASEDIR}/." "${OPENWBBASEDIR}/" + # we use cp not mv because of not empty directories in destination + # dotglob is needed to include files and directories beginning with a dot + (shopt -s dotglob; sudo cp -v -p -r "${WORKINGDIR}${OPENWBBASEDIR}/"* "${OPENWBBASEDIR}/") echo "****************************************" echo "Step 5: restoring mosquitto db..." if [[ -f "${WORKINGDIR}${MOSQUITTODIR}/mosquitto.db" ]]; then