···
38
+
borg "$@" && result=$? || result=$?
39
+
if [[ -z "${toString cfg.failOnWarnings}" ]] && [[ "$result" == 1 ]]; then
40
+
echo "ignoring warning return value 1"
archiveName="${optionalString (cfg.archiveBaseName != null) (cfg.archiveBaseName + "-")}$(date ${cfg.dateFormat})"
archiveSuffix="${optionalString cfg.appendFailedSuffix ".failed"}"
'' + optionalString cfg.doInit ''
# Run borg init if the repo doesn't exist yet
41
-
if ! borg list $extraArgs > /dev/null; then
42
-
borg init $extraArgs \
52
+
if ! borgWrapper list $extraArgs > /dev/null; then
53
+
borgWrapper init $extraArgs \
--encryption ${cfg.encryption.mode} \
···
${optionalString (cfg.dumpCommand != null) ''${escapeShellArg cfg.dumpCommand} | \''}
51
-
borg create $extraArgs \
62
+
borgWrapper create $extraArgs \
--compression ${cfg.compression} \
--exclude-from ${mkExcludeFile cfg} \
--patterns-from ${mkPatternsFile cfg} \
···
${if cfg.paths == null then "-" else escapeShellArgs cfg.paths}
'' + optionalString cfg.appendFailedSuffix ''
60
-
borg rename $extraArgs \
71
+
borgWrapper rename $extraArgs \
"::$archiveName$archiveSuffix" "$archiveName"
'' + optionalString (cfg.prune.keep != { }) ''
65
-
borg prune $extraArgs \
76
+
borgWrapper prune $extraArgs \
${optionalString (cfg.prune.prefix != null) "--glob-archives ${escapeShellArg "${cfg.prune.prefix}*"}"} \
69
-
borg compact $extraArgs $extraCompactArgs
80
+
borgWrapper compact $extraArgs $extraCompactArgs
···
Set the `PrivateTmp` option for
the systemd-service. Set to false if you need sockets
or other files from global /tmp.
502
+
failOnWarnings = mkOption {
505
+
Fail the whole backup job if any borg command returns a warning
506
+
(exit code 1), for example because a file changed during backup.