diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-06-03 13:00:18 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-06-03 13:00:18 +0100 |
commit | 2af8b5453c95f7ffe13ae5c5560a3f37a07aca75 (patch) | |
tree | 9d8d9cb210d7563e077f29526af474cf4b6c58dd | |
parent | 443dfeca1f57b5030a850e628fdb807c18d93353 (diff) |
Correctly handle rsync send vs. restore
-rwxr-xr-x | byteback-receive | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/byteback-receive b/byteback-receive index 9756978..23282db 100755 --- a/byteback-receive +++ b/byteback-receive @@ -24,21 +24,21 @@ fatal("#{byteback_root} does not exist") unless File.directory?(byteback_root) # Force restores to be limited to the hostname we're connecting form # if ( ARGV[0] == 'restore' ) - ARGV[0] = 'rsync' - a = [] - ARGV.each do |tmp| - if ( tmp =~ /^\/(.*)/ ) - tmp = "#{byteback_host}/#{$1.dup}" - end - a.push(tmp) - end - exec(*a) -eslif ARGV[0] == 'rsync' - ARGV[-1] = "#{byteback_root}/current" + ARGV[0] = 'rsync' + a = [] + ARGV.each do |tmp| + if ( tmp =~ /^\/(.*)/ ) + tmp = "#{byteback_host}/#{$1.dup}" + end + a.push(tmp) + end + exec(*a) +elsif ARGV[0] == 'rsync' + ARGV[-1] = "#{byteback_root}/current" exec(*ARGV) elsif ARGV[0] == 'byteback-snapshot' - ARGV.concat(["--root", "#{byteback_root}"]) - exec(*ARGV) + ARGV.concat(["--root", "#{byteback_root}"]) + exec(*ARGV) end opts = Trollop::options do |