rsnapshot: add rsnapshot backup utility
authorFlorian Fainelli <florian@openwrt.org>
Wed, 5 Dec 2012 17:31:02 +0000 (17:31 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Wed, 5 Dec 2012 17:31:02 +0000 (17:31 +0000)
this adds the rsnapshot backup utility to the packages feed.

To be compatible with busybox logger, I had to patch rsnapshot to don't
pass -i to logger. This package was also proposed in Ticket #11371, but
in a wrong categorie, without this patch, without most of the dependencies
and without the conffiles line to save rsnapshot.conf over sysupgrade.

[florian: fix whitespaces and clean up configure args]

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
SVN-Revision: 34508

utils/rsnapshot/Makefile [new file with mode: 0644]
utils/rsnapshot/patches/001-busybox-logger-i.patch [new file with mode: 0644]

diff --git a/utils/rsnapshot/Makefile b/utils/rsnapshot/Makefile
new file mode 100644 (file)
index 0000000..a228423
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2007-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rsnapshot
+PKG_VERSION:=1.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.rsnapshot.org/downloads/
+PKG_MD5SUM:=588f92995dcf60a6ea6df8d94a017e7e
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rsnapshot
+  SUBMENU:=backup
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=rsnapshot Backup
+  URL:=http://www.rsnapshot.org/
+  DEPENDS:=+rsync +perl \
+               +perlbase-autoloader \
+               +perlbase-class \
+               +perlbase-cwd \
+               +perlbase-dirhandle \
+               +perlbase-essential \
+               +perlbase-fcntl \
+               +perlbase-file \
+               +perlbase-getopt \
+               +perlbase-io \
+               +perlbase-posix \
+               +perlbase-selectsaver \
+               +perlbase-symbol \
+               +perlbase-tie \
+               +perlbase-xsloader
+endef
+
+define Package/rsnapshot/description
+  rsnapshot is a filesystem snapshot utility for making backups of local and
+  remote systems.
+
+  Using rsync and hard links, it is possible to keep multiple, full backups
+  instantly available. The disk space required is just a little more than the
+  space of one full backup, plus incrementals.
+endef
+
+CONFIGURE_ARGS += --with-cp=/bin/cp \
+                 --with-rsync=/usr/bin/rsync \
+                 --with-rm=/bin/rm \
+                 --with-ssh=/usr/bin/ssh \
+                 --with-logger=/usr/bin/logger \
+                 --with-du=/usr/bin/du
+
+define Package/rsnapshot/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/$(PKG_NAME).conf.default $(1)/etc/$(PKG_NAME).conf
+endef
+
+define Package/rsnapshot/conffiles
+/etc/$(PKG_NAME).conf
+endef
+
+$(eval $(call BuildPackage,rsnapshot))
diff --git a/utils/rsnapshot/patches/001-busybox-logger-i.patch b/utils/rsnapshot/patches/001-busybox-logger-i.patch
new file mode 100644 (file)
index 0000000..db4af28
--- /dev/null
@@ -0,0 +1,23 @@
+diff --git a/rsnapshot-program.pl b/rsnapshot-program.pl
+index dfd7ef6..c51b9ff 100755
+--- a/rsnapshot-program.pl
++++ b/rsnapshot-program.pl
+@@ -2164,15 +2164,15 @@ sub syslog_msg {
+       if (defined($config_vars{'cmd_logger'})) {
+               # print out our call to syslog
+               if (defined($verbose) && ($verbose >= 4)) {
+-                      print_cmd("$config_vars{'cmd_logger'} -i -p $facility.$level -t rsnapshot $msg");
++                      print_cmd("$config_vars{'cmd_logger'} -p $facility.$level -t rsnapshot $msg");
+               }
+               
+               # log to syslog
+               if (0 == $test) {
+-                      $result = system($config_vars{'cmd_logger'}, '-i', '-p', "$facility.$level", '-t', 'rsnapshot', $msg);
++                      $result = system($config_vars{'cmd_logger'}, '-p', "$facility.$level", '-t', 'rsnapshot', $msg);
+                       if (0 != $result) {
+                               print_warn("Could not log to syslog:", 2);
+-                              print_warn("$config_vars{'cmd_logger'} -i -p $facility.$level -t rsnapshot $msg", 2);
++                              print_warn("$config_vars{'cmd_logger'} -p $facility.$level -t rsnapshot $msg", 2);
+                       }
+               }
+       }