diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index 7b8f7471..3d4008ab 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -9,6 +9,9 @@ set -e # Make sure time is in the log date +# Mark we are upgrading +echo "upgrading" > $MYNODE_STATUS_FILE + # Shut down main services to save memory and CPU /usr/bin/mynode_stop_critical_services.sh diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index 0af4b681..49d13c38 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -55,6 +55,9 @@ def shutdown_device(): os.system("/usr/bin/mynode_stop_critical_services.sh") os.system("shutdown -h now") +def is_shutting_down(): + return os.path.isfile("/tmp/shutting_down") + def factory_reset(): # Reset subsystems that have local data delete_quicksync_data() @@ -386,6 +389,8 @@ STATE_QUICKSYNC_RESET = "quicksync_reset" STATE_STABLE = "stable" STATE_ROOTFS_READ_ONLY = "rootfs_read_only" STATE_HDD_READ_ONLY = "hdd_read_only" +STATE_SHUTTING_DOWN = "shutting_down" +STATE_UPGRADING = "upgrading" STATE_UNKNOWN = "unknown" def get_mynode_status(): diff --git a/rootfs/standard/var/www/mynode/mynode.py b/rootfs/standard/var/www/mynode/mynode.py index 32d0e212..ae6ca7f7 100644 --- a/rootfs/standard/var/www/mynode/mynode.py +++ b/rootfs/standard/var/www/mynode/mynode.py @@ -279,6 +279,24 @@ def index(): "ui_settings": read_ui_settings() } return render_template('state.html', **templateData) + elif status == STATE_UPGRADING: + templateData = { + "title": "myNode Upgrading", + "header_text": "Upgrading...", + "subheader_text": "This may take a while...", + "refresh_rate": 120, + "ui_settings": read_ui_settings() + } + return render_template('state.html', **templateData) + elif status == STATE_SHUTTING_DOWN or is_shutting_down(): + templateData = { + "title": "myNode Reboot", + "header_text": "Restarting", + "subheader_text": "This will take several minutes...", + "refresh_rate": 120, + "ui_settings": read_ui_settings() + } + return render_template('state.html', **templateData) elif status == STATE_STABLE: bitcoind_status_code = get_service_status_code("bitcoind") lnd_status_code = get_service_status_code("lnd")