diff options
| author | Steve Kemp <steve@steve.org.uk> | 2015-06-03 10:58:40 +0100 | 
|---|---|---|
| committer | Steve Kemp <steve@steve.org.uk> | 2015-06-03 10:58:40 +0100 | 
| commit | 30cdbf783417b74c3c1a2a07d48bd0ab6399f5c4 (patch) | |
| tree | 907ca9eeac54467765da447b337113d04877fee6 | |
| parent | 5c7ba852f6c9847f778d1b3f1293eab8b0e2e096 (diff) | |
Added server-side support for listing archived files.
This allows remote clients to see the files they've archived.
| -rwxr-xr-x | byteback-receive | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/byteback-receive b/byteback-receive index b5e71a5..1c8f4ae 100755 --- a/byteback-receive +++ b/byteback-receive @@ -2,15 +2,14 @@  #  # Program to receive backups and run rsync in receive mode.  Must check that  # user as authorised by SSH is allowed to access particular directory. -# -$LOAD_PATH.unshift("/usr/lib/byteback") +#STDERR.print ARGV.inspect + "\n" +$LOAD_PATH << '/usr/lib/byteback'  require 'trollop'  require 'byteback'  include Byteback::Log -  if ENV['SSH_ORIGINAL_COMMAND']  	ARGV.concat(ENV['SSH_ORIGINAL_COMMAND'].split(" "))  end @@ -21,8 +20,7 @@ fatal("BYTEBACK_HOST environment not set") unless byteback_host  byteback_root = ENV['HOME'] + "/" + ENV["BYTEBACK_HOST"]  fatal("#{byteback_root} does not exist") unless File.directory?(byteback_root) -# -# force the destination to be where we expect +# force destination to be where we expect  #  if ARGV[0] == 'rsync'  	ARGV[-1] = "#{byteback_root}/current" @@ -35,12 +33,16 @@ end  opts = Trollop::options do  	opt :verbose, "Print diagnostics"  	opt :ping, "Check connection parameters and exit" +	opt :list, "Show backed up files matching the given pattern", :type => :string  	opt :complete, "Mark current backup as complete"  end  error("Please only choose one mode") if opts[:ping] && opts[:complete]  if opts[:complete]  	system("byteback-snapshot", "--root", byteback_root) +elsif opts[:list] +	system( "find #{byteback_root} -print | grep #{opts[:list]}" ) +	exit(0 )  elsif opts[:ping]  	exit 0  else | 
