From 52ab345fca3ee22a3aaf1b9fa24a9f40d111c7ff Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Tue, 10 May 2022 16:22:54 +0200
Subject: [PATCH] fix handling restic_nocache

---
 plugins/transfer/restic.sh | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh
index 5d11fb6..9d87c57 100644
--- a/plugins/transfer/restic.sh
+++ b/plugins/transfer/restic.sh
@@ -12,6 +12,7 @@
 # 2022-02-09  ah    v0.3   show diff to last backup; update pruning
 # 2022-02-09  ah    v0.3   update pruning; more keep-params
 # 2022-03-07  ah    v0.4   add verify in post task
+# 2022-05-10  ah    v0.5   fix handling with nocache flag (use globally as default param - not in backup only)
 # ================================================================================
 
 # --------------------------------------------------------------------------------
@@ -58,6 +59,12 @@
         # verbose to see more details
         echo -n --verbose=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}verbose" )
 
+        # no cache ... to create no local cache dirs, what saves space but backup + verify is much slower 
+        _nocacheFlag=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}nocache" )
+        if [ "$_nocacheFlag" != "" ] && [ "$_nocacheFlag" != "0" ] && [ "$_nocacheFlag" != "false" ]; then
+            echo -n "--no-cache "
+        fi
+
     }
     # return a string with backup parameters that will be added to defaults
     function t_getParamBackup(){
@@ -70,11 +77,6 @@
             echo -n "--tag $_tag "
         fi
 
-        # no cache ... to create smaller local cache dirs, but backup 3 times slower 
-        _nocacheFlag=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}nocache" )
-        if [ "$_nocacheFlag" != "" ] && [ "$_nocacheFlag" != "0" ] && [ "$_nocacheFlag" != "false" ]; then
-            echo -n "--no-cache "
-        fi
     }
 
     # return a cli parameter for a single exlude directory
@@ -185,7 +187,7 @@
         echo "--- VERIFY"
         # param --read-data takes a long time. Maybe use an extra job with it.
         # _mycmd="time restic check ${ARGS_DEFAULT} --with-cache --read-data"
-        _mycmd="restic check ${ARGS_DEFAULT} --with-cache"
+        _mycmd="restic check ${ARGS_DEFAULT}"
         echo $_mycmd
         sleep 3
         color cmd 
-- 
GitLab