From f0b4bf542c3bb9a0a4ea81c4f432e82dccb6ff1c Mon Sep 17 00:00:00 2001 From: gerblesh <101901964+gerblesh@users.noreply.github.com> Date: Mon, 11 Sep 2023 23:31:14 -0700 Subject: [PATCH] fix: use user_uid instead of process_uid, fixes user updates --- src/ublue_update/cli.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ublue_update/cli.py b/src/ublue_update/cli.py index 099e64f..bf0f62c 100644 --- a/src/ublue_update/cli.py +++ b/src/ublue_update/cli.py @@ -133,19 +133,21 @@ def run_updates(args): run_update_scripts(root_dir + "/system/") for user_uid in user_uids: - xdg_runtime_dir = get_xdg_runtime_dir(process_uid) + xdg_runtime_dir = get_xdg_runtime_dir(user_uid) + user = pwd.getpwuid(user_uid) log.info( f""" Running update for user: - '{pwd.getpwuid(process_uid).pw_name}', + 'user.pw_name}', update script directory: '{root_dir}/user' """ ) + subprocess.run( [ "sudo", "-u", - f"{pwd.getpwuid(process_uid).pw_name}", + f"{user.pw_name}", "DISPLAY=:0", f"XDG_RUNTIME_DIR={xdg_runtime_dir}", f"DBUS_SESSION_BUS_ADDRESS=unix:path={xdg_runtime_dir}/bus",