diff options
| author | Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> | 2023-07-29 09:05:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-29 09:05:39 +0100 |
| commit | 2ba9bce3dea82261f01ee73ae68ce49553da3b9a (patch) | |
| tree | 0e601b7c0a52a8d45a1ecd0d2fa49ced7520e372 | |
| parent | d4a76da78c63bfddebf93cebd8dafc7677d193f3 (diff) | |
| download | decky-loader-2ba9bce3dea82261f01ee73ae68ce49553da3b9a.tar.gz decky-loader-2ba9bce3dea82261f01ee73ae68ce49553da3b9a.zip | |
Make the updater work properly on SELinux (#518)v2.10.4-pre6
* Add DECKY_SELINUX env var
* if on selinux make binary executable with chcon
* No need to recursively change one file
| -rw-r--r-- | backend/localplatform.py | 5 | ||||
| -rw-r--r-- | backend/updater.py | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/backend/localplatform.py b/backend/localplatform.py index 5febfcaf..9b05510b 100644 --- a/backend/localplatform.py +++ b/backend/localplatform.py @@ -40,4 +40,7 @@ def get_keep_systemd_service() -> bool: def get_log_level() -> int: return {"CRITICAL": 50, "ERROR": 40, "WARNING": 30, "INFO": 20, "DEBUG": 10}[ os.getenv("LOG_LEVEL", "INFO") - ]
\ No newline at end of file + ] + +def get_selinux() -> bool: + return os.getenv("DECKY_SELINUX", "0") == "1" diff --git a/backend/updater.py b/backend/updater.py index 61124a72..170cfa40 100644 --- a/backend/updater.py +++ b/backend/updater.py @@ -6,7 +6,7 @@ from ensurepip import version from json.decoder import JSONDecodeError from logging import getLogger from os import getcwd, path, remove -from localplatform import chmod, service_restart, ON_LINUX, get_keep_systemd_service +from localplatform import chmod, service_restart, ON_LINUX, get_keep_systemd_service, get_selinux from aiohttp import ClientSession, web @@ -208,6 +208,9 @@ class Updater: remove(path.join(getcwd(), download_filename)) shutil.move(path.join(getcwd(), download_temp_filename), path.join(getcwd(), download_filename)) chmod(path.join(getcwd(), download_filename), 777, False) + if get_selinux(): + from subprocess import call + call(["chcon", "-t", "bin_t", path.join(getcwd(), download_filename)]) logger.info("Updated loader installation.") await tab.evaluate_js("window.DeckyUpdater.finish()", False, False) |
