From 362c3e0a1d839e9988e026caa8c61926d29fcae2 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Tue, 4 Oct 2022 12:01:39 +0200
Subject: [PATCH] prune and verify after dir handling

---
 plugins/transfer/duplicity.sh |  9 ++-------
 plugins/transfer/restic.sh    | 18 +++++++-----------
 transfer.sh                   | 10 ----------
 3 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/plugins/transfer/duplicity.sh b/plugins/transfer/duplicity.sh
index 262cad0..2b1788c 100644
--- a/plugins/transfer/duplicity.sh
+++ b/plugins/transfer/duplicity.sh
@@ -174,9 +174,9 @@
         fi
     }
 
-    # forget old data
+    # prune old data
     # uses global vars from ../../transfer.sh
-    function t_backupDoForget(){
+    function t_backupDoPrune(){
         echo "--- FORGET some data"
         cmd="duplicity remove-older-than $STORAGE_KEEP --force ${ARGS_DEFAULT} ${STORAGE_TARGETPATH}"
         echo $cmd
@@ -187,11 +187,6 @@
         
         t_rcCheckCleanup $myrc
     }
-    # prune old data
-    # uses global vars from ../../transfer.sh
-    function t_backupDoPrune(){
-        echo "--- PRUNE is not implemented yet for duplicity."
-    }
     # verify backup data
     # uses global vars from ../../transfer.sh
     function t_backupDoVerify(){
diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh
index 3b6c73f..7312b87 100644
--- a/plugins/transfer/restic.sh
+++ b/plugins/transfer/restic.sh
@@ -170,11 +170,12 @@
         echo
 
     }
-    # forget data
-    # uses global vars from ../../transfer.sh
-    function t_backupDoForget(){
 
-        echo "--- FORGET some data"
+    # prune old data
+    # uses global vars from ../../transfer.sh
+    function t_backupDoPrune(){
+        # --------------------
+        echo "--- FORGET (in all pathes of repository)"
         local _tag=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}tag")
         
         local _mycmd="restic forget \
@@ -182,7 +183,6 @@
           --tag $_tag \
           --group-by paths,tags \
           --prune \
-          --path ${BACKUP_DIR} \
           --cleanup-cache"
 
         local _keep
@@ -203,13 +203,9 @@
 
         t_rcCheckCleanup $_myrc
         echo
-    }
-    # prune old data
-    # uses global vars from ../../transfer.sh
-    function t_backupDoPrune(){
 
         # --------------------
-        echo "--- PRUNE"
+        echo "--- PRUNE (whole repository)"
         _mycmd="restic prune ${ARGS_DEFAULT}"
         echo $_mycmd
         sleep 3
@@ -225,7 +221,7 @@
     # uses global vars from ../../transfer.sh
     function t_backupDoVerify(){
         # --------------------
-        echo "--- VERIFY"
+        echo "--- VERIFY (whole repository)"
         # 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}"
diff --git a/transfer.sh b/transfer.sh
index af2efd3..cdddc3f 100755
--- a/transfer.sh
+++ b/transfer.sh
@@ -405,16 +405,6 @@ function setAction(){
           touch ${lastbackupfile}
         fi
 
-        # --- prune
-        if [ $doPrune -eq 0 ]; then
-          echo "SKIP forget data"
-        else
-          h3 "`date` FORGET data of ${BACKUP_DIR}"
-          t_backupDoForget
-          echo
-        fi
-        echo
-
       else
         color warning
         echo "DIR SKIP $mydir ... does not exist (no error)"
-- 
GitLab