Add backup/init config directive (defaults to yes) to control whether
the repository should be initialized if it doesn't exist. Since we need
to attempt to connect to the repository to verify if init is needed,
remove the testconnect parameter so that the handler just tests the
connection every time it runs.
The command rebuild-index should only be necessary as part of an attempt
to repair a malfunctioning repository. I could not find anywhere in the
documentation recommending to run this command at regular intervals.
borg will by default create its cache directory in ~/.cache/borg. This
means that during backup runs, borg will read and write quite
extensively from/to this directory.
In some situations, it is rather undesirable to have this amount of IO
activity in this location and it would make sense to tell borg to place
its cache elsewhere. This can help for example with placing the cache on
a hard drive where the added IO load will not have as big of an impact
on other running activity for the system.
This change also makes sure that the cache directory environment
variable is cleared out when the configuration option is unset. This
should avoid unpleasant surprises when this environment variable is set
to some unknown value in the context where backupninja is called, which
could lead to borg reading and writing to random places on the system.
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".
The effect of "keep*" options is not straightforward to understand, so
replacing it with a simpler "keep" option, which replicates the
functionality of other backupninja handlers. This also simplifies the
helper, as the use is then only asked how many days of backups to keep.
At the same time, we add "prune_options" which allows for the use of the
"keep*" options as well as other useful prune options, like "--prefix".