diff --git a/rootfs/standard/usr/bin/mynode_upgrade.sh b/rootfs/standard/usr/bin/mynode_upgrade.sh index f4899e40..24165c29 100755 --- a/rootfs/standard/usr/bin/mynode_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_upgrade.sh @@ -64,7 +64,11 @@ VERSION=$(cat /usr/share/mynode/version) touch $UPGRADE_ERROR_FILE for i in {1..5} do - /bin/bash /usr/bin/mynode_post_upgrade.sh > /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_${i}.txt 2>&1 + # 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 rm -f $UPGRADE_ERROR_FILE diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index 49d13c38..4c9840b5 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -173,7 +173,9 @@ def upgrade_device(): # Upgrade os.system("mkdir -p /home/admin/upgrade_logs") - cmd = "/usr/bin/mynode_upgrade.sh > /home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt 2>&1".format(get_current_version()) + file1 = "/home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt".format(get_current_version()) + file2 = "/home/admin/upgrade_logs/upgrade_log_latest.txt" + cmd = "/usr/bin/mynode_upgrade.sh 2>&1 | tee {} {}".format(file1, file2) subprocess.call(cmd, shell=True) # Sync @@ -189,7 +191,9 @@ def upgrade_device_beta(): # Upgrade os.system("mkdir -p /home/admin/upgrade_logs") - cmd = "/usr/bin/mynode_upgrade.sh beta > /home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt 2>&1".format(get_current_version()) + file1 = "/home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt".format(get_current_version()) + file2 = "/home/admin/upgrade_logs/upgrade_log_latest.txt" + cmd = "/usr/bin/mynode_upgrade.sh beta 2>&1 | tee {} {}".format(file1, file2) subprocess.call(cmd, shell=True) # Sync diff --git a/rootfs/standard/var/www/mynode/settings.py b/rootfs/standard/var/www/mynode/settings.py index c5318067..a55cade4 100644 --- a/rootfs/standard/var/www/mynode/settings.py +++ b/rootfs/standard/var/www/mynode/settings.py @@ -321,6 +321,16 @@ def upgrade_beta_page(): } return render_template('reboot.html', **templateData) +@mynode_settings.route("/settings/get-upgrade-log") +def get_upgrade_log_page(): + check_logged_in() + + log = get_file_contents("/home/admin/upgrade_logs/upgrade_log_latest.txt") + if (log == "ERROR"): + log = "No log file found" + + return log + @mynode_settings.route("/settings/get-latest-version") def get_latest_version_page(): check_logged_in() diff --git a/rootfs/standard/var/www/mynode/templates/settings.html b/rootfs/standard/var/www/mynode/templates/settings.html index b6c9868f..71094eec 100644 --- a/rootfs/standard/var/www/mynode/templates/settings.html +++ b/rootfs/standard/var/www/mynode/templates/settings.html @@ -427,7 +427,10 @@
It appears a recent upgrade may not have fully completed.
- - {% endif %} +