Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore chmod if decky is not run as root #510

Merged
merged 6 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/localplatformlinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def chown(path : str, user : UserType = UserType.HOST_USER, recursive : bool =
return result == 0

def chmod(path : str, permissions : int, recursive : bool = True) -> bool:
if _get_effective_user_id() != 0:
return True
result = call(["chmod", "-R", str(permissions), path] if recursive else ["chmod", str(permissions), path])
return result == 0

Expand Down Expand Up @@ -191,4 +193,4 @@ def get_unprivileged_user() -> str:
logger.warn("Unprivileged user is not properly configured. Defaulting to 'deck'")
user = 'deck'

return user
return user
5 changes: 4 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# local modules
from browser import PluginBrowser
from helpers import (REMOTE_DEBUGGER_UNIT, csrf_middleware, get_csrf_token,
mkdir_as_user, get_system_pythonpaths)
mkdir_as_user, get_system_pythonpaths, get_effective_user_id)

from injector import get_gamepadui_tab, Tab, get_tabs, close_old_tabs
from loader import Loader
Expand Down Expand Up @@ -178,6 +178,9 @@ def run(self):

# Required for multiprocessing support in frozen files
multiprocessing.freeze_support()
else:
if get_effective_user_id() != 0:
logger.warning(f"decky is running as an unprivileged user, this is not officially supported and may cause issues")

# Append the loader's plugin path to the recognized python paths
sys.path.append(path.join(path.dirname(__file__), "plugin"))
Expand Down