Check for pkexec >= 0.102 which supports execution of X11 apps (#776437)
On CentOS 6 with polkit version 0.96 pkexec fails to execute gparted shell wrapper as root like this: $ env | grep DISPLAY DISPLAY=:0.0 $ sh -x /usr/local/bin/gparted ... + pkexec /usr/local/bin/gparted (gpartedbin:8011): Gtk-WARNING **: cannot open display: This is because polkit didn't support setting the DISPLAY environment variable to allow execution of X11 applications until the introduction of the allow_gui annotation by this commit in polkit 0.102: https://cgit.freedesktop.org/polkit/commit/?id=7850d27017fed1834268a852350ae85381fbb110 Bug 38769 - pkexec: Support running X11 apps Make configure only use pkexec version 0.102 or higher as the privilege escalation program. Otherwise configure falls back to checking for the other privilege escalation programs as it did before. Bug 776437 - GParted fails to run as root under Wayland
This commit is contained in:
parent
2f559ec3b5
commit
11c251293e
11
README
11
README
|
@ -165,13 +165,16 @@ c. Installing polkit's Action File
|
|||
graphical privilege escalation program examine the output from
|
||||
./configure. These lines report that pkexec is being used:
|
||||
|
||||
checking for pkexec... pkexec
|
||||
checking for pkexec >= 0.102... 0.112 found
|
||||
checking how to run pkexec... pkexec --disable-internal-agent
|
||||
|
||||
Where as this line of ./configure output reports that pkexec is not
|
||||
being used:
|
||||
Where as either of these lines of ./configure output report that
|
||||
pkexec is not being used because either it was too old a version or
|
||||
it was not found:
|
||||
|
||||
checking for pkexec... no
|
||||
checking for pkexec >= 0.102... 0.96 found
|
||||
|
||||
checking for pkexec >= 0.102... not found
|
||||
|
||||
When GParted is configured with prefix /usr (using command
|
||||
./configure --prefix=/usr) then make install will automatically
|
||||
|
|
33
configure.ac
33
configure.ac
|
@ -23,16 +23,33 @@ PKG_CHECK_EXISTS
|
|||
dnl======================
|
||||
dnl Find graphical privilege escalation program
|
||||
dnl======================
|
||||
AC_CHECK_PROGS([GKSUPROG], [pkexec gksudo gksu kdesudo "xdg-su -c"], [])
|
||||
|
||||
dnl Check for pkexec >= 0.102 for it's ability to run X11 apps and
|
||||
dnl whether the --disable-internal-agent option is available.
|
||||
AM_CONDITIONAL([INSTALL_POLKIT_ACTIONS], false)
|
||||
if test "x$GKSUPROG" = 'xpkexec'; then
|
||||
AC_MSG_CHECKING([how to run pkexec])
|
||||
if pkexec --help 2>&1 | grep -q -- --disable-internal-agent; then
|
||||
GKSUPROG="$GKSUPROG --disable-internal-agent"
|
||||
PKEXEC_REQUIRED_VERSION='0.102'
|
||||
AC_MSG_CHECKING([for pkexec >= $PKEXEC_REQUIRED_VERSION])
|
||||
PKEXEC_REQUIRED_INT=`echo "$PKEXEC_REQUIRED_VERSION" | $AWK -F. '{print $1 * 10000 + $2}'`
|
||||
PKEXEC_VERSION_OUTPUT=`pkexec --version 2> /dev/null` ||
|
||||
AC_MSG_RESULT([not found])
|
||||
if test "x$PKEXEC_VERSION_OUTPUT" != 'x'; then
|
||||
PKEXEC_FOUND_VERSION=`echo "$PKEXEC_VERSION_OUTPUT" | head -1 | cut -d' ' -f3`
|
||||
PKEXEC_FOUND_INT=`echo "$PKEXEC_FOUND_VERSION" | $AWK -F. '{print $1 * 10000 + $2}'`
|
||||
AC_MSG_RESULT([$PKEXEC_FOUND_VERSION found])
|
||||
if test "$PKEXEC_FOUND_INT" -ge "$PKEXEC_REQUIRED_INT"; then
|
||||
GKSUPROG='pkexec'
|
||||
AC_MSG_CHECKING([how to run pkexec])
|
||||
if pkexec --help 2>&1 | grep -q -- --disable-internal-agent; then
|
||||
GKSUPROG="$GKSUPROG --disable-internal-agent"
|
||||
fi
|
||||
AC_MSG_RESULT([$GKSUPROG])
|
||||
AC_SUBST([GKSUPROG])
|
||||
AM_CONDITIONAL([INSTALL_POLKIT_ACTIONS], true)
|
||||
fi
|
||||
AC_MSG_RESULT([$GKSUPROG])
|
||||
AM_CONDITIONAL([INSTALL_POLKIT_ACTIONS], true)
|
||||
fi
|
||||
|
||||
dnl Check for alternative graphical privilege escalation programs.
|
||||
if test "x$GKSUPROG" = 'x'; then
|
||||
AC_CHECK_PROGS([GKSUPROG], [gksudo gksu kdesudo "xdg-su -c"], [])
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue