Add early beta support

This commit is contained in:
Taylor Helsper 2020-02-23 19:39:40 -06:00
parent b68e10509c
commit 05b99c09df
11 changed files with 120 additions and 10 deletions

View File

@ -91,7 +91,7 @@ release: clean_rootfs rootfs release.sh
@sh release.sh
.PHONY: beta
beta: clean_rootfs rootfs release.sh
beta: clean_rootfs release.sh
@sh release.sh beta

View File

@ -4,5 +4,3 @@
# Now calculated in main config file...
# Other Info
UPGRADE_DOWNLOAD_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&serial=${SERIAL_NUM}"
UPGRADE_DOWNLOAD_SIGNATURE_URL="http://www.mynodebtc.com/device/hashes/mynode_release_latest_${DEVICE_TYPE}.sha256"

View File

@ -4,5 +4,3 @@
# Now calculated in main config file...
# Other Info
UPGRADE_DOWNLOAD_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&serial=${SERIAL_NUM}"
UPGRADE_DOWNLOAD_SIGNATURE_URL="http://www.mynodebtc.com/device/hashes/mynode_release_latest_${DEVICE_TYPE}.sha256"

View File

@ -4,5 +4,3 @@
# Now calculated in main config file...
# Other Info
UPGRADE_DOWNLOAD_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&serial=${SERIAL_NUM}"
UPGRADE_DOWNLOAD_SIGNATURE_URL="http://www.mynodebtc.com/device/hashes/mynode_release_latest_${DEVICE_TYPE}.sha256"

View File

@ -350,6 +350,7 @@ chmod +x /usr/bin/electrs || true # Once, a device didn't have the execute bit s
# Check for new versions
wget $LATEST_VERSION_URL -O /usr/share/mynode/latest_version || true
wget $LATEST_BETA_VERSION_URL -O /usr/share/mynode/latest_beta_version || true
# Update current state
if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then

View File

@ -5,6 +5,20 @@ set -x
source /usr/share/mynode/mynode_config.sh
BETA=0
while test $# -gt 0
do
case "$1" in
beta) echo "found beta"
BETA=1
;;
*) echo "Unknown Argument: $1"
exit 1
;;
esac
shift
done
# Setup
rm -rf /opt/mynode_release_latest.tar.gz
rm -rf /opt/mynode_release.pub
@ -13,8 +27,13 @@ mkdir -p /opt/upgrade/
mkdir -p /home/admin/upgrade_logs/
# Download Latest
wget $UPGRADE_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz
wget $UPGRADE_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256
if [ $BETA = 0 ]; then
wget $UPGRADE_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz
wget $UPGRADE_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256
else
wget $UPGRADE_BETA_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz
wget $UPGRADE_BETA_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256
fi
wget $UPGRADE_PUBKEY_URL -O /opt/mynode_release.pub
openssl dgst -sha256 -verify /opt/mynode_release.pub -signature /opt/mynode_release_latest.sha256 /opt/mynode_release_latest.tar.gz

View File

@ -53,6 +53,7 @@ QUICKSYNC_TORRENT_BETA_URL="https://mynodebtc.com/device/blockchain_beta.tar.gz.
QUICKSYNC_UPLOAD_RATE_FILE="/mnt/hdd/mynode/settings/quicksync_upload_rate"
QUICKSYNC_BACKGROUND_DOWNLOAD_RATE_FILE="/mnt/hdd/mynode/settings/quicksync_background_download_rate"
LATEST_VERSION_URL="http://www.mynodebtc.com/device/latest_version"
LATEST_BETA_VERSION_URL="http://www.mynodebtc.com/device/latest_beta_version"
UPLOADER_FILE="/mnt/hdd/mynode/settings/uploader"
UPGRADE_ERROR_FILE="/mnt/hdd/mynode/settings/upgrade_error"
LND_BACKUP_FOLDER="/home/bitcoin/lnd_backup/"
@ -86,6 +87,8 @@ fi
UPGRADE_DOWNLOAD_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&serial=${SERIAL_NUM}"
UPGRADE_DOWNLOAD_SIGNATURE_URL="http://www.mynodebtc.com/device/hashes/mynode_release_latest_${DEVICE_TYPE}.sha256"
UPGRADE_BETA_DOWNLOAD_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?beta=1&type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&serial=${SERIAL_NUM}"
UPGRADE_BETA_DOWNLOAD_SIGNATURE_URL="http://www.mynodebtc.com/device/hashes/mynode_release_latest_beta_${DEVICE_TYPE}.sha256"
UPGRADE_PUBKEY_URL="https://raw.githubusercontent.com/mynodebtc/pubkey/master/mynode_release.pub"
# Update settings for other devices

View File

