Fallback to sudo where pollkit is unavailable

This commit is contained in:
the-sane 2021-01-24 14:43:42 -05:00 committed by GitHub
parent 478ff37b8a
commit 7b7460fa0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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