From 0132b2453a0d800ddb3d8744be886d9e94eebeb7 Mon Sep 17 00:00:00 2001
From: Jerome Charaoui <jerome@riseup.net>
Date: Fri, 26 Jan 2018 11:47:47 -0500
Subject: [PATCH] [borg] scrap exclude*, add create_options

This allows the handler to fully make use of the advanced command-line
options for "borg create", such as the replaced "exclude*" options and
others like "--read-special" and "--numeric-owner".
---
 examples/example.borg | 12 ++++++------
 handlers/borg.in      | 11 +++--------
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/examples/example.borg b/examples/example.borg
index e5285f4..65d56bd 100644
--- a/examples/example.borg
+++ b/examples/example.borg
@@ -70,15 +70,15 @@ exclude = /var/lib/mlocate
 exclude = /var/lib/postgresql
 exclude = /var/lib/mysql
 
-## exclude directories that contain a CACHEDIR.TAG file
+## define extra command-line options for the "borg create" operation.
 ##
-## Default:
-# excludecaches = no
-
-## exclude files flagged NODUMP
+## Example:
+## create_options = --exclude-caches
+##
+## for more info see : borg help create
 ##
 ## Default:
-# excludenodump = no
+# create_options =
 
 ## whether to prune (remove) older backups
 ##
diff --git a/handlers/borg.in b/handlers/borg.in
index 9fe70b8..9150d4e 100644
--- a/handlers/borg.in
+++ b/handlers/borg.in
@@ -27,8 +27,7 @@ setsection source
 getconf init yes
 getconf include
 getconf exclude
-getconf excludecaches no
-getconf excludenodump no
+getconf create_options
 getconf prune yes
 getconf keep 30d
 getconf prune_options
@@ -125,12 +124,8 @@ if [ ! -z $bwlimit ]; then
    execstr="${execstr} --remote-ratelimit=${bwlimit}"
 fi
 
-if [ "$excludecaches" == "yes" ]; then
-   execstr="${execstr} --exclude-caches"
-fi
-
-if [ "$excludenodump" == "yes" ]; then
-   execstr="${execstr} --exclude-nodump"
+if [ ! -z $create_options ]; then
+   execstr="${execstr} ${create_options}"
 fi
 
 # include client-part and server-part
-- 
GitLab