def bootstrap_livery
script = File.expand_path(File.dirname(__FILE__) + "/../../scripts/#{livery}.sh")
if livery == :cwd
script = File.join(Dir.pwd, '/bootstrap.sh')
end
unless File.exists?(script)
puts "Could not find `#{script}` which is needed to kick-start the machine"
return
end
unpack_command = 'true'
dir_name = File.basename(Dir.pwd)
if can_rsync?
unpack_command = "cd #{dir_name}"
run_command('rsync', '-avL',
'-e',
'ssh -o StrictHostKeyChecking=no',
'--exclude=.git',
'--exclude=.svn',
'--exclude=.blimpy.d',
'.',
"#{username}@#{dns}:#{dir_name}/")
else
puts "Remote host has no rsync(1), falling back to copying a full tarball over"
tarball = Blimpy::Livery.tarball_directory(Dir.pwd)
scp_file(tarball)
basename = File.basename(tarball)
ssh_into("tar -zxf #{basename} && cd #{dir_name}")
end
puts 'Bootstrapping the livery'
run_sudo = 'sudo'
if username == 'root'
run_sudo = ''
end
scp_file(script, dir_name)
ssh_into("cd #{dir_name} && #{run_sudo} ./#{File.basename(script)}")
end