@ -9,6 +9,7 @@ CONFIG["lndhub_enabled"] = True
# myNode variables
LATEST_VERSION_URL = "https://www.mynodebtc.com/device/latest_version"
LATEST_BETA_VERSION_URL = "https://www.mynodebtc.com/device/latest_beta_version"
CHECKIN_URL = "https://www.mynodebtc.com/device_api/check_in.php"
# Bitcoin Variables

View File

@ -58,12 +58,20 @@ def get_current_version():
current_version = "error"
return current_version
def get_current_beta_version():
current_beta_version = "0.0"
try:
with open("/usr/share/mynode/beta_version", "r") as f:
current_beta_version = f.read().strip()
except:
current_beta_version = "not_installed"
return current_beta_version
def update_latest_version():
os.system("wget "+LATEST_VERSION_URL+" -O /usr/share/mynode/latest_version")
os.system("wget "+LATEST_BETA_VERSION_URL+" -O /usr/share/mynode/latest_beta_version")
return True
def get_latest_version():
latest_version = "0.0"
try:
@ -75,6 +83,15 @@ def get_latest_version():
latest_version = get_current_version()
return latest_version
def get_latest_beta_version():
beta_version = ""
try:
with open("/usr/share/mynode/latest_beta_version", "r") as f:
beta_version = f.read().strip()
except:
beta_version = ""
return beta_version
def reinstall_app(app):
# Upgrade
os.system("mkdir -p /home/admin/upgrade_logs")
@ -101,6 +118,19 @@ def upgrade_device():
# Reboot
reboot_device()
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())
subprocess.call(cmd, shell=True)
# Sync
os.system("sync")
time.sleep(1)
# Reboot
reboot_device()
def did_upgrade_fail():
return os.path.isfile("/mnt/hdd/mynode/settings/upgrade_error")

View File

@ -68,6 +68,8 @@ def page_settings():
current_version = get_current_version()
latest_version = get_latest_version()
current_beta_version = get_current_beta_version()
latest_beta_version = get_latest_beta_version()
changelog = get_device_changelog()
serial_number = get_device_serial()
@ -138,6 +140,8 @@ def page_settings():
"password_message": "",
"current_version": current_version,
"latest_version": latest_version,
"current_beta_version": current_beta_version,
"latest_beta_version": latest_beta_version,
"upgrade_error": did_upgrade_fail(),
"upgrade_logs": get_recent_upgrade_logs(),
"serial_number": serial_number,
@ -216,6 +220,23 @@ def upgrade_page():
}
return render_template('reboot.html', **templateData)
@mynode_settings.route("/settings/upgrade-beta")
def upgrade_beta_page():
check_logged_in()
# Upgrade device
t = Timer(1.0, upgrade_device_beta)
t.start()
# Display wait page
templateData = {
"title": "myNode Upgrade",
"header_text": "Upgrading",
"subheader_text": "This may take a while...",
"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()

View File

@ -901,6 +901,47 @@
<div class="settings_block">
<div class="settings_block_header">Developer</div>
{% if not product_key_skipped %}
<div class="settings_block_subheader">Reinstall Latest Version</div>
If you are running a beta or are having issues, it may be helpful to reinstall the latest official release.
<br/>
<button id="upgrade" class="ui-button ui-widget ui-corner-all settings_button">Install Latest Version</button>
<div class="divider"></div>
{% endif %}
{% if not product_key_skipped %}
<div class="settings_block_subheader">Install Beta</div>
You can install beta releases of myNode software to help test. These may be less stable.
<br/><br/>
<table border="0">
<tr>
<td>Current Beta Version</td>
<td>{{current_beta_version}}</td>
<td></td>
</tr>
<tr>
<td>Latest Beta Version</td>
<td>{{latest_beta_version}}</td>
<td>&nbsp;<a href="/settings/get-latest-version" class="ui-button ui-widget ui-corner-all settings_button_small">Check for Updates</a></td>
</tr>
</table>
{% if current_beta_version != latest_beta_version and latest_beta_version != "" %}
<button id="upgrade" class="ui-button ui-widget ui-corner-all settings_button">Install Beta</button>
{% if product_key_skipped %}
<p>Upgrade to myNode Premium to get one-click updates!</p>
<p>For manual upgrades, see our <a target="_blank" href="https://mynodebtc.com/guide/upgrading_your_device">upgrade guide</a>!</p>
{% endif %}
{% elif upgrade_error %}
<p style="color: red;">It appears a recent upgrade may not have fully completed.</p>
<button id="upgrade" class="ui-button ui-widget ui-corner-all settings_button">Retry Upgrade</button>
<button id="show_upgrade_status" class="ui-button ui-widget ui-corner-all settings_button">Show Upgrade Logs</button>
<div id="upgrade_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{upgrade_logs}}</pre></div>
{% endif %}
<div class="divider"></div>
{% endif %}
<div class="settings_block_subheader">Uploader Device</div>
This disables most features and prioritize sharing QuickSync files. It can be reversed later.
<br/>