Thread View: linux.gentoo.dev
3 messages
3 total messages
Started by Andreas Sturmlechner
Sun, 29 Nov 2026 19:30
[gentoo-dev] [RFC] [PATCH 1/3] pkagent-autostart.eclass: New eclass to make session-specific pkagent file
Author: Andreas Sturmlechner
Date: Sun, 29 Nov 2026 19:30
Date: Sun, 29 Nov 2026 19:30
199 lines
7683 bytes
7683 bytes
--nextPartJ5apLaa0TMewsvvOTM_Tyw
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"; protected-headers="v1"
From: Andreas Sturmlechner <asturm@gentoo.org>
To: gentoo-dev@lists.gentoo.org, freedesktop-bugs@gentoo.org
Date: Sun, 29 Nov 2026 20:23:34 +0100
Message-ID: <aTsa8Q3IT4ahLmug2F5phQ@gentoo.org>
MIME-Version: 1.0
See also: https://github.com/gentoo/gentoo/pull/47042
(pre-review discussion +contains example usage by way of xfce4-polkit)
Ensures, via OnlyShowIn=<env>, that any generated autostart file is
only, but surely, going to be started in its designated environment.
This is important because we want to avoid having more than one polkit
agent autostarting, and racing, in the same environment. It is then
the desktop environments' responsibility to pull in their designated
polkit-agent which works out of the box by matching the `DesktopNames`
entry in the env session file. Which most of them already do for a
very long time, except Xfce.
Any WM without its own polkit-agent binary may set up an autostart
file this way too, provided it has XDG autostart capability.
Catch PN=polkit-gnome to keep existing filename in an attempt to
preserve existing user modifications.
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
eclass/pkagent-autostart.eclass | 132 ++++++++++++++++++++++++++++++++
1 file changed, 132 insertions(+)
create mode 100644 eclass/pkagent-autostart.eclass
diff --git a/eclass/pkagent-autostart.eclass b/eclass/pkagent-autostart.eclass
new file mode 100644
index 000000000000..2bcacda8b2b7
--- /dev/null
+++ b/eclass/pkagent-autostart.eclass
@@ -0,0 +1,132 @@
+# Copyright 2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: pkagent-autostart.eclass
+# @MAINTAINER:
+# freedesktop-bugs@gentoo.org
+# @SUPPORTED_EAPIS: 8 9
+# @BLURB: Installs aptly configured autostart desktop file for the chosen
+# environment. May be used by environments that do not come with their own
+# polkit-agent, thus reuse one of the known implementations.
+
+case ${EAPI} in
+ 8|9) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_PKAGENT_AUTOSTART_ECLASS} ]]; then
+_PKAGENT_AUTOSTART_ECLASS=1
+
+# @FUNCTION: make_pkagent_autostart_entry
+# @USAGE: <env> <pkagent>
+# @DESCRIPTION:
+# Make a session specific .desktop file and install it in /etc/xdg/autostart.
+# See also:
+# - https://specifications.freedesktop.org/menu/latest/onlyshowin-registry.html
+# - https://specifications.freedesktop.org/desktop-entry/latest-single/#key-onlyshowin
+#
+# @CODE
+# env: If set, should either correspond with registered values for Desktop
+# Environments, or be made sure to match an existing session file's
+# DesktopNames entry. Value of env is passed as OnlyShowIn=<value>.
+# Non-registered environments shall be prefixed by the string "X-" to
+# pass desktop-file-utils validation, but will work either way.
+# If empty, will set Hidden=true instead of OnlyShowIn. Also affects
+# desktop filename: 'polkit-${env,,}-authentication-agent.desktop'
+# pkagent: Target (known) polkit-agent package to choose from for Exec
+# If unknown, value of pkagent is directly passed as Exec=<value>,
+# which must be either in PATH or be an absolute path to a binary.
+# @CODE
+#
+# Example usage:
+# @CODE
+# XFCE polkit-gnome
+# @CODE
+make_pkagent_autostart_entry() {
+ local execpath fname name onlyshowin
+ if [[ $# -ne 2 ]]; then
+ die "${FUNCNAME[0]} must be passed exactly two arguments"
+ fi
+
+ # Registered OnlyShowIn values
+ case ${1} in
+ COSMIC | \
+ GNOME | \
+ GNOME-Classic | \
+ GNOME-Flashback | \
+ KDE | \
+ LXDE | \
+ LXQt | \
+ MATE | \
+ Razor | \
+ ROX | \
+ TDE | \
+ Unity | \
+ XFCE | \
+ EDE | \
+ Cinnamon | \
+ Pantheon | \
+ Phosh | \
+ DDE | \
+ Endless | \
+ Old | \
+ X-*)
+ onlyshowin="OnlyShowIn=${1};"
+ name="${PN/#X-/}"
+ ;;
+ "")
+ onlyshowin="Hidden=true"
+ name="${PN/#polkit/}"
+ name="${name/--/-}"
+ ;;
+ *)
+ onlyshowin="OnlyShowIn=${1};"
+ name="${PN/#polkit/}"
+ elog "${1} is not a registered OnlyShowIn value in the Desktop Application"
+ elog "Autostart Specification. It will not do anything without a corresponding"
+ elog "DesktopNames entry from a session desktop file."
+ ;;
+ esac
+
+ # Known 'standard' polkit-agent packages
+ case ${2} in
+ lxqt-policykit)
+ execpath="/usr/bin/lxqt-policykit-agent" ;;
+ lxsession)
+ execpath="/usr/bin/lxpolkit" ;;
+ mate-polkit)
+ execpath="/usr/libexec/polkit-mate-authentication-agent-1" ;;
+ polkit-gnome)
+ execpath="/usr/libexec/polkit-gnome-authentication-agent-1" ;;
+ polkit-kde-agent)
+ execpath="/usr/libexec/polkit-kde-authentication-agent-1" ;;
+ *)
+ execpath="${2}" ;;
+ esac
+
+ # preserve existing filename for a de facto legacy standard in GTK world
+ if [[ ${PN} == polkit-gnome ]]; then
+ fname="polkit-gnome-authentication-agent-1.desktop"
+ else
+ fname="polkit-${name,,}-authentication-agent.desktop"
+ fi
+
+ cat > "${T}/${fname}" <<- _EOF_ || die
+ [Desktop Entry]
+ Name=PolicyKit Authentication Agent
+ Comment=PolicyKit Authentication Agent
+ Exec=${execpath}
+ Icon=dialog-password
+ Terminal=false
+ Type=Application
+ ${onlyshowin}
+ NoDisplay=true
+ _EOF_
+
+ (
+ insinto /etc/xdg/autostart
+ doins "${T}/${fname}"
+ )
+}
+
+fi
--
2.56.1
--nextPartJ5apLaa0TMewsvvOTM_Tyw
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit
-----BEGIN PGP SIGNATURE-----
iQIvBAABCgCZFiEE34gXUSooizdYNDu3S5FW4z0PgBkFAmsMe7cbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRERjg4MTc1MTJBMjg4QjM3NTgzNDNC
Qjc0QjkxNTZFMzNEMEY4MDE5AAoJEEuRVuM9D4AZ554L/jHYXSac66YHr1ZFj8gy
N2T3UqdYXapR26KDSzOGE5qGyvAu63L0DM6/kFocyuagwDiLqcgvNQ/WxeH30TP5
J+R/eFKQig30PB5zesxuBM1xk+83VT0ongYdpG2hVniUTwlVby8+8BgfqeN8ornp
YhkhxP894x+iVCGAzOHLY7zDimflAVtjZNj+fPOk7rj6khDwQFJUzw+BRqo9Vpik
ciKBCI8Lw96nEOUCbqIGnocl2KA9M41cY0EA7LdZBkmRWXMUHP5K+I59wd3Y0nCE
oBb2c4AzkbiMeI4vnLfF7i24hm0iIXzLFIIxpVvd2HcvZNGwoHucWEXw8b74V8ty
LH4XmOTOs79Y/LpygFcVd+Tjd4imnq5lf0otLuezP5TKr4jQGUXLZWTDM8cuv7i9
reWCoYnEas5++Gf6vsVRnVkshkT3GEnp0FlKQtyyXLo7l8SkhXNY4qunOD6bHFhX
fc9R/2E6ALcuroRLnpnIky3wuLUsWAr1pSAP8kKgV4m8ww==
=ougl
-----END PGP SIGNATURE-----
--nextPartJ5apLaa0TMewsvvOTM_Tyw--
[gentoo-dev] [RFC] [PATCH 2/3] [effectively] gnome-extra/polkit-gnome: Use pkagent-autostart.eclass, disable autostart
Author: Andreas Sturmlechner
Date: Sun, 29 Nov 2026 19:30
Date: Sun, 29 Nov 2026 19:30
96 lines
4717 bytes
4717 bytes
--nextPartSHP9nuZSSzuVapthzhdl2Q
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"; protected-headers="v1"
From: Andreas Sturmlechner <asturm@gentoo.org>
To: gentoo-dev@lists.gentoo.org, freedesktop-bugs@gentoo.org
Date: Sun, 29 Nov 2026 20:26:56 +0100
Message-ID: <NUnsg5UzSjeIJkkIM2-ALA@gentoo.org>
In-Reply-To: <aTsa8Q3IT4ahLmug2F5phQ@gentoo.org>
References: <aTsa8Q3IT4ahLmug2F5phQ@gentoo.org>
MIME-Version: 1.0
This package was made obsolete by its original inventors as well as any
offshoots. While the binary polkit-agent may be used by legacy envs,
referencing it via their own autostart desktop files, the shipped one
must ensure it does not get in the way of others.
But keep the desktop file for users w/ existing, modified versions of it.
Add manual setup notice elog.
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
* [effectively]: Relevant changes are shown here as diff, but will be introduced
as clean ~arch revbump, with stabilisation coordinated w/ xfce4-polkit.
--- a/gnome-extra/polkit-gnome/polkit-gnome-0.105-r2.ebuild
+++ b/gnome-extra/polkit-gnome/polkit-gnome-0.105-r3.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
+EAPI=8
-inherit gnome.org
+inherit gnome.org pkagent-autostart
DESCRIPTION="A dbus session bus service that is used to bring up authentication dialogs"
HOMEPAGE="https://gitlab.freedesktop.org/polkit/polkit/"
@@ -25,20 +25,12 @@ DOCS=( AUTHORS HACKING NEWS README TODO )
src_install() {
default
+ make_pkagent_autostart_entry "" ${PN}
+}
- cat <<-EOF > "${T}"/polkit-gnome-authentication-agent-1.desktop
- [Desktop Entry]
- Name=PolicyKit Authentication Agent
- Comment=PolicyKit Authentication Agent
- Exec=/usr/libexec/polkit-gnome-authentication-agent-1
- Terminal=false
- Type=Application
- Categories=
- NoDisplay=true
- NotShowIn=MATE;KDE;
- AutostartCondition=GNOME3 if-session gnome-fallback
- EOF
-
- insinto /etc/xdg/autostart
- doins "${T}"/polkit-gnome-authentication-agent-1.desktop
+pkg_postinst() {
+ elog "${PN} no longer autostarts in random sessions and now requires manual setup."
+ elog "Pick your environment (must match DesktopNames value from XDG session file),"
+ elog "and set it via \"OnlyShowIn=<environment>;\" in place of \"Hidden=true\""
+ elog "inside /etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop"
}
--
2.56.1
--nextPartSHP9nuZSSzuVapthzhdl2Q
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit
-----BEGIN PGP SIGNATURE-----
iQIvBAABCgCZFiEE34gXUSooizdYNDu3S5FW4z0PgBkFAmsMfIAbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRERjg4MTc1MTJBMjg4QjM3NTgzNDNC
Qjc0QjkxNTZFMzNEMEY4MDE5AAoJEEuRVuM9D4AZP60L/2SF0dHxCrgzqamfZlxG
ajpW5/TY8FMabJEBtCf5yyHAkGs7134nFc/27qlR+JbcVPMYYSynPdL0uDvJkPFB
5LWLLKHR/MIG61G6aeTc5xaiVMe3RFMlgCesjb5j6bm+pQogPAYwG3ffa6uq61qx
50gGmvSZLjCRB/hxiopX634XFAzVG4Fc44hq8ojT2jYvC/OYgsl6jxS3hDX4aLFq
CTxnr0GVlM7E8C7qptx44swc+QWIpLrTwOsajvOgYBIKTiSt6MT2yKnnzS0w+09C
RcG8v24rA1uxNhuH15w+xvlxvpRSZDtI3Q1V3NDs4z2yje5vGbbkBHTMk8BLyLTE
comGaD7jZILeq2xJMlmn0tLseNK586vC8avtwvNvD/ngAiNTAz/PQNEt78XobW1m
Vj3IJCOktKls/jQwakGAmOQ5kK3LXRjPybMx0p5BrwFRxa13NjllWQNia2AW2BlJ
dLot/RtSPVeVGlbV5oKJwpXSE6Hn+f9hEeO3BMdczXmtvg==
=wdqo
-----END PGP SIGNATURE-----
--nextPartSHP9nuZSSzuVapthzhdl2Q--
[gentoo-dev] [RFC] [PATCH 3/3] [effectively] sys-auth/polkit: Drop PDEPEND and IUSE gtk,kde
Author: Andreas Sturmlechner
Date: Sun, 29 Nov 2026 19:30
Date: Sun, 29 Nov 2026 19:30
123 lines
6014 bytes
6014 bytes
--nextPartSdq24dPHRd-4Un9GTOd30w
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"; protected-headers="v1"
From: Andreas Sturmlechner <asturm@gentoo.org>
To: gentoo-dev@lists.gentoo.org, freedesktop-bugs@gentoo.org
Date: Sun, 29 Nov 2026 20:28:49 +0100
Message-ID: <qvano4IbRjG4eUqHUmAECw@gentoo.org>
In-Reply-To: <aTsa8Q3IT4ahLmug2F5phQ@gentoo.org>
References: <aTsa8Q3IT4ahLmug2F5phQ@gentoo.org>
MIME-Version: 1.0
- kde-plasma/plasma-meta ensures kde-plasma/polkit-kde-agent is present,
but OnlyShowIn=KDE; ensures it does nothing in other environments
- gnome-base/gnome-shell has its own pk-agent built-in
- lxde-base/lxsession, through restricting to OnlyShowIn=LXDE; upstream,
was already made useless for the purpose claimed by the ebuild
- Xfce was gifted an IUSE configurable xfce-base/xfce4-polkit to emulate
what sys-auth/polkit[gtk,kde] had been serving it up to now, except
with more options and functional by default
- In ::gentoo, LXQt, Enlightenment, Mate, Cinnamon, even GNOME Flashback,
already provide their own agents
- Outside of ::gentoo, Budgie, COSMIC, Noctalia, Deepin, Trinity DE,
Pantheon, Hyprland, Lomiri, Phosh, also provide their own agents
gnome-extra/polkit-gnome was the only package left with a gratuitous
NotShowIn=MATE;KDE; potentially racing w/ other pk-agents, which a
previous ~arch revbump changed to be hidden from autostart by default.
Add optfeature to aid transition for minimalist users who read elog output.
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
* [effectively]: Relevant changes are shown here as diff, but will be introduced
as clean ~arch revbump, with coordinated stabilisation.
--- a/sys-auth/polkit/polkit-128.ebuild
+++ b/sys-auth/polkit/polkit-128-r1.ebuild
@@ -4,7 +4,7 @@
EAPI=8
PYTHON_COMPAT=( python3_{12..14} )
-inherit meson pam python-any-r1 systemd tmpfiles xdg-utils
+inherit meson optfeature pam python-any-r1 systemd tmpfiles xdg-utils
DESCRIPTION="Policy framework for controlling privileges for system-wide services"
HOMEPAGE="https://github.com/polkit-org/polkit"
@@ -28,7 +28,7 @@ SLOT="0"
if [[ ${PV} != 9999 ]] ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
fi
-IUSE="elogind examples gtk +introspection kde pam nls selinux systemd test"
+IUSE="elogind examples +introspection pam nls selinux systemd test"
RESTRICT="!test? ( test )"
REQUIRED_USE="?? ( elogind systemd )"
@@ -68,13 +68,6 @@ RDEPEND="
acct-user/polkitd
selinux? ( sec-policy/selinux-policykit )
"
-PDEPEND="
- gtk? ( || (
- >=gnome-extra/polkit-gnome-0.105
- >=lxde-base/lxsession-0.5.2
- ) )
- kde? ( kde-plasma/polkit-kde-agent )
-"
DOCS=(
AUTHORS
@@ -108,6 +101,25 @@ python_check_deps() {
pkg_setup() {
use test && python-any-r1_pkg_setup
+
+ if has_version "sys-auth/polkit[gtk]" || has_version "sys-auth/polkit[kde]"; then
+ optfeature_header "${CATEGORY}/${PN} no longer pulls in some polkit-agent. Candidate(s):"
+ if has_version "gui-apps/liquidshell"; then
+ optfeature "KDE Plasma polkit-agent" "kde-plasma/polkit-kde-agent"
+ fi
+ if has_version "lxqt-base/lxqt-session"; then
+ optfeature "LXQt polkit-agent" "lxqt-base/lxqt-policykit"
+ fi
+ if has_version "mate-base/mate-desktop"; then
+ optfeature "MATE polkit-agent" "mate-extra/mate-polkit"
+ fi
+ if has_version "xfce-base/xfwm4"; then
+ optfeature "polkit-agent selection for Xfce4" "xfce-base/xfce4-polkit"
+ fi
+ if has_version "x11-wm/openbox" || has_version "x11-wm/icewm" || has_version "x11-wm/fluxbox"; then
+ optfeature "a polkit-agent via XDG autostart (manual setup required)" "gnome-extra/polkit-gnome"
+ fi
+ fi
}
src_prepare() {
--
2.56.1
--nextPartSdq24dPHRd-4Un9GTOd30w
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit
-----BEGIN PGP SIGNATURE-----
iQIvBAABCgCZFiEE34gXUSooizdYNDu3S5FW4z0PgBkFAmsMfPEbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRERjg4MTc1MTJBMjg4QjM3NTgzNDNC
Qjc0QjkxNTZFMzNEMEY4MDE5AAoJEEuRVuM9D4AZgasMAIXMfn4msx9b1Dql1RIV
dYvX6i18EqFuGG+04TmzvSQdva+767z8cHKYcSxgMRtZS7yKmUmyFsRjpZGKZ6z/
iId5NhAPNwmJs8R/Y6u86HBxbCgbfl/SHORrXlM2Ayh3aiGnB38V/ETPE97ojgX6
giAScQEqL2tdkNv1OM5l0L/SbOhyu0aXY+fb6r2NkKNXsVytzFZ1iC55eFzSGS7m
R424qauog4FlMZ4QTX3t9uP6/9CCnIf/59Tl2EEX+8ZAc91Ob55Xqi/Sb4XV/0q4
n44AzSeQWhAMioMmDHPY0JdNkyOIuNczd5CVO2bsXOKI+bVihjbIbpd907KW9d6m
cos1zO/TiZGO2QveE+O8tx5cPxXzG1OFXS6poh5zajIF7PDKjZ1z8gmNiy9EJSuE
ebyCFxsvD+srSG7Y5c6W5Eynxog6EMEO0lFNSZwKndITba6ZJU/0asSnAs5fjLJ/
/Xqwd5SQ0AezwNdfqgDisecrPoz8W+nTQrotqdqVCvKWZw==
=iuMg
-----END PGP SIGNATURE-----
--nextPartSdq24dPHRd-4Un9GTOd30w--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads