Mark app for install if using mynode-manage-apps install

This commit is contained in:
Taylor Helsper 2022-10-26 21:36:52 -05:00
parent c17c7eb639
commit d91a3a18fe
6 changed files with 27 additions and 66 deletions

View File

@ -55,6 +55,8 @@ def main():
app_names = args.app
if not isinstance(app_names, list):
app_names = [app_names]
# Since single app was named, mark as installed
mark_app_installed(app_name)
for app_name in app_names:
if args.command == "reinstall":
clear_installed_version(app_name)

View File

@ -23,8 +23,11 @@ rm -f /mnt/hdd/mynode/settings/${APP}_version || true
# Make sure app is marked for install
if [ -f /home/bitcoin/.mynode/${APP}_version_latest ]; then
touch /home/bitcoin/.mynode/install_${APP} || true
else
elif [ -f /mnt/hdd/mynode/settings/${APP}_version_latest ]; then
touch /mnt/hdd/mynode/settings/install_${APP} || true
else
# App is probably dynamic app (no version_latest file) so go ahead and mark sd card
touch /home/bitcoin/.mynode/install_${APP} || true
fi
# Custom re-install steps

View File

@ -698,49 +698,7 @@ fi
# fi
# fi
# done
STARTUP_MODIFIED=0
if [ -f $ELECTRS_ENABLED_FILE ]; then
if systemctl status electrs | grep "disabled;"; then
systemctl enable electrs
STARTUP_MODIFIED=1
fi
fi
if [ -f $LNDHUB_ENABLED_FILE ]; then
if systemctl status lndhub | grep "disabled;"; then
systemctl enable lndhub
STARTUP_MODIFIED=1
fi
fi
if [ -f $BTCRPCEXPLORER_ENABLED_FILE ]; then
if systemctl status btcrpcexplorer | grep "disabled;"; then
systemctl enable btcrpcexplorer
STARTUP_MODIFIED=1
fi
fi
if [ -f $MEMPOOL_ENABLED_FILE ]; then
if systemctl status mempool | grep "disabled;"; then
systemctl enable mempool
STARTUP_MODIFIED=1
fi
fi
if [ -f $BTCPAYSERVER_ENABLED_FILE ]; then
if systemctl status btcpayserver | grep "disabled;"; then
systemctl enable btcpayserver
STARTUP_MODIFIED=1
fi
fi
if [ -f $VPN_ENABLED_FILE ]; then
if systemctl status vpn | grep "disabled;"; then
systemctl enable vpn
systemctl enable openvpn || true
STARTUP_MODIFIED=1
fi
fi
if [ $STARTUP_MODIFIED -eq 1 ]; then
sync
reboot
exit 0
fi
# Generate certificates
echo "Generating certificates..."

View File

@ -33,13 +33,6 @@ if [ -f $IS_TESTNET_ENABLED_FILE ]; then
LND_ADMIN_MACAROON_FILE="/mnt/hdd/mynode/lnd/data/chain/bitcoin/testnet/admin.macaroon"
fi
ELECTRS_ENABLED_FILE="/mnt/hdd/mynode/.mynode_electrs_enabled"
LNDHUB_ENABLED_FILE="/mnt/hdd/mynode/.mynode_lndhub_enabled"
BTCRPCEXPLORER_ENABLED_FILE="/mnt/hdd/mynode/.mynode_btcrpceplorer_enabled"
VPN_ENABLED_FILE="/mnt/hdd/mynode/.mynode_vpn_enabled"
MEMPOOL_ENABLED_FILE="/mnt/hdd/mynode/.mynode_mempoolspace_enabled"
BTCPAYSERVER_ENABLED_FILE="/mnt/hdd/mynode/.mynode_btcpayserver_enabled"
BITCOIN_SYNCED_FILE="/mnt/hdd/mynode/.mynode_bitcoin_synced"
QUICKSYNC_COMPLETE_FILE="$QUICKSYNC_DIR/.quicksync_complete"

View File

@ -81,6 +81,20 @@ def is_installed(short_name):
return True
return False
def mark_app_installed(short_name):
install_marker_1 = "/home/bitcoin/.mynode/install_"+short_name
install_marker_2 = "/mnt/hdd/mynode/settings/install_"+short_name
latest_version_1 = "/home/bitcoin/.mynode/"+short_name+"_version_latest"
latest_version_2 = "/mnt/hdd/mynode/settings/"+short_name+"_version_latest"
# Check the latest version location
if os.path.isfile(latest_version_1):
touch(install_marker_1)
elif os.path.isfile(latest_version_2):
touch(install_marker_2)
else:
# App maybe dyanmic app (no version latest file) so mark sd card
touch(install_marker_1)
def get_app_current_version_from_file(short_name):
version = "unknown"
filename1 = "/home/bitcoin/.mynode/"+short_name+"_version"
@ -581,6 +595,10 @@ def create_application_user(app_data):
# Ensure user belongs to bitcoin group
add_user_to_group(username, "bitcoin")
# If docker app, add them to docker
#if app_data["requires_docker_image_installation"]:
# add_user_to_group(username, "docker")
def create_application_folders(app_data):
log_message(" Running create_application_folders...")
app_folder = app_data["install_folder"]
@ -658,7 +676,7 @@ def install_application_tarball(app_data):
run_linux_cmd("mv /tmp/mynode_dynamic_app_extract/* /tmp/mynode_dynamic_app_extract/app")
# Move tarball contents to app folder
run_linux_cmd("rsync -var --delete-after /tmp/mynode_dynamic_app_extract/app/* {}/".format(app_data["install_folder"]))
run_linux_cmd("rsync -var --delete-after /tmp/mynode_dynamic_app_extract/app/ {}/".format(app_data["install_folder"]))
# Move additional app data to app installation folder
app_data_source = get_dynamic_app_dir() + "/" + app_data["short_name"] + "/app_data"

View File

@ -1,12 +1,5 @@
CONFIG = {}
# Enabled Features
CONFIG["rtl_enabled"] = True
CONFIG["electrs_enabled"] = True
CONFIG["explorer_enabled"] = True
CONFIG["btcrpcexplorer_enabled"] = True
CONFIG["lndhub_enabled"] = True
# myNode variables
CHECKIN_URL = "https://www.mynodebtc.com/device_api/check_in.php"
@ -21,10 +14,4 @@ LND_DATA_FOLDER = "/mnt/hdd/mynode/lnd/data/"
DOJO_INSTALL_FILE = "/mnt/hdd/mynode/settings/mynode_dojo_install"
# Other Variables
ELECTRS_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_electrs_enabled"
LNDHUB_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_lndhub_enabled"
BTCRPCEXPLORER_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_btcrpceplorer_enabled"
VPN_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_vpn_enabled"
NETDATA_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_netdata_enabled"
MEMPOOL_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_mempoolspace_enabled"
BTCPAYSERVER_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_btcpayserver_enabled"
# ...