Skip to content

Instantly share code, notes, and snippets.

@jameshilliard
Last active August 29, 2015 14:10
Show Gist options
  • Save jameshilliard/9e88dc9e107181f7da20 to your computer and use it in GitHub Desktop.
Save jameshilliard/9e88dc9e107181f7da20 to your computer and use it in GitHub Desktop.
Net::SSH.start(current_ip, "root", :password => "root", :paranoid => false) do |ssh|
puts "checking file integrity"
tmp_md5 = ssh.exec!(fw_latest_md5_command)
puts tmp_md5.inspect
if fw_latest_md5 == tmp_md5
puts ssh.exec fw_upgrade_command do |ch, stream, data|
if stream == "Rebooting system..."
puts "Upgrade Complete"
ch.shutdown()
puts "Shutting Down"
break
puts "Shut Down"
else
puts "ERROR: #{data}"
end
end
else
puts "Firmware upload is corrupt"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment