lanturtle-modules/updates/4.update

24 lines
1.0 KiB
Plaintext
Raw Normal View History

2017-11-23 21:53:17 +00:00
function sha256sum() {
python -sBc "import hashlib;print hashlib.sha256(open('$1','rb').read()).hexdigest()"
}
echo -e "Update Available. Install will begin in 15 seconds...\n\n"
echo -e "All local LAN Turtle data will be erased.\n\n"
echo -e "Press CTRL+C to CANCEL\n\n"
sleep 15
echo -e "Downloading Upgrade file, please wait.\n\n"
2021-07-12 19:37:35 +00:00
wget -q -O /tmp/upgrade.bin https://downloads.hak5.org/api/devices/lanturtle/firmwares/4-stable
2017-11-23 21:53:17 +00:00
echo -e "Upgrade file downloaded. Verifying file integrity.\n\n"
[[ "$(sha256sum /tmp/upgrade.bin)" == "6034bee1a7ace9a6122a4525f27a5a160f6e1113205f582f45de0715edc877f0" ]] && {
echo -e "DO NOT UNPLUG OR POWER DOWN THE LAN TURTLE\n\n"
echo -e "Upgrade in progress. Please wait ~5 minutes.\n"
echo -e "The LAN Turtle will reboot when the upgrade is complete.\n"
echo -e "This SSH session will now close.\n"
echo "sleep 10 && sysupgrade -n /tmp/upgrade.bin" | at now &> /dev/null
sleep 8 && clear
killall sshd
} || {
echo -e "SHA256 checksum missmatch. Please try again."
}