Review: enroll keeps foreign db keys, configurable paths, on-demand eac-run, launcher ebuild, db dedupe tool
This commit is contained in:
+12
-6
@@ -23,13 +23,19 @@ RDEPEND="
|
||||
sys-apps/util-linux
|
||||
sys-auth/elogind
|
||||
sys-auth/polkit
|
||||
sys-process/procps
|
||||
"
|
||||
|
||||
src_install() {
|
||||
dobin "${FILESDIR}"/systemctl "${FILESDIR}"/systemd-run
|
||||
exeinto /usr/libexec/${PN}
|
||||
doexe "${FILESDIR}"/systemd-run-agent "${FILESDIR}"/socket-activate
|
||||
python_fix_shebang "${ED}"/usr/bin/systemd-run "${ED}"/usr/libexec/${PN}
|
||||
local lib=/usr/libexec/${PN}
|
||||
|
||||
dobin "${FILESDIR}"/systemctl "${FILESDIR}"/systemd-run "${FILESDIR}"/eac-run
|
||||
exeinto ${lib}
|
||||
doexe "${FILESDIR}"/systemd-run-agent "${FILESDIR}"/socket-activate "${FILESDIR}"/socket-activate-ctl
|
||||
python_fix_shebang "${ED}"/usr/bin/systemd-run "${ED}"${lib}/systemd-run-agent "${ED}"${lib}/socket-activate
|
||||
|
||||
insinto /usr/share/polkit-1/actions
|
||||
doins "${FILESDIR}"/org.gentoo.eac-openrc-compat.policy
|
||||
|
||||
newinitd "${FILESDIR}"/socket-activate.initd socket-activate
|
||||
dosym socket-activate /etc/init.d/socket-activate.easyanticheat_eos
|
||||
@@ -42,7 +48,7 @@ src_install() {
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog "Start ${EPREFIX}/usr/libexec/${PN}/systemd-run-agent from your compositor's autostart,"
|
||||
elog "and run a session-wide polkit authentication agent there (not pkttyagent)."
|
||||
elog "Start game launchers through eac-run, e.g. eac-run EpicGamesLauncher,"
|
||||
elog "and run a session-wide polkit authentication agent (not pkttyagent)."
|
||||
elog "Details: ${EROOT}/usr/share/doc/${PF}/README.md*"
|
||||
}
|
||||
@@ -30,6 +30,9 @@ Logs: `~/.cache/com.epicgames.easyanticheat/service.log` (setup),
|
||||
|
||||
| File | Role |
|
||||
| --- | --- |
|
||||
| `/usr/bin/eac-run` | `eac-run COMMAND [ARGS...]`: runs a game launcher with the two pieces below, which run only as long as it does |
|
||||
| `/usr/libexec/eac-openrc-compat/socket-activate-ctl` | `{start\|stop} NAME` for `socket-activate.NAME`, as root through pkexec; `stop` does nothing while the service it started still runs |
|
||||
| `/usr/share/polkit-1/actions/org.gentoo.eac-openrc-compat.policy` | lets the active local session run `socket-activate-ctl` without a password; anyone else needs an admin password |
|
||||
| `/usr/lib64/libsystemd.so.0` | link to elogind's library, which exports the same `LIBSYSTEMD_*` symbols the setup uses (`sd_listen_fds`, `sd_is_socket_unix`, `sd_notify`) |
|
||||
| `/usr/bin/systemd-run` | the `--user` form only, forwarded to `systemd-run-agent`; anything else fails as on a host without a user manager |
|
||||
| `/usr/libexec/eac-openrc-compat/systemd-run-agent` | runs those commands in the graphical session, with the session's environment, outside the caller's process tree |
|
||||
@@ -64,8 +67,20 @@ Logs: `~/.cache/com.epicgames.easyanticheat/service.log` (setup),
|
||||
|
||||
## Setup
|
||||
|
||||
1. Start the agent in the graphical session, e.g. Hyprland:
|
||||
`hl.exec_cmd("/usr/libexec/eac-openrc-compat/systemd-run-agent")`.
|
||||
1. Start the launcher through `eac-run`, e.g. `eac-run EpicGamesLauncher`
|
||||
(`games-util/epic-games-launcher-bin`'s `EpicGamesLauncher` does this
|
||||
itself). From the graphical session, so the agent gets its environment and
|
||||
polkit sees the active session. `eac-run`:
|
||||
- starts `systemd-run-agent` unless one already runs for the user;
|
||||
- starts `socket-activate.easyanticheat_eos` through pkexec once EAC is
|
||||
installed (before that, the setup starts it itself);
|
||||
- when the launcher exits, stops both, unless the listener was already
|
||||
running before or is in the default runlevel. The listener stays
|
||||
while the EAC service still serves a game.
|
||||
|
||||
Nothing runs at boot or in the background between game sessions. To keep
|
||||
the listener running instead: `rc-update add socket-activate.easyanticheat_eos default`
|
||||
(or `systemctl enable easyanticheat_eos.socket`); `eac-run` leaves it alone then.
|
||||
2. Run a session-wide polkit authentication agent in that session
|
||||
(hyprpolkitagent, polkit-gnome, lxqt-policykit, ...). `pkttyagent` does not
|
||||
work: without `--process` it registers only for its parent shell, so polkit
|
||||
@@ -73,8 +88,10 @@ Logs: `~/.cache/com.epicgames.easyanticheat/service.log` (setup),
|
||||
in the setup's log). Check with
|
||||
`systemd-run --user --wait --pipe pkexec --disable-internal-agent /usr/bin/true`:
|
||||
"No authentication agent found" means none is registered for the session.
|
||||
3. Launch the game and accept the service installation. The setup enables
|
||||
`socket-activate.easyanticheat_eos` in the default runlevel itself.
|
||||
3. Launch the game and accept the service installation. The setup runs
|
||||
`systemctl start`; it never runs `enable`, since systemd would start the
|
||||
socket at boot through EAC's `sockets.target.d` drop-in, which OpenRC does
|
||||
not read.
|
||||
|
||||
Remove EAC's files again with `pkexec /usr/local/bin/easyanticheat_eos
|
||||
uninstall standalone`, then `rc-update del socket-activate.easyanticheat_eos`.
|
||||
uninstall standalone`.
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# Usage: eac-run COMMAND [ARGS...]
|
||||
# Runs COMMAND (a game launcher) with what Easy Anti-Cheat needs on OpenRC, and only for as long
|
||||
# as it runs: systemd-run-agent for the user, and the socket-activate.easyanticheat_eos listener,
|
||||
# started through pkexec (no password for the active local session, see the polkit action).
|
||||
[ $# -gt 0 ] || { echo "usage: eac-run COMMAND [ARGS...]" >&2; exit 2; }
|
||||
|
||||
lib=/usr/libexec/eac-openrc-compat
|
||||
name=easyanticheat_eos
|
||||
svc=socket-activate.$name
|
||||
|
||||
running() { rc-service "$svc" status >/dev/null 2>&1; }
|
||||
at_boot() { rc-update show default 2>/dev/null | grep -qwF "$svc"; }
|
||||
|
||||
"$lib/systemd-run-agent" 2>/dev/null &
|
||||
agent=$!
|
||||
|
||||
was_running=
|
||||
running && was_running=1
|
||||
# Before EAC's first install the binary is missing; its setup then starts the listener itself.
|
||||
if [ -z "$was_running" ] && [ -x /usr/local/bin/easyanticheat_eos ]; then
|
||||
pkexec "$lib/socket-activate-ctl" start "$name" >/dev/null || echo "eac-run: could not start $svc" >&2
|
||||
fi
|
||||
|
||||
cleanup() {
|
||||
if [ -z "$was_running" ] && running && ! at_boot; then
|
||||
pkexec "$lib/socket-activate-ctl" stop "$name" >/dev/null
|
||||
fi
|
||||
kill "$agent" 2>/dev/null
|
||||
}
|
||||
trap cleanup EXIT
|
||||
trap 'exit 130' INT TERM HUP
|
||||
|
||||
"$@"
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>eac-openrc-compat</vendor>
|
||||
<action id="org.gentoo.eac-openrc-compat.socket-activate">
|
||||
<description>Start or stop a socket-activated service</description>
|
||||
<message>Authentication is required to start or stop a socket-activated service</message>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>yes</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/libexec/eac-openrc-compat/socket-activate-ctl</annotate>
|
||||
</action>
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# Usage (as root, normally through pkexec): socket-activate-ctl {start|stop} NAME
|
||||
# Starts or stops the OpenRC service socket-activate.NAME. stop leaves it running while the
|
||||
# service it started is still serving a client (for EAC: a game that is still running).
|
||||
set -eu
|
||||
action=${1:-}
|
||||
name=${2:-}
|
||||
case $action in start|stop) ;; *) echo "usage: socket-activate-ctl {start|stop} NAME" >&2; exit 2 ;; esac
|
||||
case $name in ''|*[!A-Za-z0-9_.-]*) echo "socket-activate-ctl: invalid name '$name'" >&2; exit 2 ;; esac
|
||||
svc=socket-activate.$name
|
||||
[ -e "/etc/init.d/$svc" ] || { echo "socket-activate-ctl: $svc does not exist" >&2; exit 1; }
|
||||
|
||||
if [ "$action" = start ]; then
|
||||
exec rc-service -N "$svc" start
|
||||
fi
|
||||
socket_command=
|
||||
. "/etc/conf.d/$svc"
|
||||
if [ -n "$socket_command" ] && pgrep -xf -- "$socket_command" >/dev/null; then
|
||||
echo "socket-activate-ctl: ${socket_command%% *} still runs, $svc stays started" >&2
|
||||
exit 0
|
||||
fi
|
||||
exec rc-service -s "$svc" stop
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/python3 -I
|
||||
"""Runs commands for systemd-run (eac-openrc-compat) in the graphical session.
|
||||
|
||||
Start it once per session, from the compositor's autostart. Each request comes from the
|
||||
eac-run starts it from the graphical session (or start it from the compositor's autostart); a
|
||||
second instance exits while the first one answers. Each request comes from the
|
||||
systemd-run in /usr/bin over $XDG_RUNTIME_DIR/systemd-run-agent.sock; only the agent's own user
|
||||
may connect. The command gets the agent's environment plus the request's --setenv values and, with
|
||||
--pipe, the caller's stdin/stdout/stderr. Every run is logged to syslog.
|
||||
|
||||
Reference in New Issue
Block a user