mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-23 21:18:07 +00:00
Remove special install/uninstall for Dojo
This commit is contained in:
parent
fd95edcef8
commit
601dbea4a8
|
@ -89,13 +89,13 @@ while true; do
|
|||
CURRENT=""
|
||||
INSTALL=true
|
||||
# If Upgrade file existed, mark "install" choice for legacy devices
|
||||
if [ -f /mnt/hdd/mynode/settings/dojo_url ]; then
|
||||
touch /mnt/hdd/mynode/settings/mynode_dojo_install
|
||||
if [ -f /mnt/hdd/mynode/settings/dojo_url ] || [ -f /mnt/hdd/mynode/settings/mynode_dojo_install ]; then
|
||||
touch /mnt/hdd/mynode/settings/install_dojo
|
||||
sync
|
||||
sleep 3s
|
||||
fi
|
||||
# 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 /mnt/hdd/mynode/settings/install_dojo ] && [ ! -f $IS_TESTNET_ENABLED_FILE ]; then
|
||||
if [ -f $DOJO_UPGRADE_URL_FILE ] && [ ! -f $DOJO_VERSION_FILE ]; then
|
||||
echo $DOJO_VERSION > $DOJO_VERSION_FILE
|
||||
sync
|
||||
|
|
|
@ -54,8 +54,14 @@ def uninstall_app(app):
|
|||
# Sync
|
||||
os.system("sync")
|
||||
|
||||
def is_installed(current_version):
|
||||
return current_version != "not installed"
|
||||
def is_installed(short_name):
|
||||
filename1 = "/home/bitcoin/.mynode/"+short_name+"_install"
|
||||
filename2 = "/mnt/hdd/mynode/settings/"+short_name+"_install"
|
||||
if os.path.isfile(filename1):
|
||||
return True
|
||||
elif os.path.isfile(filename2):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_app_current_version(short_name):
|
||||
version = "unknown"
|
||||
|
|
|
@ -131,7 +131,6 @@ def dojo_page():
|
|||
templateData = {
|
||||
"title": "myNode Dojo",
|
||||
"ui_settings": read_ui_settings(),
|
||||
"is_dojo_installed": is_dojo_installed(),
|
||||
"dojo_status": dojo_status,
|
||||
"dojo_version": get_dojo_version(),
|
||||
"dojo_enabled": is_service_enabled("dojo"),
|
||||
|
|
|
@ -23,10 +23,7 @@ def disable_service(short_name):
|
|||
|
||||
# Functions to handle special enable/disable cases
|
||||
def enable_actions(short_name):
|
||||
if short_name == "dojo":
|
||||
if not is_dojo_installed():
|
||||
install_dojo()
|
||||
raise RequestRedirect("/settings/reboot-device")
|
||||
pass
|
||||
|
||||
def disable_actions(short_name):
|
||||
if short_name == "electrs":
|
||||
|
@ -41,18 +38,3 @@ def disable_actions(short_name):
|
|||
def restart_service(short_name):
|
||||
os.system("systemctl restart {} --no-pager".format(short_name))
|
||||
|
||||
|
||||
# Dojo install / uninstall functions.... future work to abstract this
|
||||
def is_dojo_installed():
|
||||
return os.path.isfile(DOJO_INSTALL_FILE)
|
||||
|
||||
def install_dojo():
|
||||
os.system("touch " + DOJO_INSTALL_FILE)
|
||||
os.system("sync")
|
||||
|
||||
def uninstall_dojo():
|
||||
os.system("rm -f " + DOJO_INSTALL_FILE)
|
||||
os.system("rf -f /mnt/hdd/mynode/settings/dojo_url")
|
||||
disable_service("dojo")
|
||||
os.system("sync")
|
||||
|
||||
|
|
|
@ -614,48 +614,6 @@ def page_toggle_app():
|
|||
enable_service(app_short_name)
|
||||
return redirect("/")
|
||||
|
||||
@app.route("/toggle-dojo-install")
|
||||
def page_toggle_dojo_install():
|
||||
check_logged_in()
|
||||
|
||||
# In case of refresh, mark toggle was started
|
||||
check_and_mark_reboot_action("toggle_dojo_install")
|
||||
|
||||
if is_dojo_installed():
|
||||
# Mark app as not installed
|
||||
uninstall_dojo()
|
||||
|
||||
# Re-install app (this will uninstall and not re-install after reboot since install file is missing)
|
||||
t = Timer(1.0, reinstall_app, ["dojo"])
|
||||
t.start()
|
||||
|
||||
# Display wait page
|
||||
templateData = {
|
||||
"title": "myNode Uninstall",
|
||||
"header_text": "Uninstalling",
|
||||
"subheader_text": "This may take a while...",
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
else:
|
||||
# Mark Dojo for install
|
||||
install_dojo()
|
||||
|
||||
# Re-install app
|
||||
t = Timer(1.0, reboot_device)
|
||||
t.start()
|
||||
|
||||
# Display wait page
|
||||
templateData = {
|
||||
"title": "myNode Install",
|
||||
"header_text": "Installing",
|
||||
"subheader_text": "This may take a while...",
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
|
||||
return redirect("/")
|
||||
|
||||
@app.route("/clear-fsck-error")
|
||||
def page_clear_fsck_error():
|
||||
check_logged_in()
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
{% if dojo_enabled %}
|
||||
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="/restart-dojo">Restart</a>
|
||||
{% endif %}
|
||||
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="/toggle-dojo-install">Uninstall</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% if dojo_enabled and electrs_status == "Running" %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user