summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2015-12-02 12:48:28 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2015-12-02 12:48:28 +0000
commit6bbf190a8a8e761bffc7e99ffb8357746dd9cad9 (patch)
tree295fb3762bf2759f5a31de89da2707ca95e2ceec /bin
parent60b04be9d0f10866426ed1f1aa3718720676c866 (diff)
Updated argument parsing in the restore functionality of receive
* Verbose is now caught properly * --all is caught and removed
Diffstat (limited to 'bin')
-rwxr-xr-xbin/byteback-receive43
1 files changed, 28 insertions, 15 deletions
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))