diff --git a/AUTHORS b/AUTHORS
index 085e5facecaf7ff591d813a194178c2f897d5d1e..4c72215e3baea0f2b3a03be1cf2710079d549564 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -56,3 +56,12 @@ Jools Wills <jools@oxfordinspire.co.uk> -- Bugfix in the sys helper, indentation
 Mark Janssen <mark@sig-io.nl> -- ignore jobs whose filename ends with "~"
 shred <riseup@ml.shredzone.de> -- Initial patch for test mode support in the rsync handler
 Daniel Lo Nigro <daniel@dan.cx> -- Dropbox support for Duplicity
+Matthijs Wensveen <matthijs.wensveen@gmail.com> -- fix symmetric encryption in dup handler
+ulrich <ulrich@habmalnefrage.de> -- Added validation check for when
+Romain Dessort <romain@univers-libre.net> -- Fix list of devices when dumping partition tables
+Guillaume Subiron <ben@wainei.net> -- borg handler
+Jerome Charaoui <jerome@riseup.net> -- borg handler
+David Gasaway <dave@gasaway.org> -- Fixes for configuration files without suffix
+Hugh Nowlan <nosmo@nosmo.me> -- dup check for archive dir
+Lyz <lyz@riseup.net> -- sys support for LUKS in disk partitions
+Glandos <bugs-0xacab@antipoul.fr> -- sys excludes zram devices
diff --git a/ChangeLog b/ChangeLog
index fbd24ae1cd32c7083162399396067fc7294394ee..8804cace10080de13bc796799788efb94b6de14e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+version 1.1.0 -- June 29, 2018
+
+    backupninja changes
+	 · Add validation check for when parameter
+	   Thanks to ulrich <ulrich@habmalnefrage.de> for the patch
+	 · Quote output strings passed to logging functions
+	 · Ignore files in /etc/backup.d that lack suffix
+	   Thanks to David Gasaway <dave@gasaway.org> for the patch
+	 · Add Vagrantfile to help with testing/release process
+    documentation changes
+	 · Fix typos in README.md and manpages. Thank you, Lintian!
+	 · Improve release process documentation
+    handler changes
+	borg:
+	 . Add initial support for the borgbackup program
+	   Thanks to Ben <ben@wainei.net> and Thomas Preissler
+	   <thomas@preissler.co.uk> for contributing patches
+	dup:
+	 · Fix symmetric encryption
+	   Thanks to Matthijs Wensveen <matthijs.wensveen@gmail.com> for
+	   the patch.
+	 · Bail if archive dir doesn't exist
+	   Thanks to Hugh Nowlan <nosmo@nosmo.me> for the patch
+	sys:
+	 · Use lsblk instead of sfdisk to get a list of block devices
+	   Thanks to Romain Dessort <romain@univers-libre.net> for the patch
+	 · Avoid looking for partitions on zram devices
+	   Thanks to Glandos <bugs-0xacab@antipoul.fr> for the patch
+	 · Support extracting LUKS headers from partitions
+	   Thanks to Lyz <lyz@riseup.net> for the patch. 
+
 version 1.0.2 -- September 05, 2017
     handler changes
 	dsync:
diff --git a/INSTALL.md b/INSTALL.md
index 0356ee2267f70f3c9d21303a73c2ad6602704dc7..4ea811273161000a9485250a4035cda63d43978f 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -15,7 +15,7 @@ Requirements:
 
 Recommended:
 
-        rdiff-backup duplicity rsync gzip hwinfo sfdisk cryptsetup flashrom hwinfo
+        rdiff-backup duplicity rsync borgbackup gzip hwinfo sfdisk cryptsetup flashrom hwinfo
 
 To install backupninja, simply do the following:
 
diff --git a/Makefile.in b/Makefile.in
index c0283ee77f9fd850a91652d9db71556f64c88438..7f1e3d1aebce20eefcf2c504533ee8bb2159be94 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -89,7 +89,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -496,7 +496,7 @@ distdir: $(DISTFILES)
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-	tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -522,7 +522,7 @@ dist-shar: distdir
 	@echo WARNING: "Support for shar distribution archives is" \
 	               "deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-	shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -540,7 +540,7 @@ dist dist-all:
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lz*) \
@@ -550,7 +550,7 @@ distcheck: dist
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
diff --git a/README.md b/README.md
index 960dd115f749df337bd6659feb6eba096b6684aa..61a255edd1b90b6d09c95f3392b0155ae705f15a 100644
--- a/README.md
+++ b/README.md
@@ -28,12 +28,12 @@ The key features of backupninja are:
 
 The following backup types are supported:
 
- - secure, remote, incremental filesytem backup (via rdiff-backup)
+ - secure, remote, incremental filesystem backup (via rdiff-backup)
    incremental data is compressed. permissions are retained even
    with an unpriviledged backup user
  - backup of mysql databases (via mysqlhotcopy and mysqldump)
  - basic system and hardware info
- - encrypted remote backups (via duplicity)
+ - encrypted remote backups (via duplicity or borgbackup)
  - backup of subversion repositories
 
 Installation
@@ -107,6 +107,7 @@ file in `/etc/backup.d` according to the file's suffix:
  - `.sh`: run this file as a shell script.
  - `.rdiff`: filesystem backup (using rdiff-backup)
  - `.dup`: filesystem backup (using duplicity)
+ - `.borg`: filesystem backup (using borg)
  - `.mysql`: backup mysql databases
  - `.pgsql`: backup PostgreSQL databases
  - `.sys`: general hardware, partition, and system reports.
diff --git a/aclocal.m4 b/aclocal.m4
index 9ad339760ca07514bde3e2c6dcdbeaf7c7d3f8fc..433d545f6791cd0b8a611fa8184f696028ddee7c 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
 
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 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-2017 Free Software Foundation, Inc.
+# Copyright (C) 2002-2014 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.15'
 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.15.1], [],
+m4_if([$1], [1.15], [],
       [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.15.1])dnl
