diff --git a/plugins/transfer/_template.sh b/plugins/transfer/_template.sh
index 4009f07e8426eb043b67ee27418f9d9668e1fb53..f4b6ebdd1a46da8f9f729502e883ccadf68fba93 100644
--- a/plugins/transfer/_template.sh
+++ b/plugins/transfer/_template.sh
@@ -86,14 +86,14 @@
 # --------------------------------------------------------------------------------
     # pre backup actions
     # uses global vars from ../../transfer.sh
-    function t_cmdPre(){
+    function t_backupDoPreTasks(){
         # echo TODO PRE actions before starting transfer
     }
 
 
     # post backup actions
     # uses global vars from ../../transfer.sh
-    function t_cmdPost(){
+    function t_backupDoPostTasks(){
         # echo TODO POST actions after all transfers
     }
 
@@ -103,26 +103,26 @@
 
     # get target url/ directory
     # param  string  directory to backup
-    function t_sd_getTarget(){
+    function t_backupDirGetTarget(){
         # directory based target
         j_getFullTarget "$1"
         # for host based backup target - remove param:
         # j_getFullTarget ""
     }
 
-    function t_sd_getCmdBackup(){
-        # echo duplicity ${sBackupParams} ${mydir} ${sTarget}
+    function t_backupDirGetCmdBackup(){
+        # echo duplicity ${ARGS_BACKUP} ${mydir} ${sTarget}
     }
 
     # pre backup actions
     # uses global vars from ../../transfer.sh
-    function t_sd_cmdPre(){
+    function t_backupDirDoPreTasks(){
     }
 
 
     # post backup actions
     # uses global vars from ../../transfer.sh
-    function t_sd_cmdPost(){
+    function t_backupDirDoPostTasks(){
     }
 
 # --------------------------------------------------------------------------------
@@ -132,15 +132,15 @@
     # show stored volumes on backup repository
     # used in restore; directory param is checked before
     # param  string  name of backup dir, i.e. /etc
-    function t_cmdShowVolumes(){
+    function t_restoreDoShowVolumes(){
     }
 
     # select a snapshot to restore from
-    function t_restoreSelect(){
+    function t_restoreDoSelect(){
         local _selid=
         echo "--- Existing snapshots:"
         color cmd
-        t_cmdShowVolumes
+        t_restoreDoShowVolumes
         color reset
         showPrompt "ID of the snapshot or \"latest\" to restore from [${RESTORE_ITEM}] >"
         read _selid
@@ -148,7 +148,7 @@
         RESTORE_ITEM=${_selid}
 
         test "$RESTORE_ITEM" = "latest" && RESTORE_ITEMINFO="automatic value"
-        test "$RESTORE_ITEM" = "latest" || RESTORE_ITEMINFO=$( t_cmdShowVolumes | grep "^${RESTORE_ITEM} " | awk '{ print $2 " " $3} ' )
+        test "$RESTORE_ITEM" = "latest" || RESTORE_ITEMINFO=$( t_restoreDoShowVolumes | grep "^${RESTORE_ITEM} " | awk '{ print $2 " " $3} ' )
 
         if [ -z "${RESTORE_ITEMINFO}" ]; then
             color error
@@ -161,7 +161,7 @@
     }
 
     # set a filter to reduce count of files to restore
-    function t_restoreFilter(){
+    function t_restoreDoSetIncludeFilter(){
         local _inc=
         echo "You can enter ..."
         echo "  - a single directory name anywhere in the folderstructure"
@@ -176,7 +176,7 @@
     # show stored volumes on backup repository
     # used in restore; directory param is checked before
     # param  string  name of backup dir, i.e. /etc
-    function t_cmdRestore(){
+    function t_restoreDoRestore(){
         echo ""
     }
 
diff --git a/plugins/transfer/duplicity.sh b/plugins/transfer/duplicity.sh
index 5ad157e675efdb98daf5b2e30b6255af3772500d..523eb29a1767df2eb55207ab2ad0e11d59910267 100644
--- a/plugins/transfer/duplicity.sh
+++ b/plugins/transfer/duplicity.sh
@@ -37,6 +37,7 @@
     # param  string  param2 of transfer.sh; for auto: date i.e. 3M for 3 monthes
     function t_getParamDefault(){
         local _method=
+        local _sSshBackend=
 
         # --- method
         test "$1" = "full" && _method="full"
@@ -45,9 +46,10 @@
 
         # --- backend
         # task#1623 - fallback ssh backend for Debian 8
-        sSshBackend=`_j_getvar ${STORAGEFILE} "ssh-backend"`
-        if [ ! -z $sSshBackend ]; then
-            echo -n " --ssh-backend $sSshBackend"
+        _sSshBackend=`_j_getvar ${STORAGEFILE} "${CFGPREFIX}ssh-backend"`
+        test -z "$_sSshBackend" && _sSshBackend=`_j_getvar ${STORAGEFILE} "volsize"`
+        if [ ! -z $_sSshBackend ]; then
+            echo -n " --ssh-backend $_sSshBackend"
         fi
 
         # --- verbosity level to fetch changed files from log
@@ -63,7 +65,7 @@
         echo -n " --asynchronous-upload"
 
         # --- volume size
-        _volsize=`_j_getvar ${STORAGEFILE} "duplicity_volsize"`
+        _volsize=`_j_getvar ${STORAGEFILE} "${CFGPREFIX}volsize"`
         test -z "$_volsize" && _volsize=`_j_getvar ${STORAGEFILE} "volsize"`
         if [ ! -z $_volsize ]; then
             echo -n " --volsize ${_volsize}"
@@ -105,14 +107,14 @@
 # --------------------------------------------------------------------------------
     # pre backup actions
     # uses global vars from ../../transfer.sh
-    function t_cmdPre(){
+    function t_backupDoPreTasks(){
         echo No PRE actions before starting transfer
     }
 
 
     # post backup actions
     # uses global vars from ../../transfer.sh
-    function t_cmdPost(){
+    function t_backupDoPostTasks(){
         echo No POST actions after all transfers
     }
 
@@ -122,26 +124,26 @@
 
     # get target url/ directory
     # param  string  directory to backup
-    function t_sd_getTarget(){
+    function t_backupDirGetTarget(){
         # duplicity has a directory based target
         j_getFullTarget "$1"
     }
 
     # get string with complete backup command
-    function t_sd_getCmdBackup(){
-        echo duplicity ${sBackupParams} ${mydir} ${STORAGE_TARGETPATH}
+    function t_backupDirGetCmdBackup(){
+        echo duplicity ${ARGS_DEFAULT} ${ARGS_BACKUP} ${mydir} ${STORAGE_TARGETPATH}
     }
 
     # pre backup tasks
     # uses global vars from ../../transfer.sh
-    function t_sd_cmdPre(){
+    function t_backupDirDoPreTasks(){
         # --- for rsync only: create remote directory
         echo ${STORAGE_TARGETPATH} | fgrep "rsync://"  >/dev/null
         if [ $? -eq 0 ]; then
           # sshTarget=`echo ${STORAGE_TARGETPATH} | sed "s#rsync://#scp://#"`
           # echo Creating remote directory with fetching collection-status on $sshTarget
           # color cmd
-          # duplicity collection-status ${sParams} ${sshTarget}
+          # duplicity collection-status ${ARGS_DEFAULT} ${sshTarget}
           # color reset
           sshTarget=`echo ${STORAGE_TARGETPATH} | cut -f 3 -d '/'`
           RemoteDir=`echo ${STORAGE_TARGETPATH} | cut -f 4- -d '/'`
@@ -159,8 +161,8 @@
 
     # post backup tasks
     # uses global vars from ../../transfer.sh
-    function t_sd_cmdPost(){
-        local STORAGE_KEEP=`_j_getvar ${STORAGEFILE} "duplicity_keep"`
+    function t_backupDirDoPostTasks(){
+        local STORAGE_KEEP=`_j_getvar ${STORAGEFILE} "${CFGPREFIX}keep"`
         test -z "$STORAGE_KEEP"    && STORAGE_KEEP=`_j_getvar ${STORAGEFILE} "keep"`
 
         if [ -z "$STORAGE_KEEP" ]; then
@@ -171,7 +173,7 @@
             exit 1
         fi
 
-        cmd="duplicity remove-older-than $STORAGE_KEEP --force ${sParams} ${STORAGE_TARGETPATH}"
+        cmd="duplicity remove-older-than $STORAGE_KEEP --force ${ARGS_DEFAULT} ${STORAGE_TARGETPATH}"
         echo $cmd
         color cmd
         $cmd
@@ -188,16 +190,16 @@
     # show stored volumes on backup repository
     # used in restore; directory param is checked before
     # param  string  name of backup dir, i.e. /etc
-    function t_cmdShowVolumes(){
-        duplicity collection-status ${sParams} ${STORAGE_TARGETPATH}
+    function t_restoreDoShowVolumes(){
+        duplicity collection-status ${ARGS_DEFAULT} ${STORAGE_TARGETPATH}
     }
 
     # select a snapshot to restore from
-    function t_restoreSelect(){
+    function t_restoreDoSelect(){
         local tmpoutVolumes=/tmp/outvolumelist_$$
         local _date=
         echo "--- Existing snapshots:"
-        t_cmdShowVolumes \
+        t_restoreDoShowVolumes \
             | grep -E "(Full|Incremental).*[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\ " \
             | sort -u > $tmpoutVolumes
         if [ `cat $tmpoutVolumes | wc -l` -eq 0 ]; then
@@ -233,12 +235,12 @@
         test -z "$_date" && _date=$RESTORE_ITEM
         RESTORE_ITEM=$_date
         echo using \"$RESTORE_ITEM\"
-        # RESTORE_ITEMINFO=$( t_cmdShowVolumes | grep "^$RESTORE_ITEM" | awk '{ print $2 " " $3} ' )
+        # RESTORE_ITEMINFO=$( t_restoreDoShowVolumes | grep "^$RESTORE_ITEM" | awk '{ print $2 " " $3} ' )
         RESTORE_ITEMINFO=
         echo
     }
     # set a filter to reduce count of files to restore
-    function t_restoreFilter(){
+    function t_restoreDoSetIncludeFilter(){
         local _inc=
         echo "Enter a path behind ${BACKUP_DIR}/"
         echo "empty means: all data"
@@ -265,8 +267,8 @@
     # show stored volumes on backup repository
     # used in restore; directory param is checked before
     # param  string  name of backup dir, i.e. /etc
-    function t_cmdRestore(){
-        echo "duplicity restore $RESTORE_FILTER --time $RESTORE_ITEM ${sParams} ${STORAGE_TARGETPATH} ${RESTORE_TARGETPATH}"
+    function t_restoreDoRestore(){
+        echo "duplicity restore $RESTORE_FILTER --time $RESTORE_ITEM ${ARGS_DEFAULT} ${STORAGE_TARGETPATH} ${RESTORE_TARGETPATH}"
     }
 
     # Mount backup data
@@ -278,7 +280,7 @@
     # search a file in the given snapshot and backup dir
     # param  string  regex to filter
     function t_restoreDoSearchFile(){
-        eval restic ls ${sParams} --path "${BACKUP_DIR}" ${RESTORE_ITEM} | grep -E "$1"
+        eval restic ls ${ARGS_DEFAULT} --path "${BACKUP_DIR}" ${RESTORE_ITEM} | grep -E "$1"
     }
 # --------------------------------------------------------------------------------
 # VERIFY RETURNCODES
diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh
index 6d588d4d557a95bf8a22a7b09e3841eb30e70304..6512f89b9787bae9c96b70c6d961ab423b9b50e3 100644
--- a/plugins/transfer/restic.sh
+++ b/plugins/transfer/restic.sh
@@ -31,7 +31,7 @@
         export GODEBUG="asyncpreemptoff=1"
 
         RESTORE_ITEM=latest
-        RESTIC_MOUNTPOINT=$( _j_getvar ${STORAGEFILE} "restic_mountpoint")
+        RESTIC_MOUNTPOINT=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}mountpoint" )
     }
 
 # --------------------------------------------------------------------------------
@@ -43,13 +43,13 @@
     # param  string  param2 of transfer.sh; for auto: date i.e. 3M for 3 monthes
     function t_getParamDefault(){
         # verbose to see more details
-        echo -n --verbose=$( _j_getvar ${STORAGEFILE} "restic_verbose")
+        echo -n --verbose=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}verbose" )
 
     }
     # return a string with backup parameters that will be added to defaults
     function t_getParamBackup(){
         # tagging
-        echo -n --tag $( _j_getvar ${STORAGEFILE} "restic_tag")
+        echo -n --tag $( _j_getvar ${STORAGEFILE} "${CFGPREFIX}tag" )
     }
 
     # return a cli parameter for a single exlude directory
@@ -80,14 +80,13 @@
     # param  string  filename if ssh private key file
     function t_getParamSshKey(){
         if [ ! -z "$1" ]; then
-            # scp://backup@storage.example.com//netshare/backup/one
-            #       ^^^^^^^^^^^^^^^^^^^^^^^^^^
-            #       sshtarget fetches user@host ... if protocol matches
             echo $STORAGE_BASEDIR | grep -E "^(scp|sftp|rsync):" >/dev/null
             if [ $? -eq 0 ]; then
+                # scp://backup@storage.example.com//netshare/backup/one
+                #       ^^^^^^^^^^^^^^^^^^^^^^^^^^
+                #       sshtarget fetches user@host ... if protocol matches
                 local sshtarget=$( echo $STORAGE_BASEDIR | cut -f 3 -d '/' )
                 echo -o sftp.command="'"ssh -i ${1} ${sshtarget} -s sftp"'"
-                # echo -n "-o sftp.command=''"
             fi
         fi
     }
@@ -97,9 +96,10 @@
 # --------------------------------------------------------------------------------
     # pre backup actions
     # uses global vars from ../../transfer.sh
-    function t_cmdPre(){
+    # function t_backupDoPreTasks(){
+    function t_backupDoPreTasks(){
 
-        local _mycmd="restic init ${sParams}"
+        local _mycmd="restic init ${ARGS_DEFAULT}"
         echo $_mycmd
         color cmd 
         eval $_mycmd
@@ -114,7 +114,7 @@
 
     # post backup actions
     # uses global vars from ../../transfer.sh
-    function t_cmdPost(){
+    function t_backupDoPostTasks(){
 
         echo "--- CLEANUP local data:"
         echo restic cache --cleanup
@@ -130,23 +130,23 @@
         echo
 
         echo "--- UNLOCK ... just in case :-)" 
-        echo restic unlock ${sParams}
+        echo restic unlock ${ARGS_DEFAULT}
         color cmd
-        eval restic unlock ${sParams}
+        eval restic unlock ${ARGS_DEFAULT}
         color reset
         echo
 
         echo "--- PRUNE"
-        local _tag=$( _j_getvar ${STORAGEFILE} "restic_tag")
+        local _tag=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}tag")
 
-        local _keep_h=$( _j_getvar ${STORAGEFILE} "restic_keep-hourly")
-        local _keep_d=$( _j_getvar ${STORAGEFILE} "restic_keep-daily")
-        local _keep_w=$( _j_getvar ${STORAGEFILE} "restic_keep-weekly")
-        local _keep_m=$( _j_getvar ${STORAGEFILE} "restic_keep-monthly")
-        local _keep_y=$( _j_getvar ${STORAGEFILE} "restic_keep-yearly")
+        local _keep_h=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-hourly")
+        local _keep_d=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-daily")
+        local _keep_w=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-weekly")
+        local _keep_m=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-monthly")
+        local _keep_y=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-yearly")
         
         local _mycmd="restic forget \
-          ${sParams} \
+          ${ARGS_DEFAULT} \
           --tag $_tag \
           --group-by "paths,tags" \
           --keep-hourly $_keep_h \
@@ -170,28 +170,28 @@
 
     # get target url/ directory
     # param  string  directory to backup
-    function t_sd_getTarget(){
+    function t_backupDirGetTarget(){
         # directory based target
         # j_getFullTarget "$1"
         # for host based backup target - remove param:
         j_getFullTarget ""
     }
 
-    function t_sd_getCmdBackup(){
-        echo eval restic backup ${sBackupParams} ${mydir}
+    function t_backupDirGetCmdBackup(){
+        echo eval restic backup ${ARGS_DEFAULT} ${ARGS_BACKUP} ${mydir}
     }
 
     # pre backup actions
     # uses global vars from ../../transfer.sh
-    function t_sd_cmdPre(){
-        echo "Nothing here."
+    function t_backupDirDoPreTasks(){
+        echo "Nothing to do."
     }
 
 
     # post backup actions
     # uses global vars from ../../transfer.sh
-    function t_sd_cmdPost(){
-        echo "Nothing here."
+    function t_backupDirDoPostTasks(){
+        echo "Nothing to do."
     }
 
 # --------------------------------------------------------------------------------
@@ -201,16 +201,16 @@
     # show stored volumes on backup repository
     # used in restore; directory param is checked before
     # param  string  name of backup dir, i.e. /etc
-    function t_cmdShowVolumes(){
-        eval restic snapshots ${sParams} --path ${BACKUP_DIR}
+    function t_restoreDoShowVolumes(){
+        eval restic snapshots ${ARGS_DEFAULT} --path ${BACKUP_DIR}
     }
 
     # select a snapshot to restore from
-    function t_restoreSelect(){
+    function t_restoreDoSelect(){
         local _selid=
         echo "--- Existing snapshots:"
         color cmd
-        t_cmdShowVolumes
+        t_restoreDoShowVolumes
         color reset
         showPrompt "ID of the snapshot or \"latest\" to restore from [${RESTORE_ITEM}] >"
         read _selid
@@ -218,7 +218,7 @@
         RESTORE_ITEM=${_selid}
 
         test "$RESTORE_ITEM" = "latest" && RESTORE_ITEMINFO="automatic value"
-        test "$RESTORE_ITEM" = "latest" || RESTORE_ITEMINFO=$( t_cmdShowVolumes | grep "^${RESTORE_ITEM} " | awk '{ print $2 " " $3} ' )
+        test "$RESTORE_ITEM" = "latest" || RESTORE_ITEMINFO=$( t_restoreDoShowVolumes | grep "^${RESTORE_ITEM} " | awk '{ print $2 " " $3} ' )
 
         if [ -z "${RESTORE_ITEMINFO}" ]; then
             color error
@@ -231,7 +231,7 @@
     }
 
     # set a filter to reduce count of files to restore
-    function t_restoreFilter(){
+    function t_restoreDoSetIncludeFilter(){
         local _inc=
         echo "You can enter ..."
         echo "  - a single directory name anywhere in the folderstructure"
@@ -246,8 +246,8 @@
     # show stored volumes on backup repository
     # used in restore; directory param is checked before
     # param  string  name of backup dir, i.e. /etc
-    function t_cmdRestore(){
-        echo "eval restic restore ${sParams} --path ${BACKUP_DIR} --target ${RESTORE_TARGETPATH} ${RESTORE_FILTER} ${RESTORE_ITEM}"
+    function t_restoreDoRestore(){
+        echo "eval restic restore ${ARGS_DEFAULT} --path ${BACKUP_DIR} --target ${RESTORE_TARGETPATH} ${RESTORE_FILTER} ${RESTORE_ITEM}"
     }
 
     # Mount backup data
@@ -260,8 +260,8 @@
             echo "ERROR: no mountpoint was set in ${STORAGEFILE}; example: restic_mountpoint = /mnt/restore"
             color reset
         else
-            _cmd="restic mount ${sParams} $RESTIC_MOUNTPOINT"
-            test -z "${BACKUP_DIR}" || _cmd="restic mount ${sParams} --path ${BACKUP_DIR} $RESTIC_MOUNTPOINT"
+            _cmd="restic mount ${ARGS_DEFAULT} $RESTIC_MOUNTPOINT"
+            test -z "${BACKUP_DIR}" || _cmd="restic mount ${ARGS_DEFAULT} --path ${BACKUP_DIR} $RESTIC_MOUNTPOINT"
             echo $_cmd
             color cmd
             eval $_cmd
@@ -272,7 +272,7 @@
     # search a file in the given snapshot and backup dir
     # param  string  regex to filter
     function t_restoreDoSearchFile(){
-        eval restic ls ${sParams} --path "${BACKUP_DIR}" ${RESTORE_ITEM} | grep -E "$1"
+        eval restic ls ${ARGS_DEFAULT} --path "${BACKUP_DIR}" ${RESTORE_ITEM} | grep -E "$1"
     }
 
 # --------------------------------------------------------------------------------
diff --git a/restore.sh b/restore.sh
index 0fe1c47fbf8b441de9def94f5912b587de42780e..4e5ac24f026c65aa5340e36c320e4c949d118ca0 100755
--- a/restore.sh
+++ b/restore.sh
@@ -40,6 +40,7 @@
     # STORAGE_BIN=restic
     STORAGE_BIN=duplicity
   fi
+  CFGPREFIX=${STORAGE_BIN}_
 
   . `dirname $0`/plugins/transfer/$STORAGE_BIN.sh || exit 1
 
@@ -71,16 +72,16 @@
 
 
   # ----- Create default command line parameters
-    sParams="$( t_getParamDefault $1 $2 )"
+    ARGS_DEFAULT="$( t_getParamDefault $1 $2 )"
     sFileSshPrivkey=`_j_getvar ${STORAGEFILE} "ssh-privatekey"`
     if [ ! -z $sFileSshPrivkey ]; then
-      sParams="${sParams} $( t_getParamSshKey $sFileSshPrivkey )"
+      ARGS_DEFAULT="${ARGS_DEFAULT} $( t_getParamSshKey $sFileSshPrivkey )"
     fi
 
 
     # task#3046 - add custom cache dir
     sCacheDir=`_j_getvar ${STORAGEFILE} "cachedir"`
-    sParams="${sParams} $( t_getParamCacheDir $sCacheDir )"
+    ARGS_DEFAULT="${ARGS_DEFAULT} $( t_getParamCacheDir $sCacheDir )"
 
 
   # ----- what to restore ...
@@ -169,16 +170,16 @@ function setBackupDir(){
 function setVars(){
   local sSafeName=`j_getSafename "$BACKUP_DIR"`
   RESTORE_TARGETPATH="${RESTORE_BASEDIR}/${sSafeName}"
-  STORAGE_TARGETPATH="$( t_sd_getTarget $BACKUP_DIR )"
+  STORAGE_TARGETPATH="$( t_backupDirGetTarget $BACKUP_DIR )"
 }
 
 # actions for restore
 function doRestore(){
-  local restorecmd=$( t_cmdRestore )
+  local restorecmd=$( t_restoreDoRestore )
   if [ -z "$restorecmd" ]; then
     color error
     echo "ERROR: There is no restore command ... "
-    echo "A developer must check t_cmdRestore in plugins/transfer/$STORAGE_BIN.sh"
+    echo "A developer must check t_restoreDoRestore in plugins/transfer/$STORAGE_BIN.sh"
     color reset
     exit 1
   fi
@@ -267,7 +268,7 @@ function doRestore(){
         ;;
       w|W)
         h2 "Set a time / select a snapshot"
-        t_restoreSelect
+        t_restoreDoSelect
         ;;
       c|C)
         showFilechanges
@@ -296,7 +297,7 @@ function doRestore(){
         h2 "Filter restore items"
         echo "By default all files will be restored."
         echo "You can limit it by setting include rules."
-        t_restoreFilter
+        t_restoreDoSetIncludeFilter
         ;;
       r|R)
         h2 "Start restore"
diff --git a/transfer.sh b/transfer.sh
index 2d455cdd5b67bf3a1f9c2502815d5ece2bbd6ec8..70a2ab6b5e8358e4953d0e813570ebe0967f54c1 100755
--- a/transfer.sh
+++ b/transfer.sh
@@ -8,13 +8,6 @@
 #   transfer.sh full  - full backup
 #   transfer.sh dumps - transfer local dumps only
 #
-# duplicity see
-# - man pages http://duplicity.nongnu.org/duplicity.1.html
-# - example http://duplicity.nongnu.org/contrib/jwfull
-# - example http://duplicity.nongnu.org/contrib/jwincr
-#
-# this script was build to support ssh backend only
-#
 # --------------------------------------------------------------------------------
 # ah - Axel Hahn <axel.hahn@iml.unibe.ch>
 # ds - Daniel Schueler <daniel.schueler@iml.unibe.ch>
@@ -32,7 +25,7 @@
 # 2020-01-21  ah,ds  v1.10 show colored OK or FAILED at the end of output
 # 2020-02-25  ah,ds, v1.11 fix test -z with non existing vars; show final backup status
 # 2021-01-29  ah,ds, v1.12 abort on empty passphrase
-# 2021-05-19  ah,ds, v2.0  plugin driven 
+# 2021-05-19  ah,ds, v2.0  plugin driven to support multiple backup tools (duplicity + restic)
 # ================================================================================
 
 
@@ -57,6 +50,7 @@
     # STORAGE_BIN=restic
     STORAGE_BIN=duplicity
   fi
+  CFGPREFIX=${STORAGE_BIN}_
 
   if [ -z "$STORAGE_BASEDIR" ]; then
     color error
@@ -84,6 +78,7 @@
     exit 1
   fi
   
+  # For duplicity only
   # METHOD incremental is default; full backup will be triggered with 
   # first param "full"
   METHOD=
@@ -166,7 +161,7 @@
 
   # parameters for all 
   t_setVars || exit 1
-  sParams="$( t_getParamDefault $1 $2 )"
+  ARGS_DEFAULT="$( t_getParamDefault $1 $2 )"
 
 
   if [ "$1" = "dumps" ]; then
@@ -184,28 +179,17 @@
   done
   echo DEBUG: sParamExclude = $sParamExclude
 
-
-
-
-  # 
-  # sExcludefile="${DIR_JOBS}/transfer-exclude.txt"
-  # 
-  # if [ -f ${sExcludefile} ]; then
-  #   sParamExclude="$sParamExclude --exclude-filelist """${sExcludefile}""" "
-  # fi
-
-
   
   sFileSshPrivkey=`_j_getvar ${STORAGEFILE} "ssh-privatekey"`
   if [ ! -z $sFileSshPrivkey ]; then
-    sParams="${sParams} $( t_getParamSshKey $sFileSshPrivkey )"
+    ARGS_DEFAULT="${ARGS_DEFAULT} $( t_getParamSshKey $sFileSshPrivkey )"
   fi
 
 
   # task#3046 - add custom cache dir
-  sCacheDir=`_j_getvar ${STORAGEFILE} "cachedir"`
+  sCacheDir=`_j_getvar ${STORAGEFILE} "${CFGPREFIX}cachedir"`
   if [ ! -z $sCacheDir ]; then
-    sParams="${sParams} $( t_getParamCacheDir $sCacheDir )"
+    ARGS_DEFAULT="${ARGS_DEFAULT} $( t_getParamCacheDir $sCacheDir )"
   fi
 
 
@@ -216,7 +200,7 @@
   j_transferStart | tee -a $transferlog
 
   h2 "`date` PRE transfer tasks"
-  t_cmdPre
+  t_backupDoPreTasks
 
 
 # --------------------------------------------------------------------------------
@@ -234,9 +218,9 @@
 
         # --- build parameters
         sSafeName=`j_getSafename "$mydir"`
-        sTarget="$( t_sd_getTarget $mydir )"
+        sTarget="$( t_backupDirGetTarget $mydir )"
 
-        sBackupParams="${sParams} ${sParamExclude} $( t_getParamBackup )"
+        ARGS_BACKUP="${sParamExclude} $( t_getParamBackup )"
 
 
         # detect custom backup sets and add its includes and excludes
@@ -247,25 +231,25 @@
         if [ ! -z $backupid ]; then
           for sItem in `_j_getvar ${DIRFILE} "${backupid}\-\-include" | sed "s#\ #${sSpaceReplace}#g"`
           do
-            sBackupParams="${sBackupParams} $( t_getParamInlude $sItem)"
+            ARGS_BACKUP="${ARGS_BACKUP} $( t_getParamInlude $sItem)"
           done
           for sItem in `_j_getvar ${DIRFILE} "${backupid}\-\-exclude" | sed "s#\ #${sSpaceReplace}#g"`
           do
-            sBackupParams="${sBackupParams} $( t_getParamExlude $sItem)"
+            ARGS_BACKUP="${ARGS_BACKUP} $( t_getParamExlude $sItem)"
           done
         fi
 
 
         # --- pre task
         h3 "`date` PRE backup task for ${mydir}"
-        t_sd_cmdPre
-        # sCmdPre="$( t_sd_cmdPre )"
+        t_backupDirDoPreTasks
+        # sCmdPre="$( t_backupDirDoPreTasks )"
 
 
         # --- backup
         h3 "`date` Backup ${mydir}"
 
-        sCmd="$( t_sd_getCmdBackup)"
+        sCmd="$( t_backupDirGetCmdBackup)"
         echo "what:    ${mydir}"
         echo "target:  ${sTarget}"
         echo "command: $sCmd"
@@ -292,7 +276,7 @@
 
         # --- post action
         h3 "`date` POST backup task for ${mydir}"
-        t_sd_cmdPost
+        t_backupDirDoPostTasks
         echo
         echo
 
@@ -316,7 +300,7 @@
 # --- transfer POST tasks
 
   h2 "`date` POST transfer tasks"
-  t_cmdPost
+  t_backupDoPostTasks
 
 
   rm -f "${lockfile}" "${rcfile}"