From 6bbf190a8a8e761bffc7e99ffb8357746dd9cad9 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 2 Dec 2015 12:48:28 +0000 Subject: Updated argument parsing in the restore functionality of receive * Verbose is now caught properly * --all is caught and removed --- bin/byteback-receive | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'bin') diff --git a/bin/byteback-receive b/bin/byteback-receive index 87d3071..0b6a5c5 100755 --- a/bin/byteback-receive +++ b/bin/byteback-receive @@ -23,27 +23,40 @@ byteback_root = ENV['HOME'] + '/' + ENV['BYTEBACK_HOST'] fatal("#{byteback_root} does not exist") unless File.directory?(byteback_root) # -# Force restores to be limited to the hostname we're connecting form +# Calling byteback-restore really needs rsync to restore the files. # - - - if (ARGV[0] == 'byteback-restore') + # + # Ignore the first arg + # + ARGV.shift + args = ["rsync"] - snapshot = nil + snapshot = nil + verbose = false + all = false + + # + # Mangle the arguments, and pull out any that are not-rsync compatible. + # + while(arg = ARGV.shift) + case arg + when "." + break + when /^-([^-]*v[^-]*|-verbose)$/ + verbose = true + args << arg + when "--snapshot" + snapshot = ARGV.shift + when "--all" + all = true + else + args << arg + end + end - while((arg = ARGV.shift) != ".") - break if arg.nil? - verbose = arg if arg == "--verbose" - if arg == "--snapshot" - snapshot = ARGV.shift - else - args << arg - end - end - restore = Byteback::Restore.new(byteback_root) restore.snapshot = snapshot if snapshot restore.find(Byteback::Restore.decode_args(ARGV)) -- cgit v1.2.3