+[AM_AUTOMAKE_VERSION([1.15])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-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 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-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 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-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 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-2017 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 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-2017 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -388,7 +388,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -419,7 +419,7 @@ AC_DEFUN([_AM_IF_OPTION],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -500,7 +500,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2017 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -560,7 +560,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -588,7 +588,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -607,7 +607,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2017 Free Software Foundation, Inc.
+# Copyright (C) 2004-2014 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/autogen.sh b/autogen.sh
index aae1061bbd085d871930c8503040dc5d784b41e8..bb16216bad729ca85d1054cf31e37efda9e401c2 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -8,10 +8,10 @@ fi
 if [ "x$1" = "x-f"  ]
 then
     autoscan
-    [ -f "configure.in" ] && cp "configure.in" "configure.in.old"
-    mv -f "configure.scan" "configure.in"
-    echo "## This is just AUTOSCAN draft of configure.in"
-    $EDITOR "configure.in"
+    [ -f "configure.ac" ] && cp "configure.ac" "configure.ac.old"
+    mv -f "configure.scan" "configure.ac"
+    echo "## This is just AUTOSCAN draft of configure.ac"
+    $EDITOR "configure.ac"
 fi
 
 ### použít jen když je třeba použít configure.h.in
diff --git a/backupninja.spec b/backupninja.spec
index 6b8ccc6123592705ea93009819221ab94057b23a..7f84d0cadffd69d87b2f3c41688d7e6341aeadbb 100644
--- a/backupninja.spec
+++ b/backupninja.spec
@@ -1,5 +1,5 @@
 %define name    backupninja
-%define version 1.0.2
+%define version 1.1.0
 
 Summary:    Backupninja backup tool
 Name:       %{name}
diff --git a/configure b/configure
index d69b7930f21e82dd8c16c4015096e5472cf8dd40..440228e5b5cfde831fbf977df762d7903d0adab9 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.0.2.
+# Generated by GNU Autoconf 2.69 for backupninja 1.1.0.
 #
 # 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.0.2'
-PACKAGE_STRING='backupninja 1.0.2'
+PACKAGE_VERSION='1.1.0'
+PACKAGE_STRING='backupninja 1.1.0'
 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.0.2 to adapt to many kinds of systems.
+\`configure' configures backupninja 1.1.0 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.0.2:";;
+     short | recursive ) echo "Configuration of backupninja 1.1.0:";;
    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.0.2
+backupninja configure 1.1.0
 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.0.2, which was
+It was created by backupninja $as_me 1.1.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2241,7 +2241,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='backupninja'
- VERSION='1.0.2'
+ VERSION='1.1.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3276,7 +3276,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.0.2, which was
+This file was extended by backupninja $as_me 1.1.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3329,7 +3329,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.0.2
+backupninja config.status 1.1.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.in b/configure.ac
similarity index 97%
rename from configure.in
rename to configure.ac
index 88838285c274d2829a6b34d98b0937ab3327b24a..3b873a3579990c265795302768cc95eda40c3527 100644
--- a/configure.in
+++ 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.0.2],[backupninja@lists.riseup.net])
+AC_INIT([backupninja],[1.1.0],[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 dbd26bf46bb9fa4fcb642703aaf86bd6d205f8a3..b18cc5e6b793b2ed23458280e9ae1de7fee796da 100644
--- a/etc/Makefile.in
+++ b/etc/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = etc
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 89bd56b22aa0244485a9a9d01bbfbdc6b0763896..c33a8fbe66d6f195f0f0258ef92e4efdce318c39 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,7 +1,7 @@
 
-EXAMPLES = example.dup example.maildir example.makecd example.mysql \
-		example.pgsql example.rdiff example.rsync example.sh  \
-		example.svn example.sys example.trac
+EXAMPLES = example.borg example.dup example.maildir example.makecd \
+		example.mysql example.pgsql example.rdiff example.rsync \
+		example.sh example.svn example.sys example.trac
 
 EXTRA_DIST = $(EXAMPLES)
 
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 2e0665a6b7d57781f58196c4423b0ac0739cb160..98ef9bc54b0eca8b645e7f78790476fab0dfc847 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = examples
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(dist_pkgdata_DATA) \
@@ -229,9 +229,9 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-EXAMPLES = example.dup example.maildir example.makecd example.mysql \
-		example.pgsql example.rdiff example.rsync example.sh  \
-		example.svn example.sys example.trac
+EXAMPLES = example.borg example.dup example.maildir example.makecd \
+		example.mysql example.pgsql example.rdiff example.rsync \
+		example.sh example.svn example.sys example.trac
 
 EXTRA_DIST = $(EXAMPLES)
 dist_pkgdata_DATA = $(EXAMPLES)
diff --git a/examples/example.borg b/examples/example.borg
new file mode 100644
index 0000000000000000000000000000000000000000..b49598d0ab7f9a7bf3dc96cd36eb708412642eb6
--- /dev/null
+++ b/examples/example.borg
@@ -0,0 +1,182 @@
+##
+## This is an example borgbackup configuration file.
+##
+## Here you can find all the possible borgbackup options, details of
+## what the options provide and possible settings. The defaults are set
+## as the commented out option, uncomment and change when
+## necessary. Options which are uncommented in this example do not have
+## defaults, and the settings provided are recommended.
+##
+## The defaults are useful in most cases, just make sure to configure the
+## destination host and user.
+##
+
+## default is 0, but set to 19 if you want to lower the priority.
+## an example setting would be:
+## nicelevel = 19
+##
+## Default
+# nicelevel = 0
+
+## default is yes. set to no to skip the test if the remote host is alive
+##
+## Default:
+# testconnect = yes
+
+## default is not to limit bandwidth. 
+## set to a number in kiBytes/second to limit bandwidth usage. 
+##
+## Default:
+# bwlimit = 0
+
+######################################################
+## source section
+## (where the files to be backed up are coming from)
+
+[source]
+
+## default is to initialize the backup repository if absent
+## set to no to skip this step
+##
+## Default:
+# init = yes
+
+## A few notes about includes and excludes:
+## 1. include paths do not support any kind of pattern matching
+## 2. exclude paths support several types of pattern matching, the default being
+##    shell-style matching, where, for example, '*' matches any number of
+##    characters. for more info, see : borg help patterns
+## 3. Symlinks are preserved (not followed).
+##
+## for more info see : borg help patterns
+##
+## files to include in the backup
+include = /opt
+include = /srv
+include = /etc
+include = /root
+include = /home
+include = /usr/local
+include = /var
+
+## files to exclude from the backup
+exclude = /var/lock
+exclude = /var/run
+exclude = /var/cache
+exclude = /var/tmp
+exclude = /var/lib/mongodb/journal
+exclude = /var/lib/clamav
+exclude = /var/lib/mlocate
+exclude = /var/lib/postgresql
+exclude = /var/lib/mysql
+
+## define extra command-line options for the "borg create" operation.
+##
+## Example:
+## create_options = --exclude-caches
+##
+## for more info see : borg help create
+##
+## Default:
+# create_options =
+
+## whether to prune (remove) older backups
+##
+## Default:
+# prune = yes
+
+## keep all backups within this time frame.
+## must be defined as a number followed by one of the
+## following characters: "H", "d", "w", "m", "y"
+##
+## this option will be ignored if set to 0
+##
+## the default is to keep all backups made within the
+## last 30 days
+##
+## Default:
+# keep = 30d
+
+## define extra command-line options for the "borg prune" operation.
+##
+## Example:
+## prune_options = --keep-daily=7 --keep-weekly=4 --keep-monthly=6
+##
+## for more info see : borg help prune
+##
+## Default:
+# prune_options =
+
+######################################################
+## destination section
+## (where the files are copied to)
+
+[dest]
+
+## put the backups under this directory, this must be set!
+## an example setting would be:
+## directory = /backups
+##
+## Default:
+# directory =
+
+## the machine which will receive the backups.
+## an example setting would be:
+## host = backuphost
+##
+## set host = localhost for local backups (no ssh)
+##
+## Default
+# host =
+
+## make the files owned by this user. you must be able to
+## `su -c "ssh backupuser@backhost"` without specifying a password.
+## an example setting would be:
+## user = backupuser
+##
+## Default:
+# user =
+
+## archive name, should be unique every day.
+## Format tags available :
+## {now}, {utcnow}, {fqdn}, {hostname}, {user}, {pid}
+##
+## for more info see : borg help create
+##
+## Default:
+# archive = {now:%Y-%m-%dT%H:%M:%S} 
+
+## compression algorithm
+## can be "none", "lz4", "zstd[,L]", "zlib[,L]", "lzma[,L]", "auto,C[,L]".
+## - "none" stands for "no compression"
+## - "lz4" offers very high speed, very low compression
+## - "zstd" is a modern wide-range algorithm
+## - "zlib" offers medium speed, medium compression
+## - "lzma" offers low speed, high compression
+## - "auto,C" will use a heuristic to decide whether to compress using
+##            selected algorithm C
+##
+## for more info see : borg help compression
+##
+## Default:
+# compression = lz4
+
+## encryption mode to use for repository creation
+##
+## common options are "none", "repokey" or "keyfile"
+## - "none" = no encryption
+## - "repokey" = encryption with key stored inside the repository
+## - "keyfile" = encryption with key stored in ~/.config/borg/keys/
+##
+## for other options and more info, see : borg help init
+##
+## Default:
+# encryption = none
+
+## passphrase of the key used for repository encryptions
+##
+## must be set if encryption is not "none"
+## encryption is disabled by default
+##
+## Default:
+# passphrase =
diff --git a/handlers/Makefile.am b/handlers/Makefile.am
index bad53bbe857b9ffb5d833033e9b5b1ca50a7e9ff..e9526450dbd9259055b097726b3ce7a9743c52b3 100644
--- a/handlers/Makefile.am
+++ b/handlers/Makefile.am
@@ -1,9 +1,9 @@
 
-HANDLERS = dup dup.helper maildir makecd		\
+HANDLERS = borg borg.helper dup dup.helper maildir makecd	\
          makecd.helper mysql mysql.helper pgsql pgsql.helper rdiff	\
          rdiff.helper rsync sh svn sys sys.helper trac tar tar.helper
 
-DIST_HANDLERS = dup.in dup.helper.in maildir.in makecd.in		\
+DIST_HANDLERS = borg.in borg.helper.in dup.in dup.helper.in maildir.in makecd.in	\
          makecd.helper.in mysql.in mysql.helper.in pgsql.in pgsql.helper.in rdiff.in	\
          rdiff.helper.in rsync.in sh.in svn.in sys.in sys.helper.in trac.in tar.in tar.helper.in wget
 
@@ -18,6 +18,14 @@ edit = sed \
 
 pkgdata_DATA = $(HANDLERS)
 
+borg: $(srcdir)/borg.in
+	rm -f borg
+	$(edit) $(srcdir)/borg.in > borg
+
+borg.helper: $(srcdir)/borg.helper.in
+	rm -f borg.helper
+	$(edit) $(srcdir)/borg.helper.in > borg.helper
+
 dup: $(srcdir)/dup.in
 	rm -f dup
 	$(edit) $(srcdir)/dup.in > dup
diff --git a/handlers/Makefile.in b/handlers/Makefile.in
index d2b0a853f82253b7665309c70e2fd4c01e4c4533..ddcd1d81a8f457c67f7b5cdf081213862d235996 100644
--- a/handlers/Makefile.in
+++ b/handlers/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = handlers
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
@@ -228,11 +228,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-HANDLERS = dup dup.helper maildir makecd		\
+HANDLERS = borg borg.helper dup dup.helper maildir makecd	\
          makecd.helper mysql mysql.helper pgsql pgsql.helper rdiff	\
          rdiff.helper rsync sh svn sys sys.helper trac tar tar.helper
 
-DIST_HANDLERS = dup.in dup.helper.in maildir.in makecd.in		\
+DIST_HANDLERS = borg.in borg.helper.in dup.in dup.helper.in maildir.in makecd.in	\
          makecd.helper.in mysql.in mysql.helper.in pgsql.in pgsql.helper.in rdiff.in	\
          rdiff.helper.in rsync.in sh.in svn.in sys.in sys.helper.in trac.in tar.in tar.helper.in wget
 
@@ -455,6 +455,14 @@ uninstall-am: uninstall-pkgdataDATA
 .PRECIOUS: Makefile
 
 
+borg: $(srcdir)/borg.in
+	rm -f borg
+	$(edit) $(srcdir)/borg.in > borg
+
+borg.helper: $(srcdir)/borg.helper.in
+	rm -f borg.helper
+	$(edit) $(srcdir)/borg.helper.in > borg.helper
+
 dup: $(srcdir)/dup.in
 	rm -f dup
 	$(edit) $(srcdir)/dup.in > dup
diff --git a/handlers/borg.helper.in b/handlers/borg.helper.in
new file mode 100644
index 0000000000000000000000000000000000000000..d042198fe569397a83eaae0d0264ed787e783071
--- /dev/null
+++ b/handlers/borg.helper.in
@@ -0,0 +1,389 @@
+# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
+# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
+#
+# Copyright 2016 Benjamin Maisonnas <ben@wainei.net>
+#
+# This work is free. You can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+HELPERS="$HELPERS borg:deduplicated_archive_based_backup"
+
+declare -a borg_includes
+declare -a borg_excludes
+
+# FUNCTIONS
+
+do_borg_host_includes() {
+   set -o noglob
+   # choose the files to backup
+   REPLY=
+   while [ -z "$REPLY" ]; do
+      formBegin "$borg_title - host system: includes"
+         for ((i=0; i < ${#borg_includes[@]} ; i++)); do
+            formItem include ${borg_includes[$i]}
+         done
+         formItem include
+         formItem include
+         formItem include
+         formItem include
+         formItem include
+         formItem include
+         formItem include
+         formItem include
+      formDisplay
+      [ $? = 0 ] || return
+      unset borg_includes
+      borg_includes=($REPLY)
+   done
+   set +o noglob
+}
+
+do_borg_excludes() {
+   set -o noglob
+   formBegin "$borg_title: host system: excludes"
+     for ((i=0; i < ${#borg_excludes[@]} ; i++))
+     do
+       formItem exclude ${borg_excludes[$i]}
+     done
+     formItem exclude
+     formItem exclude
+     formItem exclude
+     formItem exclude
+     formItem exclude
+     formItem exclude
+     formItem exclude
+     formItem exclude
+   formDisplay
+   [ $? = 0 ] || return
+   unset borg_excludes
+   borg_excludes=($REPLY)
+   set +o noglob
+}
+
+do_borg_src() {
+   do_borg_host_includes
+   [ $? = 0 ] || return 1
+
+   do_borg_excludes
+   [ $? = 0 ] || return 1
+
+   _src_done="(DONE)"
+   setDefault dest
+}
+
+do_borg_dest() {
+   declare -a tmp_array
+
+   set -o noglob
+   REPLY=
+   while [ -z "$REPLY" -o -z "$borg_directory" -o -z "$borg_host" -o -z "$borg_user" -o -z "$borg_archive" -o -z "$borg_compression" ]
+   do
+     formBegin "$borg_title - destination"
+        formItem "directory" "$borg_directory"
+        formItem "host" "$borg_host"
+        formItem "user" "$borg_user"
+        formItem "archive_name" "$borg_archive"
+        formItem "compression" "$borg_compression"
+
+        formDisplay
+     [ $? = 0 ] || return
+     tmp_array=($REPLY)
+     borg_directory=${tmp_array[0]}
+     borg_host=${tmp_array[1]}
+     borg_user=${tmp_array[2]}
+     borg_archive=${tmp_array[3]}
+     borg_compression=${tmp_array[4]}
+  done
+  set +o noglob
+
+  _dest_done="(DONE)"
+  setDefault conn
+}
+
+do_borg_enc() {
+   radioBox "$borg_title" "Encryption mode" \
+       "none"     "no encryption and no authentication" on \
+       "repokey"  "encryption with a passphrase" off
+   [ $? = 1 ] && return;
+   borg_encryption="$REPLY"
+
+   if [ "$borg_encryption" = "repokey" ]; then
+      local question="Enter the passphrase needed to encrypt/decrypt the repository:"
+      REPLY=
+      while [ -z "$REPLY" -o -z "$borg_passphrase" ]; do
+         passwordBox "$borg_title - " "$question"
+         [ $? = 0 ] || return 1
+         borg_passphrase="$REPLY"
+      done
+   fi
+
+  _enc_done="(DONE)"
+  setDefault prune
+}
+
+do_borg_local_dir() {
+   local dir_status="ok"
+
+   IFS=$' \t\n'
+   if [ "$_dest_done" = "" ]; then
+      msgBox "$borg_title: error" "You must first configure the destination."
+      return 1
+   fi
+
+   echo "Testing to see if the borg backup directory exists and is writable"
+   if [ test -d "$borg_directory" ]; then
+      if [ test -w "$borg_directory" ]; then
+         msgBox "destination directory is not writable!" "The destination directory is not writable by the user you specified. Please fix the permissions on the directory and then try again."
+         dir_status=failed
+      fi
+   else
+      booleanBox "Destination does not exist" "The destination backup directory does not exist, do you want me to create it for you?"
+      if [ $? = 0 ]; then
+         if mkdir -p "$borg_directory"; then
+            msgBox "$borg_title: success" "Creation of the destination directory was a success!"
+         else
+            msgBox "$borg_title: error" "Creation of the destination directory failed, check the directory permissions."
+            dir_status=failed
+         fi
+      fi
+   fi
+
+   [ "$dir_status" = "ok" ] || return 1
+}
+
+do_borg_ssh_con() {
+   local remote_status="ok"
+
+   IFS=$' \t\n'
+   if [ "$_dest_done" = "" ]; then
+      msgBox "$borg_title: error" "You must first configure the destination."
+      return 1
+   elif [ "$borg_user" = "" ]; then
+      msgBox "$borg_title: error" "You must first configure the destination user."
+      return 1
+   elif [ "$borg_host" = "" ]; then
+      msgBox "$borg_title: error" "You must first configure the destination host."
+      return 1
+   else
+      booleanBox "$borg_title" "This step will create a ssh key for the local root user with no passphrase (if one does not already exist), and attempt to copy root's public ssh key to authorized_keys file of $borg_user@$borg_host. This will allow the local root to make unattended backups to $borg_user@$borg_host.\n\n\nAre you sure you want to continue?"
+      [ $? = 0 ] || return 1
+   fi
+
+   if [ ! -f /root/.ssh/id_dsa.pub -a ! -f /root/.ssh/id_rsa.pub ]; then
+      echo "Creating local root's ssh key"
+      ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N ""
+      echo "Done. hit return to continue"
+      read
+   fi
+
+   ssh -o PreferredAuthentications=publickey $borg_host -l $borg_user "exit" 2> /dev/null
+   if [ $? -ne 0 ]; then
+      echo "Copying root's public ssh key to authorized_keys of $borg_user@$borg_host. When prompted, specify the password for user $borg_user@$borg_host."
+      pubkeys=( /root/.ssh/id_[rd]sa.pub )
+      if ! ssh-copy-id -i ${pubkeys[0]} $borg_user@$borg_host; then
+         echo "FAILED: Couldn't copy root's public ssh key to authorized_keys of $borg_user@$borg_host."
+         ssh $borg_user@$borg_host 'test -w .ssh || test -w .'
+         result=$?
+         echo "Hit return to continue."
+         read
+         case $result in
+            0 )   msgBox "$borg_title: error" "Directories are writable: Probably just a typo the first time." ;;
+            1 )   msgBox "$borg_title: error" "Connected successfully to $borg_user@$borg_host, but unable to write. Check ownership and modes of ~$borg_user on $borg_host." ;;
+            255 ) msgBox "$borg_title: error" "Failed to connect to $borg_user@$borg_host. Check hostname, username, and password. Also, make sure sshd is running on the destination host." ;;
+            * )   msgBox "$borg_title: error" "Unexpected error (return code ${result})." ;;
+         esac
+         return
+      else
+         echo "Done. hit return to continue"
+         read
+      fi
+   else
+      echo "root@localhost is already in authorized_keys of $borg_user@$borg_host."
+      echo "Hit return to continue."
+      read
+   fi
+
+   # test to see if the remote borg backup directory exists and is writable
+   echo "Testing to see if remote borg backup directory exists and is writable"
+   ssh $borg_user@$borg_host "test -d ${borg_directory}"
+   if [ $? = 0 ]; then
+      ssh $borg_user@$borg_host "test -w $borg_directory"
+      if [ $? != 0 ]; then
+         msgBox "destination directory is not writable!" "The remote destination directory is not writable by the user you specified. Please fix the permissions on the directory and then try again."
+         remote_status=failed
+      fi
+   else
+      booleanBox "Remote directory does not exist" "The destination backup directory does not exist, do you want me to create it for you?"
+      if [ $? = 0 ]; then
+         ssh $borg_user@$borg_host "mkdir -p ${borg_directory}"
+         result=$?
+         case $result in
+            0) msgBox "$borg_title: success" "Creation of the remote destination directory was a success!";;
+            1) msgBox "$borg_title: error" "Connected successfully to $borg_user@$borg_host, but was unable to create the destination directory, check the directory permissions."
+               remote_status=failed;;
+            255) msgBox "$borg_title: error" "Failed to connect to $borg_user@$borg_host. Check hostname, username, and password. Also, make sure sshd is running on the destination host."
+               remote_status=failed;;
+            *) msgBox "$borg_title: error" "Unexpected error."
+               remote_status=failed;;
+         esac
+      fi
+   fi
+
+   [ "$remote_status" = "ok" ] || return 1
+}
+
+do_borg_con() {
+   echo "Checking for local install of borg"
+   which borg
+   if [ $? != 0 ]; then
+      msgBox "$borg_title: error" "borg executable not found, please install borg ($borg_docs/installation.html)."
+      return
+   fi
+
+   if [ "$borg_host" != "localhost" ]; then
+      do_borg_ssh_con
+   else
+      do_borg_local_dir
+   fi
+
+   [ $? = 0 ] || return
+
+   echo "SUCCESS: Everything looks good!"
+   echo "Hit return to continue."
+   read
+
+   _con_done="(DONE)"
+   setDefault enc
+}
+
+do_borg_prune() {
+   radioBox "$borg_title" "pruning (how many backups to keep" \
+       "yes" "regularly prune old backups" on \
+       "no"  "keep all backups" off
+   [ $? = 1 ] && return;
+   borg_prune="$REPLY"
+
+   if [ "$borg_prune" = "yes" ]; then
+      declare -a tmp_array
+      set -o noglob
+      REPLY=
+      formBegin "$borg_title - keep all backups made within this number of days"
+         formItem "keep" "$borg_keep"
+         formDisplay
+
+      [ $? = 0 ] || return
+      tmp_array=($REPLY)
+      borg_keep=${tmp_array[0]}
+
+      set +o noglob
+   fi
+
+  _prune_done="(DONE)"
+   setDefault finish
+}
+
+do_borg_finish() {
+   get_next_filename $configdirectory/90.borg
+   cat > $next_filename <<EOF
+## for more options see
+## - example.borg
+## - $borg_docs
+
+[source]
+EOF
+   ## includes ##
+   set -o noglob
+   for ((i=0; i < ${#borg_includes[@]} ; i++)); do
+      echo "include = ${borg_includes[$i]}" >> $next_filename
+   done
+   set +o noglob
+
+   ## excludes ##
+   set -o noglob
+   for ((i=0; i < ${#borg_excludes[@]} ; i++)); do
+     echo exclude = ${borg_excludes[$i]} >> $next_filename
+   done
+   set +o noglob
+   cat >> $next_filename <<EOF
+
+## for more info see : borg prune -h
+prune = $borg_prune
+keep = "${borg_keep}d"
+
+[dest]
+directory = $borg_directory
+host = $borg_host
+user = $borg_user
+archive = $borg_archive
+compression = $borg_compression
+encryption = $borg_encryption
+passphrase = $borg_passphrase
+EOF
+
+   chmod 600 $next_filename
+}
+
+borg_main_menu() {
+   while true; do
+      srcitem="choose files to include & exclude $_src_done"
+      destitem="configure backup destination $_dest_done"
+      conitem="test connection and destination dir $_con_done"
+      encitem="configure encryption mode $_enc_done"
+      pruneitem="configure pruning (optional) $_prune_done"
+      menuBox "$borg_title" "choose a step:" \
+         src "$srcitem" \
+         dest "$destitem" \
+         conn "$conitem" \
+         enc "$encitem" \
+         prune "$pruneitem" \
+         finish "finish and create config file"
+      [ $? = 0 ] || return
+      result="$REPLY"
+      case "$result" in
+         "src") do_borg_src;;
+         "dest") do_borg_dest;;
+         "conn") do_borg_con;;
+         "enc") do_borg_enc;;
+         "prune") do_borg_prune;;
+         "finish")
+            if [[ "$_con_done$_dest_done$_enc_done$_src_done" != "(DONE)(DONE)(DONE)(DONE)" ]]; then
+               msgBox "$borg_title" "You cannot create the configuration file until mandatory steps are completed."
+            else
+               do_borg_finish
+               return
+            fi
+            ;;
+      esac
+   done
+}
+
+borg_wizard() {
+   # Global variables
+   borg_title="borg action wizard"
+   borg_docs="http://borgbackup.readthedocs.io/en/stable"
+
+   _src_done=
+   _dest_done=
+   _enc_done=
+   _con_done=
+
+   borg_directory=/backup/`hostname`
+   borg_user=root
+   borg_host=localhost
+   borg_archive='{now:%Y-%m-%dT%H:%M:%S}'
+   borg_compression=lz4
+   borg_encryption=none
+   borg_passphrase=
+   borg_keep=30
+
+   # Global variables whose '*' shall not be expanded
+   set -o noglob
+   borg_includes=(/var/spool/cron/crontabs /var/backups /etc /root /home /usr/local/*bin)
+   borg_excludes=(/home/*/.gnupg /home/*/.local/share/Trash /home/*/.Trash /home/*/.thumbnails)
+   set +o noglob
+
+   borg_main_menu
+}
diff --git a/handlers/borg.in b/handlers/borg.in
new file mode 100644
index 0000000000000000000000000000000000000000..df500a80bacb6daf26c61625d01eca6d558e27db
--- /dev/null
+++ b/handlers/borg.in
@@ -0,0 +1,169 @@
+# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
+# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
+#
+# borg handler script for backupninja
+# requires borgbackup
+#
+# Guillaume Subiron, Sysnove, 2016
+#
+# Copyright 2016 Guillaume Subiron <guillaume@sysnove.fr>
+#
+# This work is free. You can redistribute it and/or modify it under the
+# terms of the Do What The Fuck You Want To Public License, Version 2,
+# as published by Sam Hocevar. See the http://www.wtfpl.net/ file for more details.
+#
+#
+
+export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
+export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
+
+### GET CONFIG ###
+
+getconf testconnect yes
+getconf nicelevel 0
+getconf bwlimit
+
+setsection source
+getconf init yes
+getconf include
+getconf exclude
+getconf create_options
+getconf prune yes
+getconf keep 30d
+getconf prune_options
+
+setsection dest
+getconf user
+getconf host
+getconf directory
+# strip trailing /
+directory=${directory%/}
+getconf archive {now:%Y-%m-%dT%H:%M:%S}
+getconf compression lz4
+getconf encryption none
+getconf passphrase
+
+export BORG_PASSPHRASE="$passphrase"
+
+### CHECK CONFIG ###
+
+# destination specific checks
+[ "$directory" != "" ] || fatal "Destination directory not set"
+if [ "$host" != "localhost" ]; then
+  execstr_repository="ssh://${user}@${host}${directory}"
+else
+  execstr_repository="$directory"
+fi
+execstr_archive="$archive"
+
+# check the connection at the source and destination
+[ -n "$test" ] || test=0
+if [ "$host" != "localhost" ] && ([ "$testconnect" = "yes" ] || [ "${test}" -eq 1 ]); then
+   debug "ssh -o PasswordAuthentication=no $host -l $user 'echo -n 1'"
+   local ret=`ssh -o PasswordAuthentication=no $host -l $user 'echo -n 1'`
+   if [ "$ret" = 1 ]; then
+      debug "Connected to $host as $user successfully"
+   else
+      teststr="borg list --show-rc -v $execstr_repository"
+      debug "$teststr"
+      output=`su -c "$teststr" 2>&1`
+      if echo "$output" | grep "terminating with success status" ; then
+         debug "Connected to $host as $user successfully (forced command)"
+      else
+         if echo "$output" | grep -E "Repository.+does not exist" ; then
+            debug "Connected to $host as $user successfully (forced command)"
+         else
+            fatal "Can't connect to $host as $user."
+         fi
+      fi
+   fi
+fi
+
+### INIT IF NEEDED ###
+
+if [ "$init" == "yes" ]; then
+   initstr="borg init --encryption=$encryption $execstr_repository"
+   debug "$initstr"
+   if [ $test = 0 ]; then
+      output="`su -c "$initstr" 2>&1`"
+      if [ $? = 2 ]; then
+         debug $output
+         info "Repository was already initialized"
+      else
+         warning $output
+         warning "Repository has been initialized"
+      fi
+   fi
+fi
+
+### EXECUTE ###
+
+execstr="borg create --stats --compression $compression"
+
+set -o noglob
+
+# includes
+SAVEIFS=$IFS
+IFS=$(echo -en "\n\b")
+for i in $include; do
+   includes="${includes} '$i'"
+done
+IFS=$SAVEIFS
+
+# excludes
+SAVEIFS=$IFS
+IFS=$(echo -en "\n\b")
+for i in $exclude; do
+   excludes="${excludes} --exclude '$i'"
+done
+IFS=$SAVEIFS
+
+set +o noglob
+
+if [ ! -z $bwlimit ]; then
+   execstr="${execstr} --remote-ratelimit=${bwlimit}"
+fi
+
+if [ ! -z $create_options ]; then
+   execstr="${execstr} ${create_options}"
+fi
+
+# include client-part and server-part
+execstr="${execstr} ${excludes} $execstr_repository::$execstr_archive ${includes}"
+debug "$execstr"
+
+if [ $test = 0 ]; then
+   output=`nice -n $nicelevel su -c "$execstr" 2>&1`
+   if [ $? = 0 ]; then
+      debug $output
+      info "Successfully finished backing up source $label"
+   else
+      error $output
+      fatal "Failed backuping up source $label"
+   fi
+fi
+
+### REMOVE OLD BACKUPS ###
+
+# borg prune
+if [ "$prune" == "yes" ]; then
+   if [ ! "$keep" == "0" ]; then
+      prune_options="${prune_options} --keep-within=${keep}"
+   fi
+   prunestr="borg prune $prune_options $execstr_repository"
+   debug "$prunestr"
+   if [ $test = 0 ]; then
+      output="`su -c "$prunestr" 2>&1`"
+      if [ $? = 0 ]; then
+         debug $output
+         info "Removing old backups succeeded."
+      else
+         warning $output
+         warning "Failed removing old backups."
+      fi
+   fi
+fi
+
+unset BORG_PASSPHRASE
+
+return 0
diff --git a/handlers/dup.in b/handlers/dup.in
index 43b282fc6dfdd09d06b70957aa4f3fabca99d495..d304ed16580c52a4df6cd0700280cb1507b6f245 100644
--- a/handlers/dup.in
+++ b/handlers/dup.in
@@ -50,7 +50,9 @@ destdir=${destdir%/}
 [ -n "$desturl" -o -n "$destdir" ]  || fatal "The destination directory (destdir) must be set when desturl is not used."
 [ -n "$include" -o -n "$vsinclude" ]  || fatal "No source includes specified"
 [ -n "$password" ] || fatal "The password option must be set."
-[ -n "$signpassword" -a -n "$signkey" -a -n "$encryptkey" -a "$signkey" != "$encryptkey" ] || fatal "The signpassword option must be set because signkey is different from encryptkey."
+if [ -n "$signkey" -a -n "$encryptkey" -a "$signkey" != "$encryptkey" ]; then
+   [ -n "$signpassword" ] || fatal "The signpassword option must be set because signkey is different from encryptkey."
+fi
 if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "s3+http" ]; then
    [ -n "$awsaccesskeyid" -a -n "$awssecretaccesskey" ]  || fatal "AWS access keys must be set for S3 backups."
 fi
@@ -223,6 +225,7 @@ fi
 # duplicity now enables the archive_dir by default, let's put it into /var/cache/backupninja/duplicity
 # unless the user has specified it.
 if echo "${options}" | grep -qv -- "--archive-dir" ; then
+   [ -d "/var/cache/backupninja" ] || fatal "/var/cache/backupninja does not exist - create it"
    execstr_options="${execstr_options} --archive-dir /var/cache/backupninja/duplicity"
 fi
 
@@ -312,10 +315,10 @@ if [ ! $test ]; then
              "$execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
    exit_code=$?
    if [ $exit_code -eq 0 ]; then
-      debug $output
+      debug "$output"
       info "Duplicity cleanup finished successfully."
    else
-      debug $output
+      debug "$output"
       warning "Duplicity cleanup failed."
    fi
 fi
@@ -332,10 +335,10 @@ if [ "$keep" != "yes" ]; then
                 "$execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
       exit_code=$?
       if [ $exit_code -eq 0 ]; then
-         debug $output
+         debug "$output"
          info "Duplicity remove-older-than finished successfully."
       else
-         debug $output
+         debug "$output"
          warning "Duplicity remove-older-than failed."
       fi
    fi
@@ -355,10 +358,10 @@ if [ "$keep" != "yes" ]; then
                "$execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart 2>&1"`
             exit_code=$?
             if [ $exit_code -eq 0 ]; then
-               debug $output
+               debug "$output"
                info "Duplicity remove-all-inc-of-but-n-full finished successfully."
             else
-               debug $output
+               debug "$output"
                warning "Duplicity remove-all-inc-of-but-n-full failed."
             fi
          fi
@@ -377,12 +380,12 @@ if [ ! $test ]; then
              su -c \
                 "$execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"`
    exit_code=$?
-   debug $output
+   debug "$output"
    cat $outputfile | (while read output ; do
                          if [ $exit_code -eq 0 ]; then
-                            info $output
+                            info "$output"
                          else
-                            error $output
+                            error "$output"
                          fi
                       done
    )
diff --git a/handlers/makecd.in b/handlers/makecd.in
index d44bba33a777e20a888e7a2a5deae285d494b8c4..a45259e81e68fbc386d7833be260550d1b7ab49e 100644
--- a/handlers/makecd.in
+++ b/handlers/makecd.in
@@ -51,10 +51,10 @@ debug 0 "echo $execstr "
 output=` $execstr 2>&1 `
 code=$?
 if [ "$code" == "0" ]; then
-   debug $output
+   debug "$output"
    info "Successfully finished creation of iso"
 else
-   warning $output
+   warning "$output"
    warning "Failed to create iso"
 fi
 
@@ -65,10 +65,10 @@ if [ "$isoonly" == "no" ]; then
       $CDRECORD -v gracetime=2 dev=$device speed=8 -dao -data $outputfile
       code=$?
       if [ "$code" == "0" ]; then
-         debug $output
+         debug "$output"
          info "Successfully burned CD"
       else
-         warning $output
+         warning "$output"
          warning "Failed to create CD"
       fi
    fi
@@ -77,10 +77,10 @@ if [ "$isoonly" == "no" ]; then
       $GROWISOFS -speed=2 -Z $device=$outputfile -use-the-force-luke=notray -use-the-force-luke=tty
       code=$?
       if [ "$code" == "0" ]; then
-         debug $output
+         debug "$output"
          info "Successfully burned DVD"
       else
-         warning $output
+         warning "$output"
          warning "Failed to create DVD"
       fi
    fi
diff --git a/handlers/mysql.in b/handlers/mysql.in
index 151d5c0115514c1a0742c08ad90c49de79c41202..e7931518e79c936ad3081ade414410fb361ee547 100644
--- a/handlers/mysql.in
+++ b/handlers/mysql.in
@@ -194,10 +194,10 @@ then
          code=$?
          if [ "$code" == "0" ]
          then
-            debug $output
+            debug "$output"
             info "Successfully finished hotcopy of all mysql databases"
          else
-            warning $output
+            warning "$output"
             warning "Failed to hotcopy all mysql databases"
          fi
       fi
@@ -217,10 +217,10 @@ then
             code=$?
             if [ "$code" == "0" ]
             then
-               debug $output
+               debug "$output"
                info "Successfully finished hotcopy of mysql database $db"
             else
-               warning $output
+               warning "$output"
                warning "Failed to hotcopy mysql database $db"
             fi
          fi
@@ -255,6 +255,9 @@ then
 
    for db in $databases
    do
+      # Sanitize database name
+      db=$(echo $db | tr -d \'\;)
+
       DUMP_BASE="$MYSQLDUMP $defaultsfile $sqldumpoptions"
 
       # Dumping structure and data
@@ -303,10 +306,10 @@ then
          code=$?
          if [ "$code" == "0" ]
          then
-            debug $output
+            debug "$output"
             info "Successfully finished dump of mysql database $db"
          else
-            warning $output
+            warning "$output"
             warning "Failed to dump mysql databases $db"
          fi
       fi
diff --git a/handlers/pgsql.in b/handlers/pgsql.in
index fc337a033f023898107666f97e0dd13dafe4f4ca..31a2168b66011ff9150c598859079c9aea2f196a 100644
--- a/handlers/pgsql.in
+++ b/handlers/pgsql.in
@@ -131,10 +131,10 @@ if [ "$databases" == "all" ]; then
       output=`eval $execstr 2>&1`
       code=$?
       if [ "$code" == "0" ]; then
-         debug $output
+         debug "$output"
          info "Successfully finished dump of pgsql cluster"
       else
-         warning $output
+         warning "$output"
          warning "Failed to dump pgsql cluster"
       fi
    fi
@@ -161,10 +161,10 @@ else
          output=`eval $execstr 2>&1`
          code=$?
          if [ "$code" == "0" ]; then
-            debug $output
+            debug "$output"
             info "Successfully finished pgsql globals (roles and tablespaces) dump"
          else
-            warning $output
+            warning "$output"
             warning "Failed to dump pgsql globals (roles and tablespaces)"
          fi
       fi
@@ -198,10 +198,10 @@ else
          output=`eval $execstr 2>&1`
          code=$?
          if [ "$code" == "0" ]; then
-            debug $output
+            debug "$output"
             info "Successfully finished dump of pgsql database ${db}"
          else
-            warning $output
+            warning "$output"
             warning "Failed to dump pgsql database ${db}"
          fi
       fi
diff --git a/handlers/rdiff.in b/handlers/rdiff.in
index 471a3d71ef2f9321b391e0100b0b771eb51bd3d1..2a06d2ec8cecd0dd13aa8fd32d83f8c41ae6e847 100644
--- a/handlers/rdiff.in
+++ b/handlers/rdiff.in
@@ -184,13 +184,13 @@ if [ "$keep" != yes ]; then
       output="`su -c "$removestr" 2>&1`"
       if [ $? = 0 ]; then
          if [ "$output_as_info" == "yes" ]; then
-            info $output
+            info "$output"
          else
-            debug $output
+            debug "$output"
          fi
          info "Removing backups older than $keep days succeeded."
       else
-         warning $output
+         warning "$output"
          warning "Failed removing backups older than $keep."
       fi
    fi
@@ -274,13 +274,13 @@ if [ $test = 0 ]; then
    output=`nice -n $nicelevel su -c "$execstr" 2>&1`
    if [ $? = 0 ]; then
       if [ "$output_as_info" == "yes" ]; then
-         info $output
+         info "$output"
       else
-         debug $output
+         debug "$output"
       fi
       info "Successfully finished backing up source $label"
    else
-      error $output
+      error "$output"
       fatal "Failed backup up source $label"
    fi
 fi
diff --git a/handlers/sys.in b/handlers/sys.in
index 1d4797708c644830c2c0c3d3e908641ab4571f76..e037b2fafd4cadbebdc60466a02a145c5893cf65 100644
--- a/handlers/sys.in
+++ b/handlers/sys.in
@@ -107,6 +107,7 @@ getconf sysreportfile $parentdir/sysreport.txt
 
 getconf SFDISK `which sfdisk`
 getconf HWINFO `which hwinfo`
+getconf LSBLK `which lsblk`
 getconf sfdisk_options ""
 getconf hwinfo_options ""
 
@@ -607,7 +608,7 @@ fi
 
 if [ "$partitions" == "yes" ]; then
    if [ "$dosfdisk" == "yes" ]; then
-      devices=`LC_ALL=C $SFDISK -l 2>/dev/null | grep "^Disk /dev" | @AWK@ '{print $2}' | cut -d: -f1`
+      devices=`LC_ALL=C $LSBLK --output NAME,TYPE --list --paths 2>/dev/null | grep "disk$" | grep -v '^/dev/zram' | @AWK@ '{print $1}'`
       if [ "$devices" == "" ]; then
          warning "No harddisks found"
       fi
@@ -632,7 +633,7 @@ if [ "$partitions" == "yes" ]; then
 fi
 
 if [ "$luksheaders" == "yes" ]; then
-   devices=`LC_ALL=C $SFDISK -l 2>/dev/null | grep "^Disk /dev" | @AWK@ '{print $2}' | cut -d: -f1`
+   devices=`LC_ALL=C $SFDISK -l 2>/dev/null | grep -E '^(Disk )?/dev/' | @SED@ -e 's/Disk //' -re 's/:? +.*//g'`
    [ -n "$devices" ] || warning "No block device found"
    partitions=`LC_ALL=C $SFDISK -l 2>/dev/null |grep "^/dev" | @AWK@ '{print $1}'`
    [ -n "$partitions" ] || warning "No partitions found"
@@ -663,10 +664,10 @@ if [ "$luksheaders" == "yes" ]; then
       output=`$DD if="${dev}" of="${outputfile}" bs=512 count="${headersize}" 2>&1`
       exit_code=$?
       if [ $exit_code -eq 0 ]; then
-         debug $output
+         debug "$output"
          info "The LUKS header of $dev was saved to $outputfile."
       else
-         debug $output
+         debug "$output"
          fatal "The LUKS header of $dev could not be saved."
       fi
    done
@@ -719,7 +720,7 @@ function doLvmBackup () {
       output=`$VGCFGBACKUP --file "${lvmdir}"/'%s' $vg`
    done
    exit_code=$?
-   debug $output
+   debug "$output"
    case $exit_code in
       0)
          info "LVM metadata was saved to $lvmdir for volume groups: $vgs"
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 7a294b2eb9e79e79180132cf961d33eb4863af45..f269ef720278571af8193c0412d72a6eb40b958e 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = lib
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
diff --git a/man/Makefile.in b/man/Makefile.in
index dd95ca4e8f2814412256c2b73c79ab485b57ecfd..b5d94385edc76285af8f86fa58277d22bb4c56c0 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -87,7 +87,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = man
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
diff --git a/man/backup.d.5 b/man/backup.d.5
index df2063e5bd82fa99ad4cb1f0ef75f9e78a12aec8..5b7a62625641b2c6ca146943848a567ebbcf064c 100644
--- a/man/backup.d.5
+++ b/man/backup.d.5
@@ -33,6 +33,8 @@ run this file as a shell script.
 backup action for rdiff-backup.
 .IP .dup
 backup action for duplicity.
+.IP .borg
+backup action for borgbackup.
 .IP .maildir
 backup action for slow, incremental rsyncs of tens of thousands of maildirs.
 .IP .mysql
diff --git a/man/backupninja.1 b/man/backupninja.1
index b1d28758d5f9c404fa3b68a95e76826609cbf2ba..84508f6dd01433c18c6303fe60452ea1a5e76d06 100644
--- a/man/backupninja.1
+++ b/man/backupninja.1
@@ -52,7 +52,7 @@ works with Linux-Vservers.
 
 .B Backup types include:
 .IP - 2
-secure, remote, incremental filesytem backup (via rdiff-backup). incremental data is compressed. permissions are retained even with an unpriviledged backup user.
+secure, remote, incremental filesystem backup (via rdiff-backup). incremental data is compressed. permissions are retained even with an unpriviledged backup user.
 .IP -
 basic system and hardware information.
 .IP -
diff --git a/man/backupninja.conf.5 b/man/backupninja.conf.5
index 50e0238f81910bb08aa97c8eb75a28349a160c51..a87bab7aeb8b353e0ad5818aa9f26040db6df453 100644
--- a/man/backupninja.conf.5
+++ b/man/backupninja.conf.5
@@ -73,8 +73,8 @@ If set to 'yes', use colors in the log file and debug output.
 .TP
 .B when
 When to process each configuration file. The value used here will
-be applied for each configuration file. It is possibile to override
-this "when" in each each configuration file, see also section 
+be applied for each configuration file. It is possible to override
+this "when" in each configuration file, see also section
 "Scheduling" in backup.d(5).
 
 For example:
diff --git a/src/Makefile.in b/src/Makefile.in
index 4182fa657319b596e4d3109ec2998f25b0d4782e..f0b56b2b245e8a21489613596081d743e8e23e73 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
diff --git a/src/backupninja.in b/src/backupninja.in
index c3733cfd233bb947cec2798efac123c67516f04e..756c67816c7d8df45414105ff761a1ca87275e58 100755
--- a/src/backupninja.in
+++ b/src/backupninja.in
@@ -215,25 +215,56 @@ function isnow() {
    whendayofweek=$1; at=$2; whentime=$3;
    whenday=`toint "$whendayofweek"`
    whendayofweek=`tolower "$whendayofweek"`
+   whentimeoriginal=$whentime
    whentime=`echo "$whentime" | @SED@ 's/:[0-9][0-9]$//' | @SED@ -r 's/^([0-9])$/0\1/'`
 
    if [ "$whendayofweek" == "everyday" -o "$whendayofweek" == "daily" ]; then
-      whendayofweek=$nowdayofweek
+       whendayofweek=$nowdayofweek
    fi
 
    if [ "$whenday" == "" ]; then
-      if [ "$whendayofweek" != "$nowdayofweek" ]; then
-         whendayofweek=${whendayofweek%s}
-         if [ "$whendayofweek" != "$nowdayofweek" ]; then
-            return 0
-         fi
-      fi
+       if [ "$whendayofweek" != "$nowdayofweek" ]; then
+           whendayofweek=${whendayofweek%s}
+           if [ "$whendayofweek" != "$nowdayofweek" ]; then
+               if [ "$whendayofweek" != "mondays" -a "$whendayofweek" != "tuesdays" -a "$whendayofweek" != "wednesdays" -a "$whendayofweek" != "thursdays" -a "$whendayofweek" != "fridays" -a "$whendayofweek" != "saturdays" -a "$whendayofweek" != "sundays" ]; then
+                   warning "The day in the 'when' option in the configuration is malformed. Please read the README for examples."
+               fi
+               if [ "$at" != "at" ]; then
+                   warning "The 'when' option in the configuration doesn't contain an 'at'. Please read the README for examples."
+               fi
+               if [[ "$whentimeoriginal" != @([0-9][0-9])?(:[0-9][0-9]) ]]; then
+                   warning "The time in the 'when' option in the configuration is malformed or does not exist. Please read the README for examples."
+	       fi
+               return 0
+           fi
+       fi
    elif [ "$whenday" != "$nowday" ]; then
-      return 0
+       if [ "$whenday" -lt 1 -o "$whenday" -gt 31 ]; then
+	   warning "The numeric value of the day in the 'when' option in the configuration does not match a day. Please read the README for examples."
+       fi
+       if [ -z "$whentime" ]; then
+           warning "The 'when' variable in the configuration file is malformed. You either didn't specify the day or the time. Please read the README for eamples."
+       fi
+       if [ "$at" != "at" ]; then
+           warning "The 'when' option in the configuration doesn't contain an 'at'. Please read the README for examples."
+       fi
+       return 0
+   elif [ -z "$whentime" ]; then
+       warning "The 'when' variable in the configuration file is malformed. You either didn't specify the day or the time. Please read the README for examples."
+       return 0
    fi
 
-   [ "$at" == "at" ] || return 0
-   [ "$whentime" == "$nowtime" ] || return 0
+   if [ "$at" != "at" ]; then
+       warning "The 'when' option in the configuration doesn't contain an 'at'. Please read the README for examples."
+       return 0
+   fi
+
+   if [[ "$whentimeoriginal" != @([0-9][0-9])?(:[0-9][0-9]) ]]; then
+       warning "The time in the 'when' option in the configuration is malformed. Please read the README for examples."
+       return 0
+   elif [ "$whentime" != "$nowtime" ]; then
+       return 0
+   fi
 
    return 1
 }
@@ -557,9 +588,9 @@ for file in $files; do
 
    check_perms ${file%/*} # check containing dir
    check_perms $file
-   suffix="${file##*.}"
    base=`basename $file`
-   if [ "${base:0:1}" == "0" -o "$suffix" == "disabled" ]; then
+   suffix="${base##*.}"
+   if [ "${base:0:1}" == "0" -o "$suffix" == "disabled" -o "$suffix" == "$base" ]; then
       info "Skipping $file"
       continue
    fi