Polkit agent + libvirt group (fixes virt-manager connection failure) #4
+33
-12
@@ -83,10 +83,12 @@ write_x11_session() {
|
|||||||
# Common login-time plumbing every Wayland compositor wants on a bare install.
|
# Common login-time plumbing every Wayland compositor wants on a bare install.
|
||||||
install_session_prereqs() {
|
install_session_prereqs() {
|
||||||
# polkit-kde ships the agent (polkit-gnome is orphaned, EPEL-only).
|
# polkit-kde ships the agent (polkit-gnome is orphaned, EPEL-only).
|
||||||
# BUT its autostart file has OnlyShowIn=KDE; — XDG autostart SKIPS it in a
|
# BUT Fedora's autostart .desktop carries X-systemd-skip=true (and a
|
||||||
# niri/Hyprland/MangoWC session (VM-proven: package installed, error
|
# OnlyShowIn on some versions): niri starts apps via systemd's
|
||||||
# persisted). Copy the .desktop without the OnlyShowIn line so the agent
|
# xdg-desktop-autostart.target, which honors those flags -> agent never
|
||||||
# starts in every session; the copy shadows the original by name.
|
# starts in a niri session (VM-proven twice). Fighting .desktop semantics
|
||||||
|
# is fragile, so we ship our own user unit bound to
|
||||||
|
# graphical-session.target, which niri/Hyprland/MangoWC all bring up.
|
||||||
install_packages \
|
install_packages \
|
||||||
xdg-desktop-portal \
|
xdg-desktop-portal \
|
||||||
polkit \
|
polkit \
|
||||||
@@ -95,13 +97,32 @@ install_session_prereqs() {
|
|||||||
pipewire-pulseaudio \
|
pipewire-pulseaudio \
|
||||||
wireplumber
|
wireplumber
|
||||||
|
|
||||||
local src="${POLKIT_AGENT_DESKTOP:-/etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop}"
|
local unit_dir="/etc/systemd/user"
|
||||||
local dst="${XDG_AUTOSTART_DIR:-/etc/xdg/autostart}/polkit-kde-authentication-agent-1.desktop"
|
if [[ ! -f "$unit_dir/polkit-agent.service" ]]; then
|
||||||
# src and dst are the same file in production — the condition to rewrite
|
info "Installing polkit-agent user unit (compositor-safe)..."
|
||||||
# is "the file still contains OnlyShowIn", not "dst lacks it".
|
sudo mkdir -p "$unit_dir"
|
||||||
if [[ -f "$src" ]] && grep -q "^OnlyShowIn=" "$src" 2>/dev/null; then
|
sudo tee "$unit_dir/polkit-agent.service" >/dev/null <<'UNIT'
|
||||||
info "Making polkit agent session-agnostic (stripping OnlyShowIn=KDE)..."
|
[Unit]
|
||||||
sudo mkdir -p "$(dirname "$dst")"
|
Description=PolicyKit Authentication Agent (for bare compositors)
|
||||||
grep -v '^OnlyShowIn=' "$src" | sudo tee "$dst" >/dev/null
|
PartOf=graphical-session.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
# polkit-kde's binary on Fedora (kf6 path). Restart in case the agent dies
|
||||||
|
# before the session settles.
|
||||||
|
ExecStart=/usr/libexec/kf6/polkit-kde-authentication-agent-1
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=2
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=graphical-session.target
|
||||||
|
UNIT
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable per-user: preset-all would also do, but be explicit. This is a
|
||||||
|
# global unit dir; each user links it at first login via the preset.
|
||||||
|
if [[ ! -f /etc/systemd/user/graphical-session.target.wants/polkit-agent.service ]]; then
|
||||||
|
sudo mkdir -p /etc/systemd/user/graphical-session.target.wants
|
||||||
|
sudo ln -sf ../polkit-agent.service \
|
||||||
|
/etc/systemd/user/graphical-session.target.wants/polkit-agent.service
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user