summaryrefslogtreecommitdiff
path: root/byteback-backup
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2014-06-13 14:11:48 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2014-06-13 14:11:48 +0100
commit03adb1a1695ba8901cadf60e4f96cc050b7baae0 (patch)
tree627c0206db37c3fc4c6e83f89b8423ee62e06c94 /byteback-backup
parent7524f76a38735c87018761476000e507be81d610 (diff)
Removed --one-filesystem flag to avoid cock-ups, and removed the sources option, and rejigged the excludes option to allow the excludes file to be parsed as an rsync filter. Added an rsync_filter file, which is merged in as a filter.
Diffstat (limited to 'byteback-backup')
-rwxr-xr-xbyteback-backup27
1 files changed, 16 insertions, 11 deletions
diff --git a/byteback-backup b/byteback-backup
index b1f321d..9600665 100755
--- a/byteback-backup
+++ b/byteback-backup
@@ -73,16 +73,6 @@ if File.exists?("/etc/byteback/key")
@ssh_key = "/etc/byteback/key"
end
-# Read in the default sources
-if File.exists?("/etc/byteback/sources")
- @sources = File.readlines("/etc/byteback/sources").map{|m| m.chomp}
-end
-
-# Read in the default excludes
-if File.exists?("/etc/byteback/excludes")
- @excludes = File.readlines("/etc/byteback/excludes").map{|m| m.chomp}
-end
-
begin
opts.each do |opt,arg|
case opt
@@ -209,11 +199,26 @@ def rsync(*sources)
# at the end of the job, and rsync will do more work for big files without
# it.
#
- args = %w(rsync --archive --numeric-ids --delete --inplace --delete --one-file-system --relative)
+ args = %w(rsync --archive --numeric-ids --delete-delay --inplace --relative)
args += [ "--rsync-path", "rsync --fake-super"]
args += [ "--rsh", "ssh -o BatchMode=yes -x -a -i #{@ssh_key} -l #{@destination_user}"]
args << "--verbose" if $VERBOSE
args += @excludes.map { |x| ["--exclude", x] }.flatten
+
+ #
+ # Add in the rsync excludes and sources files, if present.
+ #
+ if File.exists?("/etc/byteback/excludes")
+ args += ["--exclude-from", "/etc/byteback/excludes"]
+ end
+
+ #
+ # Add in an rsync_filter if required.
+ #
+ if File.exists?("/etc/byteback/rsync_filter")
+ args += ["--filter", "merge /etc/byteback/rsync_filter"]
+ end
+
args += sources
args << @destination