diff --git a/docs/umu.1.scd b/docs/umu.1.scd index 0449b30f..9003f573 100644 --- a/docs/umu.1.scd +++ b/docs/umu.1.scd @@ -166,7 +166,8 @@ _UMU_ZENITY_ _UMU_RUNTIME_UPDATE_ Optional. Disables automatic updates to the *Steam Linux Runtime*[6]. - Set _0_ to disable updates. + Set _0_ to disable updates. Set _1_ to force updates and restore + _$HOME/.local/share/umu_ to clean state. # SEE ALSO diff --git a/umu/umu_runtime.py b/umu/umu_runtime.py index a2578470..29f98834 100644 --- a/umu/umu_runtime.py +++ b/umu/umu_runtime.py @@ -23,7 +23,7 @@ from umu.umu_consts import CONFIG, UMU_CACHE, UMU_LOCAL from umu.umu_log import log -from umu.umu_util import find_obsolete, https_connection, run_zenity +from umu.umu_util import https_connection, run_zenity try: from tarfile import tar_filter @@ -210,7 +210,28 @@ def setup_umu( log.debug("Runtime Platform updates disabled") return - find_obsolete() + # Force a runtime update + if os.environ.get("UMU_RUNTIME_UPDATE") == "1": + lock: FileLock = FileLock(f"{local}/umu.lock") + log.debug("Forcing update to Runtime Platform") + log.debug("Acquiring file lock '%s'...", lock.lock_file) + with lock: + log.debug("Acquired file lock '%s'", lock.lock_file) + for path in local.glob("*"): + if path.is_dir(): + log.debug("Removing: %s", path) + rmtree(str(path)) + if path.is_file() and not path.name.endswith(".lock"): + log.debug("Removing: %s", path) + path.unlink() + with https_connection(host) as client_session: + _restore_umu( + json, + thread_pool, + lambda: local.joinpath("umu").is_file(), + client_session, + ) + return with https_connection(host) as client_session: _update_umu(local, json, thread_pool, client_session) diff --git a/umu/umu_util.py b/umu/umu_util.py index f3bc1c57..26073ca8 100644 --- a/umu/umu_util.py +++ b/umu/umu_util.py @@ -12,7 +12,6 @@ from Xlib import display -from umu.umu_consts import STEAM_COMPAT, UMU_LOCAL from umu.umu_log import log ssl_context: SSLContext | None = None @@ -173,38 +172,6 @@ def is_winetricks_verb( return True -def find_obsolete() -> None: - """Find obsoleted launcher files and log them.""" - home: Path = Path.home() - obsoleted: set[str] = { - "reaper", - "sniper_platform_0.20240125.75305", - "BUILD_ID.txt", - "umu_version.json", - "sniper_platform_0.20231211.70175", - } - - # Obsoleted files in $HOME/.local/share/umu from RC4 and below - for file in UMU_LOCAL.glob("*"): - is_umu_file: bool = file.name.endswith(".py") and ( - file.name.startswith(("umu", "ulwgl")) - ) - if is_umu_file or file.name in obsoleted: - log.warning("'%s' is obsolete", file) - - # $HOME/.local/share/Steam/compatibilitytool.d - if (launcher := STEAM_COMPAT.joinpath("ULWGL-Launcher")).is_dir(): - log.warning("'%s' is obsolete", launcher) - - # $HOME/.cache - if (cache := home.joinpath(".cache", "ULWGL")).is_dir(): - log.warning("'%s' is obsolete", cache) - - # $HOME/.local/share - if (ulwgl := home.joinpath(".local", "share", "ULWGL")).is_dir(): - log.warning("'%s' is obsolete", ulwgl) - - @contextmanager def https_connection(host: str): # noqa: ANN201 """Create an HTTPSConnection."""