Improve upgrade consistency; Don't fail if tor is down

This commit is contained in:
Taylor Helsper 2021-11-03 22:39:54 -05:00
parent 1b6e77a4d5
commit d36fc0f7ed
2 changed files with 14 additions and 7 deletions

View File

@ -28,13 +28,18 @@ mkdir -p /home/admin/upgrade_logs/
# Download Latest
if [ $BETA = 0 ]; then
torify wget $UPGRADE_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz
torify wget $UPGRADE_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256
torify wget $UPGRADE_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz || \
wget $UPGRADE_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz
torify wget $UPGRADE_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256 || \
wget $UPGRADE_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256
else
torify wget $UPGRADE_BETA_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz
torify wget $UPGRADE_BETA_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256
torify wget $UPGRADE_BETA_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz || \
wget $UPGRADE_BETA_DOWNLOAD_URL -O /opt/mynode_release_latest.tar.gz
torify wget $UPGRADE_BETA_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256 || \
wget $UPGRADE_BETA_DOWNLOAD_SIGNATURE_URL -O /opt/mynode_release_latest.sha256
fi
torify wget $UPGRADE_PUBKEY_URL -O /opt/mynode_release.pub
torify wget $UPGRADE_PUBKEY_URL -O /opt/mynode_release.pub || \
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
if [ $? -ne 0 ]; then

View File

@ -166,9 +166,10 @@ def upgrade_device():
# Upgrade
os.system("mkdir -p /home/admin/upgrade_logs")
os.system("cp -f /usr/bin/mynode_upgrade.sh /usr/bin/mynode_upgrade_running.sh")
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)
cmd = "/usr/bin/mynode_upgrade_running.sh 2>&1 | tee {} {}".format(file1, file2)
ret = subprocess.call(cmd, shell=True)
if ret != 0:
# Try one more time....
@ -187,9 +188,10 @@ def upgrade_device_beta():
# Upgrade
os.system("mkdir -p /home/admin/upgrade_logs")
os.system("cp -f /usr/bin/mynode_upgrade.sh /usr/bin/mynode_upgrade_running.sh")
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)
cmd = "/usr/bin/mynode_upgrade_running.sh beta 2>&1 | tee {} {}".format(file1, file2)
ret = subprocess.call(cmd, shell=True)
if ret != 0:
# Try one more time....