From b12ef3e54b83d859427b787ae6c2d9c2621773c9 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Sun, 14 Mar 2021 00:05:39 -0600 Subject: [PATCH] Upgrade Dojo to v1.9.0 --- rootfs/standard/etc/systemd/system/dojo.service | 1 + rootfs/standard/usr/bin/is_mainnet.sh | 11 +++++++++++ rootfs/standard/usr/bin/mynode_docker_images.sh | 8 ++++---- rootfs/standard/var/www/mynode/dojo.py | 8 +++++++- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100755 rootfs/standard/usr/bin/is_mainnet.sh diff --git a/rootfs/standard/etc/systemd/system/dojo.service b/rootfs/standard/etc/systemd/system/dojo.service index 26b63eed..c2e2d7d7 100644 --- a/rootfs/standard/etc/systemd/system/dojo.service +++ b/rootfs/standard/etc/systemd/system/dojo.service @@ -9,6 +9,7 @@ After=network.target mynode.service docker_images.service Type=forking RemainAfterExit=yes ExecStartPre=/usr/bin/is_not_shutting_down.sh +ExecStartPre=/usr/bin/is_mainnet.sh ExecStartPre=/usr/bin/wait_on_bitcoin.sh ExecStartPre=/usr/bin/wait_on_docker_image_install.sh WorkingDirectory=/mnt/hdd/mynode/dojo/docker/my-dojo diff --git a/rootfs/standard/usr/bin/is_mainnet.sh b/rootfs/standard/usr/bin/is_mainnet.sh new file mode 100755 index 00000000..f3e1a191 --- /dev/null +++ b/rootfs/standard/usr/bin/is_mainnet.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +source /usr/share/mynode/mynode_config.sh + +# Check if testnet +if [ -f $IS_TESTNET_ENABLED_FILE ]; then + exit 1 +fi + +# We are on mainnet (exit success) +exit 0 \ No newline at end of file diff --git a/rootfs/standard/usr/bin/mynode_docker_images.sh b/rootfs/standard/usr/bin/mynode_docker_images.sh index fe466fe7..138e6c57 100755 --- a/rootfs/standard/usr/bin/mynode_docker_images.sh +++ b/rootfs/standard/usr/bin/mynode_docker_images.sh @@ -86,8 +86,8 @@ while true; do fi # Install Dojo - DOJO_VERSION="v1.8.0" - DOJO_TAR_HASH="4c1e41790b6839f26ec947e96b3dc4c94e0218f0003e292a2c3808b0a1182fe6" + DOJO_VERSION="v1.9.0" + DOJO_TAR_HASH="b9709c18bb58f514a2f1db948b421b691b22fbf7713f5a68ce9627f35fcbf306" DOJO_UPGRADE_URL=https://code.samourai.io/dojo/samourai-dojo/-/archive/$DOJO_VERSION/samourai-dojo-$DOJO_VERSION.tar.gz DOJO_UPGRADE_URL_FILE=/mnt/hdd/mynode/settings/dojo_url CURRENT="" @@ -98,8 +98,8 @@ while true; do sync sleep 3s fi - # Only install Dojo if marked for installation - if [ -f /mnt/hdd/mynode/settings/mynode_dojo_install ]; then + # Only install Dojo if marked for installation and testnet not enabled + if [ -f /mnt/hdd/mynode/settings/mynode_dojo_install ] && [ ! -f $IS_TESTNET_ENABLED_FILE ]; then if [ -f $DOJO_UPGRADE_URL_FILE ]; then INSTALL=false CURRENT=$(cat $DOJO_UPGRADE_URL_FILE) diff --git a/rootfs/standard/var/www/mynode/dojo.py b/rootfs/standard/var/www/mynode/dojo.py index f876c8d7..7b0e7533 100644 --- a/rootfs/standard/var/www/mynode/dojo.py +++ b/rootfs/standard/var/www/mynode/dojo.py @@ -1,6 +1,6 @@ from flask import Blueprint, render_template, redirect -from device_info import read_ui_settings, is_installing_docker_images +from device_info import read_ui_settings, is_installing_docker_images, is_testnet_enabled from user_management import check_logged_in from enable_disable_functions import is_dojo_enabled, enable_dojo, disable_dojo, is_dojo_installed from bitcoin_info import get_mynode_block_height @@ -23,6 +23,12 @@ def get_dojo_status(): dojo_initialized = "" return dojo_status, dojo_status_color, dojo_initialized + if is_testnet_enabled(): + dojo_status = "Requires Mainnet" + dojo_status_color = "gray" + dojo_initialized = "" + return dojo_status, dojo_status_color, dojo_initialized + try: dojo_initialized = subprocess.check_output("docker inspect --format={{.State.Running}} db", shell=True) dojo_initialized = dojo_initialized.strip()