summaryrefslogtreecommitdiff
path: root/byteback-setup-client
diff options
context:
space:
mode:
authorMatthew Bloch <matthew@bytemark.co.uk>2014-12-04 22:34:27 +0000
committerMatthew Bloch <matthew@bytemark.co.uk>2014-12-04 22:34:27 +0000
commitea336814acc5fd51c385ae837f280670d0fc3a45 (patch)
treef41af64ed7ba95339ecf9c1c739c2a80f329263e /byteback-setup-client
parent54849eb03280b7c859905b3ca190fce3b931e631 (diff)
A few more usability tweaks for byteback-setup-client.
Diffstat (limited to 'byteback-setup-client')
-rwxr-xr-xbyteback-setup-client11
1 files changed, 8 insertions, 3 deletions
diff --git a/byteback-setup-client b/byteback-setup-client
index fb3838a..70b8ea8 100755
--- a/byteback-setup-client
+++ b/byteback-setup-client
@@ -35,10 +35,13 @@ end
_dummy, @destination_user, @destination_host, colon, @destination_path =
/^(.*)?(?:@)([^:]+)(:)(.*)?$/.match(@destination).to_a
-error("Must be a remote path") unless colon
+@destination_user ||= 'byteback'
+@destination_path ||= ''
+@destination_host ||= @destination
+
if !@hostname
@hostname = `hostname -f`.chomp
- print "No hostname set, using #{@hostname}\n"
+ warn "No hostname set, using #{@hostname}\n"
end
FileUtils.mkdir_p("/etc/byteback")
@@ -60,6 +63,8 @@ key_pub = File.read("/etc/byteback/key.pub").chomp
error "Remote setup didn't work" unless
system("ssh -i /etc/byteback/key -l #{@destination_user} #{@destination_host} byteback-setup-client-receive #{@hostname} #{key_pub}")
-File.open("/etc/byteback/destination", "w") { |f| f.print @destination }
+File.open("/etc/byteback/destination", "w") do |f|
+ f.print "#{@destination_user}@#{@destination_host}:#{@destination_path}"
+end
print "Setup worked! To take your first backup run: byteback-backup --verbose\n"