Last active
August 29, 2015 14:00
-
-
Save jameshilliard/11183463 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'net/scp' | |
| require 'net/ssh' | |
| require 'timeout' | |
| require 'net/ping' | |
| ipaddress = ARGV[0] | |
| current_ip = ipaddress | |
| fw_latest = "Linux antMiner 3.10.12 #2 Fri Feb 7 18:50:12 CST 2014 mips GNU/Linux" | |
| known_outdated_fw = ["Linux antMiner 3.10.12 #10 Thu Dec 26 09:03:53 CST 2013 mips GNU/Linux" => "antMiner_openwrt20131226.bin"] | |
| Net::SSH.start(current_ip, "root", :password => "root", :paranoid => false) do |ssh| | |
| puts "checking S1 firmware version" | |
| current_fw = ssh.exec!("uname -a") | |
| puts current_fw | |
| if current_fw == fw_latest | |
| puts "device already on latest firmware" | |
| elsif known_outdated_fw(current_fw).has_key? == true | |
| puts current_fw | |
| else | |
| puts "Unknown Firmware Version Detected" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment