From 2af8b5453c95f7ffe13ae5c5560a3f37a07aca75 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Wed, 3 Jun 2015 13:00:18 +0100 Subject: Correctly handle rsync send vs. restore --- byteback-receive | 26 +++++++++++++------------- 1 file 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 -- cgit v1.2.1