diff --git a/AUTHORS b/AUTHORS
index a8dec1abec0abba5e1e26b7b19bdbf9cb1c81f6e..ecb3bd727c24acb9fdcdfdb39f2f4564207bb201 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -68,3 +68,5 @@ Glandos <bugs-0xacab@antipoul.fr> -- sys excludes zram devices
 Nicolas Karolak <nicolas@karolak.fr> -- Add restic support
 Derek Laventure -- Add restic helper
 Colan Schwartz -- Fix restic options handler
+
+... and other contributors, thank you!
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fd4c881ea7e563f02822d359217d00e09ad1d49..30f82ac0e44d18f07aa893b7eba34ee1be448892 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [1.2.2] - 2023-02-12
+
+### Added
+
+- [core] prometheus metrics for backup status
+
+### Changed
+
+- [borg] don't hardcode ssh port default (DEBBUG-993951)
+- [core] allow for disabling reports by email
+
+### Fixed
+
+- [borg] fix borg example: set cache_directory to source section
+- [dup] actually run duplicity `remove-older-than` (#11345)
+- [dup] remove default duplicity option `--extra-clean` (#11335)
+- [dup.helper] re-add a version of the do_dup_src function (#11332)
+- [restic] restic handler doesn't initialize test variable (#11328)
+- [sys] remove old LUKS header backup file prior to regenerating (#11333)
+- [sys] don't cancel partition backup if hwinfo absent (#11333)
+- [tests] fixes and improvements
+
 ## [1.2.1] - 2021-01-25
 
 ### Added
diff --git a/Makefile.in b/Makefile.in
index 92039b1fb8871cb4845c570fd5887ef2c64e0e4d..885cdf19e5ee519eee211b16169d3e5e864a7ee0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -195,6 +195,8 @@ am__relativize = \
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
 DIST_TARGETS = dist-gzip
+# Exists only to be overridden by the user if desired.
+AM_DISTCHECK_DVI_TARGET = dvi
 distuninstallcheck_listfiles = find . -type f -print
 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@@ -514,6 +516,10 @@ dist-xz: distdir
 	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
 	$(am__post_remove_distdir)
 
+dist-zstd: distdir
+	tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
+	$(am__post_remove_distdir)
+
 dist-tarZ: distdir
 	@echo WARNING: "Support for distribution archives compressed with" \
 		       "legacy program 'compress' is deprecated." >&2
@@ -556,6 +562,8 @@ distcheck: dist
 	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
+	*.tar.zst*) \
+	  zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
 	esac
 	chmod -R a-w $(distdir)
 	chmod u+w $(distdir)
@@ -571,7 +579,7 @@ distcheck: dist
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	    --srcdir=../.. --prefix="$$dc_install_base" \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
-	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
 	  && $(MAKE) $(AM_MAKEFLAGS) check \
 	  && $(MAKE) $(AM_MAKEFLAGS) install \
 	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
@@ -732,16 +740,17 @@ uninstall-am:
 	am--refresh check check-am clean clean-cscope clean-generic \
 	clean-local cscope cscopelist-am ctags ctags-am dist dist-all \
 	dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \
-	dist-zip distcheck distclean distclean-generic distclean-tags \
-	distcleancheck distdir distuninstallcheck dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs installdirs-am maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
-	pdf-am ps ps-am tags tags-am uninstall uninstall-am
+	dist-zip dist-zstd distcheck distclean distclean-generic \
+	distclean-tags distcleancheck distdir distuninstallcheck dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
+	uninstall-am
 
 .PRECIOUS: Makefile
 
diff --git a/aclocal.m4 b/aclocal.m4
index 0740a8f2ca4269a94b640557d98783b2aded5688..5d8f462a1916e14ecbde09f553f6b3aa2eb98064 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.16'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.16.1], [],
+m4_if([$1], [1.16.3], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.16.1])dnl
+[AM_AUTOMAKE_VERSION([1.16.3])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -307,7 +307,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -328,7 +328,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2018 Free Software Foundation, Inc.
+# Copyright (C) 2003-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -349,7 +349,7 @@ AC_SUBST([am__leading_dot])])
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2018 Free Software Foundation, Inc.
+# Copyright (C) 1997-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -370,12 +370,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
 if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
-  esac
+  MISSING="\${SHELL} '$am_aux_dir/missing'"
 fi
 # Use eval to expand $SHELL
 if eval "$MISSING --is-lightweight"; then
@@ -388,7 +383,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -419,7 +414,7 @@ AC_DEFUN([_AM_IF_OPTION],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -500,7 +495,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2009-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -560,7 +555,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -588,7 +583,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2018 Free Software Foundation, Inc.
+# Copyright (C) 2006-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -607,7 +602,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2018 Free Software Foundation, Inc.
+# Copyright (C) 2004-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/backupninja.spec b/backupninja.spec
index b0490830aece6a701a242d434526321b56698f29..1cb33556f90396b744b4e2fee762cd798d4c40b5 100644
--- a/backupninja.spec
+++ b/backupninja.spec
@@ -1,5 +1,5 @@
 %define name    backupninja
-%define version 1.2.1
+%define version 1.2.2
 
 Summary:    Backupninja backup tool
 Name:       %{name}
@@ -11,7 +11,7 @@ URL:        https://0xacab.org/liberate/backupninja
 Source:     %{name}-%{version}.tar.gz
 Requires:   bash, gawk, rdiff-backup, gzip
 Provides:   %{name}
-Packager:   Petr Klima <Petr.Klima@madeta-group.cz>
+Packager:   Petr Klima <Petr.Klima@madeta.cz>
 BuildRoot:  %{_tmppath}/%{name}-%{version}
 Prefix:     %{_prefix}
 
diff --git a/backupninja.spec.in b/backupninja.spec.in
index 4b883804e966d7ef0fc765f511722cfb46f9696e..b3e4cb60db52f1302222c0283a5e96d2f5529247 100644
--- a/backupninja.spec.in
+++ b/backupninja.spec.in
@@ -11,7 +11,7 @@ URL:        https://0xacab.org/liberate/backupninja
 Source:     %{name}-%{version}.tar.gz
 Requires:   bash, gawk, rdiff-backup, gzip
 Provides:   %{name}
-Packager:   Petr Klima <Petr.Klima@madeta-group.cz>
+Packager:   Petr Klima <Petr.Klima@madeta.cz>
 BuildRoot:  %{_tmppath}/%{name}-%{version}
 Prefix:     %{_prefix}
 
diff --git a/configure b/configure
index faf96904914e7beefbb0bcfe9f1fee700eb2a215..8f45fd38082de66dfe1837e2228d6957f445476c 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for backupninja 1.2.1.
+# Generated by GNU Autoconf 2.69 for backupninja 1.2.2.
 #
 # Report bugs to <backupninja@lists.riseup.net>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='backupninja'
 PACKAGE_TARNAME='backupninja'
-PACKAGE_VERSION='1.2.1'
-PACKAGE_STRING='backupninja 1.2.1'
+PACKAGE_VERSION='1.2.2'
+PACKAGE_STRING='backupninja 1.2.2'
 PACKAGE_BUGREPORT='backupninja@lists.riseup.net'
 PACKAGE_URL=''
 
@@ -1219,7 +1219,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures backupninja 1.2.1 to adapt to many kinds of systems.
+\`configure' configures backupninja 1.2.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1286,7 +1286,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of backupninja 1.2.1:";;
+     short | recursive ) echo "Configuration of backupninja 1.2.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1360,7 +1360,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-backupninja configure 1.2.1
+backupninja configure 1.2.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1377,7 +1377,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by backupninja $as_me 1.2.1, which was
+It was created by backupninja $as_me 1.2.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -1931,12 +1931,7 @@ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
-  esac
+  MISSING="\${SHELL} '$am_aux_dir/missing'"
 fi
 # Use eval to expand $SHELL
 if eval "$MISSING --is-lightweight"; then
@@ -2241,7 +2236,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='backupninja'
- VERSION='1.2.1'
+ VERSION='1.2.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3273,7 +3268,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by backupninja $as_me 1.2.1, which was
+This file was extended by backupninja $as_me 1.2.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3326,7 +3321,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-backupninja config.status 1.2.1
+backupninja config.status 1.2.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 0bb4d8091c1b18977fc97f45b53901089aa543c0..02ffad8f80c78ee716dc7c744ed3ca4aab92097b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
 
 # The maintainer mode is causing me grief with newest versions of autotools
 #AM_MAINTAINER_MODE
-AC_INIT([backupninja],[1.2.1],[backupninja@lists.riseup.net])
+AC_INIT([backupninja],[1.2.2],[backupninja@lists.riseup.net])
 AC_CONFIG_SRCDIR([src/backupninja.in])
 AM_INIT_AUTOMAKE([foreign])
 
diff --git a/etc/Makefile.in b/etc/Makefile.in
index 2ee4341058ae99f8556468cf7f23de938a8c5900..b69d8ee698ea6bac33b13789049a173427949c24 100644
--- a/etc/Makefile.in
+++ b/etc/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/etc/backupninja.conf.in b/etc/backupninja.conf.in
index f2366a32b782c8bf8e00d3dcd4b54209729cd29f..60bd90d0691eeab1003690552fb767fe5e30c852 100644
--- a/etc/backupninja.conf.in
+++ b/etc/backupninja.conf.in
@@ -13,6 +13,10 @@
 # 1 -- Fatal errors           (only)
 loglevel = 4
 
+# Produce prometheus metrics of backup status (default = no).
+# Requires `prometheus-node-exporter` to be installed
+reportprom = false
+
 # send a summary of the backup status to
 # this email address:
 reportemail = root
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 1c6a3940378dc136b04d7046e8d8f94f03b9d884..43fd3571fd71d7ff9d1ccb228cac2618c9d86f95 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/examples/example.borg b/examples/example.borg
index 956d36ed1046014be5ea99673d8a4d3da438cc72..26f20da312c27d47803c76c5788a05325dc192d2 100644
--- a/examples/example.borg
+++ b/examples/example.borg
@@ -127,6 +127,12 @@ exclude = /var/lib/mysql
 ## Default:
 # ignore_missing =
 
+## Path to the directory that will hold borg's cache files. By default this is
+## empty, which will let borg use its default path of "~/.cache/borg".
+##
+## Default:
+# cache_directory =
+
 ######################################################
 ## destination section
 ## (where the files are copied to)
@@ -201,12 +207,6 @@ exclude = /var/lib/mysql
 ## Default:
 # passphrase =
 
-## Path to the directory that will hold borg's cache files. By default this is
-## empty, which will let borg use its default path of "~/.cache/borg".
-##
-## Default:
-# cache_directory =
-
 ## command-line options to use with ssh
 ##
 ## an example setting would be:
diff --git a/handlers/Makefile.in b/handlers/Makefile.in
index c1391740300b04f8b79f6aa0fb8ddd2ae9f5722b..84fcd3e87ef73dd1b6fbdf1c5740e1f20b23f614 100644
--- a/handlers/Makefile.in
+++ b/handlers/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/handlers/borg.in b/handlers/borg.in
index 582e0a617268d7765ffd4b6de5c8f0cd6699d714..845f3d56984e0849387d58d8666a0add2370218e 100644
--- a/handlers/borg.in
+++ b/handlers/borg.in
@@ -41,7 +41,7 @@ getconf ignore_missing
 setsection dest
 getconf user
 getconf host
-getconf port 22
+getconf port
 getconf directory
 # strip trailing /
 directory=${directory%/}
@@ -69,7 +69,7 @@ fi
 if [ "$host" != "localhost" ]; then
    [ -n "$user" ] || fatal "Destination user not set"
    [ -n "$host" ] || fatal "Destination host not set"
-  execstr_repository="ssh://${user}@${host}:${port}${directory}"
+  execstr_repository="ssh://${user}@${host}${port:+:${port}}${directory}"
 else
   execstr_repository="$directory"
 fi
@@ -104,8 +104,8 @@ fi
 # check the connection at the source and destination
 [ -n "$test" ] || test=0
 if [ "$host" != "localhost" ] && ([ "$testconnect" = "yes" ] || [ "${test}" -eq 1 ]); then
-   debug "ssh $sshoptions -o PasswordAuthentication=no $host -p $port -l $user 'echo -n 1'"
-   local ret=`ssh $sshoptions -o PasswordAuthentication=no $host -p $port -l $user 'echo -n 1'`
+   debug "ssh $sshoptions -o PasswordAuthentication=no ${host}${port:+ -p ${port}} -l $user 'echo -n 1'"
+   local ret=`ssh $sshoptions -o PasswordAuthentication=no ${host}${port:+ -p ${port}} -l $user 'echo -n 1'`
    if [ "$ret" = 1 ]; then
       debug "Connected to $host as $user successfully"
    else
diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in
index 4a68927fba1a2b5c11d63a1bed28f9f33c59d068..cc581808c74b23e1e5a182edd6e138111ca79594 100644
--- a/handlers/dup.helper.in
+++ b/handlers/dup.helper.in
@@ -51,6 +51,16 @@ do_dup_excludes() {
    set +o noglob
 }
 
+do_dup_src() {
+   do_dup_host_includes
+   [ $? = 0 ] || return 1
+   do_dup_excludes
+   [ $? = 0 ] || return 1
+
+   _src_done="(DONE)"
+   setDefault dest
+}
+
 do_dup_dest() {
 
    local replyconverted
diff --git a/handlers/dup.in b/handlers/dup.in
index 88b9185f7680217dcf175d29d0c5f630ecfdd156..9c38de3b50441292bac2646c3019c132ad723fcb 100644
--- a/handlers/dup.in
+++ b/handlers/dup.in
@@ -209,11 +209,6 @@ else
    fi
 fi
 
-### Cleanup options
-if ! version_ge "$duplicity_version" '0.6.20'; then
-   execstr_options="${execstr_options} --extra-clean"
-fi
-
 ### Temporary directory
 if [ -n "$tmpdir" ]; then
    if [ ! -d "$tmpdir" ]; then
@@ -318,7 +313,7 @@ fi
 if [ "$keep" != "yes" ]; then
    debug "executing duplicity remove-older-than"
    debug "$nice $execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
-   if [ ! $test ]; then
+   if [ $test = 0 ]; then
       export PASSPHRASE=$password
       export SIGN_PASSPHRASE=$signpassword
       export FTP_PASSWORD=$ftp_password
diff --git a/handlers/restic.in b/handlers/restic.in
index 664547cd3e990c839b94d127b85497453e4682e9..28cf099ba6ab945685c8fcfafd65487e0caedd88 100644
--- a/handlers/restic.in
+++ b/handlers/restic.in
@@ -230,6 +230,8 @@ else
   fi
 fi
 
+[ -n "$test" ] || test=0
+
 ### INIT #######################################################################
 
 if [ "$need_init" = "yes" ]; then
diff --git a/handlers/sys.in b/handlers/sys.in
index 671fcd95e13919849d72da615723d5c68161aded..7501e5a17ac24d8bebefccc68f5d2a57a880e57c 100644
--- a/handlers/sys.in
+++ b/handlers/sys.in
@@ -514,12 +514,6 @@ if [ "$partitions" == "yes" ]; then
          partitions="no"
       fi
    fi
-   if [ "$dohwinfo" == "yes" ]; then
-      if [ ! -x "$HWINFO" ]; then
-         warning "can't find hwinfo, skipping partition report."
-         partitions="no"
-      fi
-   fi
 fi
 
 if [ "$hardware" == "yes" ]; then
@@ -572,7 +566,7 @@ if [ "$partitions" == "yes" ] || [ "$luksheaders" == "yes" ] || [ "$mbr" == "yes
    if [ "$devparts" == "" ]; then
       info "No partitions found on this system."
    else
-      info "$(echo "Partitions found: $partitions" | tr "\n" " ")"
+      info "$(echo "Partitions found: $devparts" | tr "\n" " ")"
    fi
 fi
 
@@ -606,6 +600,9 @@ if [ "$luksheaders" == "yes" ]; then
          label=${dev#/dev/}
          label=${label//\//-}
          outputfile=${luksheadersfile//__star__/$label}
+         if [ -f "${outputfile}" ]; then
+           rm "${outputfile}"
+         fi
          debug "$CRYPTSETUP will try to backup the LUKS header for device $dev"
          debug "$CRYPTSETUP luksHeaderBackup \"${dev}\" --header-backup-file \"${outputfile}\""
          output=`$CRYPTSETUP luksHeaderBackup "${dev}" --header-backup-file "${outputfile}" 2>&1`
diff --git a/install-sh b/install-sh
index 8175c640fe6288a75cc846567ea5506086f326f4..ec298b53740270ce82b326c4c2deaa5dcdec4596 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2018-03-11.20; # UTC
+scriptversion=2020-11-14.01; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -69,6 +69,11 @@ posix_mkdir=
 # Desired mode of installed file.
 mode=0755
 
+# Create dirs (including intermediate dirs) using mode 755.
+# This is like GNU 'install' as of coreutils 8.32 (2020).
+mkdir_umask=22
+
+backupsuffix=
 chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
@@ -99,18 +104,28 @@ Options:
      --version  display version info and exit.
 
   -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
+  -C            install only if different (preserve data modification time)
   -d            create directories instead of installing files.
   -g GROUP      $chgrpprog installed files to GROUP.
   -m MODE       $chmodprog installed files to MODE.
   -o USER       $chownprog installed files to USER.
+  -p            pass -p to $cpprog.
   -s            $stripprog installed files.
+  -S SUFFIX     attempt to back up existing files, with suffix SUFFIX.
   -t DIRECTORY  install into DIRECTORY.
   -T            report an error if DSTFILE is a directory.
 
 Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
   RMPROG STRIPPROG
+
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
+
+If -S is not specified, no backups are attempted.
+
+Email bug reports to bug-automake@gnu.org.
+Automake home page: https://www.gnu.org/software/automake/
 "
 
 while test $# -ne 0; do
@@ -137,8 +152,13 @@ while test $# -ne 0; do
     -o) chowncmd="$chownprog $2"
         shift;;
 
+    -p) cpprog="$cpprog -p";;
+
     -s) stripcmd=$stripprog;;
 
+    -S) backupsuffix="$2"
+        shift;;
+
     -t)
         is_target_a_directory=always
         dst_arg=$2
@@ -255,6 +275,10 @@ do
     dstdir=$dst
     test -d "$dstdir"
     dstdir_status=$?
+    # Don't chown directories that already exist.
+    if test $dstdir_status = 0; then
+      chowncmd=""
+    fi
   else
 
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@@ -301,22 +325,6 @@ do
   if test $dstdir_status != 0; then
     case $posix_mkdir in
       '')
-        # Create intermediate dirs using mode 755 as modified by the umask.
-        # This is like FreeBSD 'install' as of 1997-10-28.
-        umask=`umask`
-        case $stripcmd.$umask in
-          # Optimize common cases.
-          *[2367][2367]) mkdir_umask=$umask;;
-          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-          *[0-7])
-            mkdir_umask=`expr $umask + 22 \
-              - $umask % 100 % 40 + $umask % 20 \
-              - $umask % 10 % 4 + $umask % 2
-            `;;
-          *) mkdir_umask=$umask,go-w;;
-        esac
-
         # With -d, create the new directory with the user-specified mode.
         # Otherwise, rely on $mkdir_umask.
         if test -n "$dir_arg"; then
@@ -326,52 +334,49 @@ do
         fi
 
         posix_mkdir=false
-        case $umask in
-          *[123567][0-7][0-7])
-            # POSIX mkdir -p sets u+wx bits regardless of umask, which
-            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-            ;;
-          *)
-            # Note that $RANDOM variable is not portable (e.g. dash);  Use it
-            # here however when possible just to lower collision chance.
-            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-
-            trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-            # Because "mkdir -p" follows existing symlinks and we likely work
-            # directly in world-writeable /tmp, make sure that the '$tmpdir'
-            # directory is successfully created first before we actually test
-            # 'mkdir -p' feature.
-            if (umask $mkdir_umask &&
-                $mkdirprog $mkdir_mode "$tmpdir" &&
-                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
-            then
-              if test -z "$dir_arg" || {
-                   # Check for POSIX incompatibilities with -m.
-                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-                   # other-writable bit of parent directory when it shouldn't.
-                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-                   test_tmpdir="$tmpdir/a"
-                   ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
-                   case $ls_ld_tmpdir in
-                     d????-?r-*) different_mode=700;;
-                     d????-?--*) different_mode=755;;
-                     *) false;;
-                   esac &&
-                   $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
-                     ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
-                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-                   }
-                 }
-              then posix_mkdir=:
-              fi
-              rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
-            else
-              # Remove any dirs left behind by ancient mkdir implementations.
-              rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
-            fi
-            trap '' 0;;
-        esac;;
+	# The $RANDOM variable is not portable (e.g., dash).  Use it
+	# here however when possible just to lower collision chance.
+	tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+	trap '
+	  ret=$?
+	  rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
+	  exit $ret
+	' 0
+
+	# Because "mkdir -p" follows existing symlinks and we likely work
+	# directly in world-writeable /tmp, make sure that the '$tmpdir'
+	# directory is successfully created first before we actually test
+	# 'mkdir -p'.
+	if (umask $mkdir_umask &&
+	    $mkdirprog $mkdir_mode "$tmpdir" &&
+	    exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+	then
+	  if test -z "$dir_arg" || {
+	       # Check for POSIX incompatibilities with -m.
+	       # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+	       # other-writable bit of parent directory when it shouldn't.
+	       # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+	       test_tmpdir="$tmpdir/a"
+	       ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+	       case $ls_ld_tmpdir in
+		 d????-?r-*) different_mode=700;;
+		 d????-?--*) different_mode=755;;
+		 *) false;;
+	       esac &&
+	       $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+		 ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+		 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+	       }
+	     }
+	  then posix_mkdir=:
+	  fi
+	  rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
+	else
+	  # Remove any dirs left behind by ancient mkdir implementations.
+	  rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
+	fi
+	trap '' 0;;
     esac
 
     if
@@ -382,7 +387,7 @@ do
     then :
     else
 
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # mkdir does not conform to POSIX,
       # or it failed possibly due to a race condition.  Create the
       # directory the slow way, step by step, checking for races as we go.
 
@@ -411,7 +416,7 @@ do
           prefixes=
         else
           if $posix_mkdir; then
-            (umask=$mkdir_umask &&
+            (umask $mkdir_umask &&
              $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
             # Don't fail if two instances are running concurrently.
             test -d "$prefix" || exit 1
@@ -451,7 +456,18 @@ do
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
 
     # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+    (umask $cp_umask &&
+     { test -z "$stripcmd" || {
+	 # Create $dsttmp read-write so that cp doesn't create it read-only,
+	 # which would cause strip to fail.
+	 if test -z "$doit"; then
+	   : >"$dsttmp" # No need to fork-exec 'touch'.
+	 else
+	   $doit touch "$dsttmp"
+	 fi
+       }
+     } &&
+     $doit_exec $cpprog "$src" "$dsttmp") &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
@@ -477,6 +493,13 @@ do
     then
       rm -f "$dsttmp"
     else
+      # If $backupsuffix is set, and the file being installed
+      # already exists, attempt a backup.  Don't worry if it fails,
+      # e.g., if mv doesn't support -f.
+      if test -n "$backupsuffix" && test -f "$dst"; then
+        $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
+      fi
+
       # Rename the file to the real destination.
       $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
 
@@ -491,9 +514,9 @@ do
         # file should still install successfully.
         {
           test ! -f "$dst" ||
-          $doit $rmcmd -f "$dst" 2>/dev/null ||
+          $doit $rmcmd "$dst" 2>/dev/null ||
           { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+            { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
           } ||
           { echo "$0: cannot unlink or rename $dst" >&2
             (exit 1); exit 1
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 028d841e646f9117d2ba34a5a9a8b8f3ebb9904a..70924d592605e2150d35a7b5f288ed6f92b05b70 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/man/Makefile.in b/man/Makefile.in
index ad0a151d982804332940fa12119d07128f7a1356..68db8d48594ab03ce76e4d5e87591d45cfbca978 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/man/backup.d.5 b/man/backup.d.5
index 5178067178d7dc1e574f60cc69f82b0758d81e1d..234b270f815c3a781ccbab24f82b26bb6faa6b6d 100644
--- a/man/backup.d.5
+++ b/man/backup.d.5
@@ -81,6 +81,7 @@ For example:
   when = manual
 
 These values for "when" are invalid:
+  when = everyday at 5:00
   when = tuesday at 2am
   when = tuesday at 2
   when = tues at 02
diff --git a/man/backupninja.conf.5 b/man/backupninja.conf.5
index ff6b055330097a4a24ff0fd0c4606318f3965324..286adeaad6f5b96d4c721f81d089e15490a8b24f 100644
--- a/man/backupninja.conf.5
+++ b/man/backupninja.conf.5
@@ -42,6 +42,11 @@ How verbose to make the logs.
 .br
 1 = Fatal errors
 
+.TP
+.B reportprom
+Produce prometheus metrics of backup status. Requires `prometheus-node-exporter`
+to be installed.
+
 .TP
 .B reportemail
 Send a summary of the backup status to this email address.
diff --git a/missing b/missing
index 625aeb11897a2221d5cda1d55b6866d61d21f660..8d0eaad250fc1ea8f3728338c1b016596cedfc60 100755
--- a/missing
+++ b/missing
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
diff --git a/src/Makefile.in b/src/Makefile.in
index e8a8394c3e45a7ec722f4471b7e298c8cb1b383e..1166513e5bd184db45c9d29d06a284c3b845a552 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/src/backupninja.in b/src/backupninja.in
index 10a8c6632b453f1cb48b8414b8c21243f09dcaf7..b84e436930131c4af6f3d1d5c41c057eefcc9606 100755
--- a/src/backupninja.in
+++ b/src/backupninja.in
@@ -513,6 +513,8 @@ setfile $conffile
 getconf configdirectory @CFGDIR@/backup.d
 getconf scriptdirectory @datadir@
 getconf reportdirectory
+getconf reportprom
+getconf prom_textfile_dir /var/lib/prometheus/node-exporter
 getconf reportemail
 getconf reporthost
 getconf reportspace
@@ -601,10 +603,10 @@ for file in $files; do
    fi
 done
 
-## mail the messages to the report address
+## reporting
 
 if [ $actions_run == 0 ]; then doit=0
-elif [ "$reportemail" == "" ]; then doit=0
+elif [ "$reportemail" == "" -a "$reportprom" == "" ]; then doit=0
 elif [ $fatals != 0 ]; then doit=1
 elif [ $errors != 0 ]; then doit=1
 elif [ $halts != 0 ]; then doit=1
@@ -614,36 +616,82 @@ else doit=0
 fi
 
 if [ $doit == 1 ]; then
-   if [ -x "$(which mail 2>/dev/null)" ]; then
-      debug "send report to $reportemail"
-      hostname=`hostname`
-      [ $warnings == 0 ] || subject="WARNING"
-      [ $errors == 0 ] || subject="ERROR"
-      [ $fatals == 0 ] || subject="FAILED"
-      [ $halts == 0 ] || subject="HALTED"
-
-      {
-         for ((i=0; i < ${#messages[@]} ; i++)); do
-            echo ${messages[$i]}
-         done
-         echo -e "$errormsg"
-         if [ "$reportspace" == "yes" ]; then
-            previous=""
-            for i in $(ls "$configdirectory"); do
-               backuploc=$(grep ^directory "$configdirectory"/"$i" | @AWK@ '{print $3}')
-               if [ "$backuploc" != "$previous" -a -n "$backuploc" -a -d "$backuploc" ]; then
-                  df -h "$backuploc"
-                  previous="$backuploc"
-               fi
-            done
+   if [ ! -z "$reportprom" ]; then
+      if [ -d "$prom_textfile_dir" ]; then
+         debug "reporting to prometheus"
+         hostname=`hostname`
+
+         # set some defaults, so there aren't empty strings
+         [ ! -z $warnings ] || warnings=0
+         [ ! -z $errors ] || errors=0
+         [ ! -z $fatals ] || fatals=0
+         [ ! -z $halts ] || halts=0
+         [ ! -z $actions_run ] || actions_run=0
+
+         output_file="${prom_textfile_dir}/backupninja.prom"
+         tmp_file="${output_file}.$$"
+         trap "rm -f $tmp_file 2>/dev/null" EXIT INT TERM
+         cat <<EOF > "$tmp_file"
+# HELP backupninja_warnings Number of warnings reported by Backupninja
+# TYPE backupninja_warnings gauge
+# HELP backupninja_errors Number of errors reported by Backupninja
+# TYPE backupninja_errors gauge
+# HELP backupninja_fatals Number of fatals reported by Backupninja
+# TYPE backupninja_fatals gauge
+# HELP backupninja_halts Number of halts reported by Backupninja
+# TYPE backupninja_halts gauge
+# HELP backupninja_actions Number of actions run by Backupninja
+# TYPE backupninja_actions gauge
+backupninja_warnings{host="$hostname"} $warnings
+backupninja_errors{host="$hostname"} $errors
+backupninja_fatals{host="$hostname"} $fatals
+backupninja_halts{host="$hostname"} $halts
+backupninja_actions{host="$hostname"} $actions_run
+EOF
+         if [ $? -gt 0 ]; then
+            rm -f "$tmp_file" 2>/dev/null
+            error "could not write metrics to ${prom_textfile_dir}!"
+            let "errors +-1"
+         else
+            mv -f "$tmp_file" "$output_file"
+            chmod 0644 "$output_file"
          fi
-      } | fold -s -w "$reportwrap" | mail -s "backupninja: $hostname $subject" $reportemail
-   else
-      error "Unable to locate mail executable, email report not sent!"
-      let "errors += 1"
+      else
+         error "$prom_textfile_dir does not exist!"
+         let "errors +-1"
+      fi
+   fi
+   if [ ! -z "$reportemail" ]; then
+      if [ -x "$(which mail 2>/dev/null)" ]; then
+         debug "send report to $reportemail"
+         hostname=`hostname`
+         [ $warnings == 0 ] || subject="WARNING"
+         [ $errors == 0 ] || subject="ERROR"
+         [ $fatals == 0 ] || subject="FAILED"
+         [ $halts == 0 ] || subject="HALTED"
+
+         {
+            for ((i=0; i < ${#messages[@]} ; i++)); do
+               echo ${messages[$i]}
+            done
+            echo -e "$errormsg"
+            if [ "$reportspace" == "yes" ]; then
+               previous=""
+               for i in $(ls "$configdirectory"); do
+                  backuploc=$(grep ^directory "$configdirectory"/"$i" | @AWK@ '{print $3}')
+                  if [ "$backuploc" != "$previous" -a -n "$backuploc" -a -d "$backuploc" ]; then
+                     df -h "$backuploc"
+                     previous="$backuploc"
+                  fi
+               done
+            fi
+         } | fold -s -w "$reportwrap" | mail -s "backupninja: $hostname $subject" $reportemail
+      else
+         error "Unable to locate mail executable, email report not sent!"
+         let "errors += 1"
+      fi
    fi
 fi
-
 if [ $actions_run != 0 ]; then
    info "FINISHED: $actions_run actions run. $fatals fatal. $errors error. $warnings warning."
    if [ "$halts" != "0" ]; then