Fix issue where uninstalled apps may not be marked as not installed

This commit is contained in:
Taylor Helsper 2022-11-01 13:04:37 -05:00
parent 8315c5b9fb
commit 813986d0a6

View File

@ -62,6 +62,9 @@ def uninstall_app(app):
os.system("sync")
def remove_app(app):
# Remove install markers
clear_app_installed(app)
# Make sure app is disabled
disable_service(app)
@ -95,6 +98,12 @@ def mark_app_installed(short_name):
# App maybe dyanmic app (no version latest file) so mark sd card
touch(install_marker_1)
def clear_app_installed(short_name):
install_marker_1 = "/home/bitcoin/.mynode/install_"+short_name
install_marker_2 = "/mnt/hdd/mynode/settings/install_"+short_name
delete_file(install_marker_1)
delete_file(install_marker_2)
def get_app_current_version_from_file(short_name):
version = "unknown"
filename1 = "/home/bitcoin/.mynode/"+short_name+"_version"
@ -908,7 +917,7 @@ def uninstall_dynamic_app(short_name):
exit(1)
# Run app-specific uninstall script
uninstall_script = "/bin/bash /usr/bin/service_scripts/install_{}.sh".format(short_name)
uninstall_script = "/usr/bin/service_scripts/uninstall_{}.sh".format(short_name)
if os.path.isfile(uninstall_script):
try:
my_env = os.environ.copy()
@ -922,6 +931,9 @@ def uninstall_dynamic_app(short_name):
except Exception as e:
print(" Exception: {}".format(str(e)))
# Delete install marker files
clear_app_installed(short_name)
# Disable service
disable_service(short_name)