summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2015-12-02 12:51:23 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2015-12-02 12:51:23 +0000
commitd7d1548e7c07369247571a939b0c1838f1c2ee75 (patch)
tree37aaf91ff452d7be058e0d19c323474f97d57fb7 /bin
parent0a523d29567f91083485f5837965c10e22100bf2 (diff)
Catch situations where no files are matched during restore.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/byteback-receive18
1 files changed, 16 insertions, 2 deletions
diff --git a/bin/byteback-receive b/bin/byteback-receive
index e5be576..c80068b 100755
--- a/bin/byteback-receive
+++ b/bin/byteback-receive
@@ -59,10 +59,15 @@ if (ARGV[0] == 'byteback-restore')
# ownership at the restorers end.
args << "--exclude=."
+ #
+ # Search for certain files
+ # DANGER the args might be too long if lots of files are returned.
+ #
+ paths = Byteback::Restore.decode_args(ARGV)
restore = Byteback::Restore.new(byteback_root)
restore.snapshot = snapshot if snapshot
- restore.find(Byteback::Restore.decode_args(ARGV))
+ restore.find(paths, :all => all)
Dir.chdir(byteback_host)
@@ -70,7 +75,16 @@ if (ARGV[0] == 'byteback-restore')
args << File.join(".", r.snapshot, r.path)
end
- info(args.join(" "))
+ if restore.results.empty?
+ STDERR.puts "** Sorry. There were no files matching:"
+ STDERR.puts "--> "+paths.join("\n--> ")
+ exit 1
+ end
+
+ STDERR.puts "Restoring:"
+ STDERR.puts restore.list
+ STDERR.puts(args.join(" ")) if verbose
+
exec(*args)
elsif ARGV[0] == 'rsync'