From 7b7460fa0d38f8e6ca8e3fb572fe876f462d075b Mon Sep 17 00:00:00 2001 From: the-sane <3657071+the-sane@users.noreply.github.com> Date: Sun, 24 Jan 2021 14:43:42 -0500 Subject: [PATCH] Fallback to sudo where pollkit is unavailable --- lug-helper.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lug-helper.sh b/lug-helper.sh index efc9478..27936c9 100755 --- a/lug-helper.sh +++ b/lug-helper.sh @@ -1080,7 +1080,12 @@ preflight_check() { # Execute the actions set by the functions if [ ! -z "$preflight_actions_string" ]; then - pkexec sh -c "$preflight_actions_string" + # Use pollkit's pkexec for gui with a fallback to sudo + if [ -x "$(command -v pkexec)" ]; then + pkexec sh -c "$preflight_actions_string" + else + sudo sh -c "$preflight_actions_string" + fi fi # Call any followup functions