From e691eb7a10d1ed618cb670886340b55ad5b7686a Mon Sep 17 00:00:00 2001
From: intrigeri <intrigeri@boum.org>
Date: Wed, 17 Aug 2011 12:00:16 +0200
Subject: [PATCH] Allow 'when = XXX' in sh jobs.

when=XXX did work already. This patch allow to write this with spaces around the
equal sign - as in every other backup.d/ file.
---
 AUTHORS             | 1 +
 ChangeLog           | 5 +++++
 examples/example.sh | 2 ++
 handlers/sh.in      | 7 +++++++
 4 files changed, 15 insertions(+)

diff --git a/AUTHORS b/AUTHORS
index d50e69d..7d36c33 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -39,3 +39,4 @@ Jordi Mallach <jordi@debian.org> -- do not error when no jobs are configured
 Jacob Anawalt <jlanawalt@gmail.com> -- pg_dump format option
 Sergio Talens-Oliag <sto@debian.org> -- pipefail fixes
 Bruno Bigras <bigras.bruno@gmail.com> -- enable tar handler in the build system
+casper -- Allow 'when = XXX' with spaces in .sh files.
diff --git a/ChangeLog b/ChangeLog
index f4a38f5..872f974 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+version 0.9.10 -- UNRELEASED
+    handler changes:
+	sh:
+	 . Allow 'when = XXX' with spaces (Redmine#2769).
+	   Thanks to casper for the patch.
 version 0.9.9 -- May 15, 2011
     backupninja changes
 	 . Use locking to avoid running concurrent instances of the same backup
diff --git a/examples/example.sh b/examples/example.sh
index f02f026..75b0162 100644
--- a/examples/example.sh
+++ b/examples/example.sh
@@ -1,2 +1,4 @@
+# Note: the spaces around the equal sign ('=') are optional.
+when = saturdays at 05:30
 
 dpkg --get-selections > /var/backups/dpkg-selections.txt
diff --git a/handlers/sh.in b/handlers/sh.in
index b070f3b..384ca52 100644
--- a/handlers/sh.in
+++ b/handlers/sh.in
@@ -5,4 +5,11 @@
 # runs the file /etc/backup.d/scriptname.sh
 #
 
+# No-op function so that 'when = XXX' can be written as such in
+# backup.d/*.sh, i.e. with spaces around the equal sign - as in every
+# other backup.d/ file.
+function when() {
+   true
+}
+
 [ $test ] || ( . $1 )
-- 
GitLab