diff --git a/rootfs/standard/usr/bin/mynode_upgrade.sh b/rootfs/standard/usr/bin/mynode_upgrade.sh index 24165c29..928ccf07 100755 --- a/rootfs/standard/usr/bin/mynode_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_upgrade.sh @@ -59,15 +59,16 @@ sleep 1 sync sleep 1 -# Run post upgrade script VERSION=$(cat /usr/share/mynode/version) + +# Clear old upgrade logs +rm -f /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_* +rm -f /home/admin/upgrade_logs/upgrade_log_latest_post_* + +# Run post upgrade script touch $UPGRADE_ERROR_FILE for i in {1..5} do - # Clear old upgrade logs - rm -f /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_* - rm -f /home/admin/upgrade_logs/upgrade_log_latest_post_* - /bin/bash /usr/bin/mynode_post_upgrade.sh 2>&1 | tee /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_${i}.txt /home/admin/upgrade_logs/upgrade_log_latest_post_${i}.txt RC=$? if [ "${RC}" -eq "0" ]; then diff --git a/rootfs/standard/var/www/mynode/settings.py b/rootfs/standard/var/www/mynode/settings.py index a55cade4..9e7e1c59 100644 --- a/rootfs/standard/var/www/mynode/settings.py +++ b/rootfs/standard/var/www/mynode/settings.py @@ -298,6 +298,7 @@ def upgrade_page(): "title": "myNode Upgrade", "header_text": "Upgrading", "subheader_text": "This may take a while...", + "show_upgrade_log": True, "ui_settings": read_ui_settings() } return render_template('reboot.html', **templateData) @@ -317,11 +318,12 @@ def upgrade_beta_page(): "title": "myNode Upgrade", "header_text": "Upgrading", "subheader_text": "This may take a while...", + "show_upgrade_log": True, "ui_settings": read_ui_settings() } return render_template('reboot.html', **templateData) -@mynode_settings.route("/settings/get-upgrade-log") +@mynode_settings.route("/settings/get-upgrade-log-raw") def get_upgrade_log_page(): check_logged_in() @@ -331,6 +333,20 @@ def get_upgrade_log_page(): return log +@mynode_settings.route("/settings/upgrade-test") +def upgrade_page_test(): + check_logged_in() + + # Display wait page + templateData = { + "title": "myNode Upgrade", + "header_text": "Upgrading", + "subheader_text": "This may take a while...", + "show_upgrade_log": True, + "ui_settings": read_ui_settings() + } + return render_template('reboot.html', **templateData) + @mynode_settings.route("/settings/get-latest-version") def get_latest_version_page(): check_logged_in() diff --git a/rootfs/standard/var/www/mynode/templates/reboot.html b/rootfs/standard/var/www/mynode/templates/reboot.html index 03c19e58..b7f879d2 100644 --- a/rootfs/standard/var/www/mynode/templates/reboot.html +++ b/rootfs/standard/var/www/mynode/templates/reboot.html @@ -28,9 +28,32 @@ hasShutdown = 1 }) } - + checkStatus() setInterval(checkStatus, 2500); + + {% if show_upgrade_log is defined and show_upgrade_log %} + function update_upgrade_log () { + console.log("Updating upgrade log..."); + $.get("/settings/get-upgrade-log-raw", function(data) { + //console.log(data) + data = data.split("\n"); + data.reverse(); + log = data.join("\n") + console.log("Displaying " + data.length + " lines") + $("#upgrade_log_contents").html(log) + }); + } + $("#show_upgrade_log").on("click", function() { + $("#show_upgrade_log").hide(0); + $("#loading_spinner").hide(0); + + update_upgrade_log() + setInterval(update_upgrade_log, 4000); + + $("#upgrade_log").show(); + }); + {% endif %} }); @@ -46,8 +69,16 @@

please do not power off or unplug device

+
+

- + + {% if show_upgrade_log is defined and show_upgrade_log %} + + + {% endif %}