From 02f625369b5fc06997e2b19ba6a169f1b15b4f6b Mon Sep 17 00:00:00 2001 From: gerblesh <101901964+gerblesh@users.noreply.github.com> Date: Wed, 20 Sep 2023 12:18:38 -0700 Subject: [PATCH 1/4] fix: bypass distrobox upgrade sudo checks --- src/ublue_update/cli.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ublue_update/cli.py b/src/ublue_update/cli.py index b11dcd5..a5fd732 100644 --- a/src/ublue_update/cli.py +++ b/src/ublue_update/cli.py @@ -108,8 +108,11 @@ def run_update_scripts(root_dir: str): ) if out.returncode != 0: log.error( - f"{full_path} returned error code: {out.returncode}", - out.stdout.decode("utf-8"), + f"""{full_path} returned error code: {out.returncode} + + Program output: + {out.stdout.decode("utf-8")} + """, ) notify( "System Updater", @@ -124,6 +127,7 @@ def run_updates(args): filelock_path = "/run/ublue-update.lock" if process_uid != 0: xdg_runtime_dir = os.environ.get("XDG_RUNTIME_DIR") + print("") if os.path.isdir(xdg_runtime_dir): filelock_path = f"{xdg_runtime_dir}/ublue-update.lock" fd = acquire_lock(filelock_path) From c1ae64391a54141cecb8465a33895d0d975e3141 Mon Sep 17 00:00:00 2001 From: gerblesh <101901964+gerblesh@users.noreply.github.com> Date: Wed, 20 Sep 2023 12:21:15 -0700 Subject: [PATCH 2/4] chore: remove extra println --- files/etc/ublue-update.d/user/02-distrobox-user-update.sh | 3 +++ src/ublue_update/cli.py | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/files/etc/ublue-update.d/user/02-distrobox-user-update.sh b/files/etc/ublue-update.d/user/02-distrobox-user-update.sh index 81b7aed..d5237b8 100755 --- a/files/etc/ublue-update.d/user/02-distrobox-user-update.sh +++ b/files/etc/ublue-update.d/user/02-distrobox-user-update.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash + + if [ -x /usr/bin/distrobox ]; then + SUDO_USER="" # avoid distrobox sudo checks /usr/bin/distrobox upgrade -a fi diff --git a/src/ublue_update/cli.py b/src/ublue_update/cli.py index a5fd732..e6062f1 100644 --- a/src/ublue_update/cli.py +++ b/src/ublue_update/cli.py @@ -127,7 +127,6 @@ def run_updates(args): filelock_path = "/run/ublue-update.lock" if process_uid != 0: xdg_runtime_dir = os.environ.get("XDG_RUNTIME_DIR") - print("") if os.path.isdir(xdg_runtime_dir): filelock_path = f"{xdg_runtime_dir}/ublue-update.lock" fd = acquire_lock(filelock_path) From 70411d72bee0881d487392f38306a455ed5f81fe Mon Sep 17 00:00:00 2001 From: gerblesh <101901964+gerblesh@users.noreply.github.com> Date: Wed, 20 Sep 2023 12:22:30 -0700 Subject: [PATCH 3/4] style: remove extra newlines --- files/etc/ublue-update.d/user/02-distrobox-user-update.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/files/etc/ublue-update.d/user/02-distrobox-user-update.sh b/files/etc/ublue-update.d/user/02-distrobox-user-update.sh index d5237b8..dfa765a 100755 --- a/files/etc/ublue-update.d/user/02-distrobox-user-update.sh +++ b/files/etc/ublue-update.d/user/02-distrobox-user-update.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash - - if [ -x /usr/bin/distrobox ]; then SUDO_USER="" # avoid distrobox sudo checks /usr/bin/distrobox upgrade -a From b90fccf327a57408b9a74aedefca6690a268e2b5 Mon Sep 17 00:00:00 2001 From: gerblesh <101901964+gerblesh@users.noreply.github.com> Date: Wed, 20 Sep 2023 12:27:19 -0700 Subject: [PATCH 4/4] style: use unset keyword --- files/etc/ublue-update.d/user/02-distrobox-user-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/etc/ublue-update.d/user/02-distrobox-user-update.sh b/files/etc/ublue-update.d/user/02-distrobox-user-update.sh index dfa765a..a45075b 100755 --- a/files/etc/ublue-update.d/user/02-distrobox-user-update.sh +++ b/files/etc/ublue-update.d/user/02-distrobox-user-update.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash if [ -x /usr/bin/distrobox ]; then - SUDO_USER="" # avoid distrobox sudo checks + unset SUDO_USER # avoid distrobox sudo checks /usr/bin/distrobox upgrade -a fi