Files
fabolous005 95954b2d6b Prepare for publication: license, disclaimer, limitations, kernel 7.3.7, polkit action rename
- LICENSE: ebuilds GPL-2.0-only (LICENSE.GPL-2), everything else MIT.
- README: unofficial/no-affiliation and account-risk disclaimer; requirements
  and limitations (NVIDIA/ZFS/r8125 EAC modules not packaged, keys, ESP,
  one tested machine).
- AGENTS.md: the values table is the author's example machine.
- progress: CachyOS's key is on Epic's trusted list (was wrong).
- overlay: kernel 7.3.7_p2 with module cleanup, compat -r3 (polkit action
  de.root64.engler-labs.eac-openrc-compat), pkgcheck fixes.
2026-12-04 09:13:45 +01:00

112 lines
3.6 KiB
Bash

# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit toolchain-funcs
MY_PV=${PV/_p/-}
MY_KV=${MY_PV}-cachyos-eac
SDBOOT_PV=262.2_1-1
KEY_PV=1-2
SETTINGS_PV=1.4.7-1
MIRROR=https://mirror.cachyos.org/repo/x86_64/cachyos
DESCRIPTION="CachyOS-signed kernel and systemd-boot for Easy Anti-Cheat Linux v2"
HOMEPAGE="https://wiki.cachyos.org/configuration/easy_anti_cheat/"
SRC_URI="
${MIRROR}/linux-cachyos-eac-${MY_PV}-x86_64.pkg.tar.zst
${MIRROR}/systemd-boot-cachyos-signed-${SDBOOT_PV}-x86_64.pkg.tar.zst
${MIRROR}/cachyos-eac-signing-key-${KEY_PV}-any.pkg.tar.zst
${MIRROR}/cachyos-settings-1%3A${SETTINGS_PV}-any.pkg.tar.zst
-> cachyos-settings-${SETTINGS_PV}-any.pkg.tar.zst
"
S=${WORKDIR}
LICENSE="GPL-2 LGPL-2.1+ GPL-3+ GPL-1"
SLOT="0"
KEYWORDS="~amd64"
# Stripping or re-signing anything here breaks the CachyOS signatures EAC checks.
RESTRICT="mirror strip"
RDEPEND="
app-crypt/efitools
app-crypt/sbctl
app-crypt/sbsigntools
app-crypt/tpm2-tools
dev-libs/openssl
sys-apps/kmod[zstd]
sys-boot/efibootmgr
sys-kernel/dracut
"
BDEPEND="
app-arch/zstd
sys-apps/kmod
virtual/pkgconfig
"
src_unpack() {
local f
for f in ${A}; do
tar -xf "${DISTDIR}/${f}" || die "unpacking ${f} failed"
done
}
src_prepare() {
default
# eac-status takes the ESP, kernel and boot loader locations from eac-boot.
sed -i \
-e 's#esp=$(bootctl --print-esp-path 2>/dev/null || echo /boot)#esp=$(eac-boot esp)#' \
-e 's#"$esp/$(cat /etc/machine-id)/linux-cachyos-eac#"$(eac-boot kernel-dir)#' \
-e 's#"$esp/EFI/cachyos-eac/systemd-bootx64.efi"#"$(eac-boot loader)"#' \
usr/bin/eac-status || die
grep -q 'esp=$(eac-boot esp)' usr/bin/eac-status || die "eac-status: ESP patch did not apply"
[[ $(grep -c '$(eac-boot kernel-dir)' usr/bin/eac-status) == 2 ]] || die "eac-status: kernel-dir patch did not apply"
grep -q '"$(eac-boot loader)"' usr/bin/eac-status || die "eac-status: loader patch did not apply"
}
src_install() {
# Wherever this system's kmod looks for modules (/lib/modules on Gentoo).
MODULES_DIR=$($(tc-getPKG_CONFIG) --variable=module_directory kmod)
: "${MODULES_DIR:=/lib/modules}"
dodir "${MODULES_DIR}"
cp -a "usr/lib/modules/${MY_KV}" "${ED}${MODULES_DIR}/" || die
fowners -R root:root "${MODULES_DIR}/${MY_KV}"
insinto /usr/lib/cachyos-eac
doins usr/lib/systemd/boot/efi/systemd-bootx64.efi.signed
insinto /usr/share/cachyos-eac
doins usr/share/cachyos-eac/cachyos-eac-ca.{crt,der}
# Only used by `sbctl enroll-keys --custom` with sbctl's default keydir; eac-boot enroll reads the copy above.
insinto /var/lib/sbctl/keys/custom/db
doins var/lib/sbctl/keys/custom/db/cachyos-eac-ca.der
dosbin usr/bin/eac-status "${FILESDIR}"/eac-boot
dodoc "${FILESDIR}"/README.md
}
pkg_postinst() {
depmod -b "${EROOT:-/}" "${MY_KV}" || die
if [[ -z ${ROOT} && -f $(eac-boot loader 2>/dev/null) ]]; then
eac-boot update || ewarn "eac-boot update failed, run it by hand"
else
elog "First-time setup: eac-boot enroll, eac-boot setup, then enable Secure Boot."
elog "Boot it with eac-boot boot and check it with eac-status."
elog "Details: README in ${EROOT}/usr/share/doc/${PF}/"
fi
}
pkg_postrm() {
# Portage keeps /lib/modules/* on unmerge (UNINSTALL_IGNORE), and depmod's files are not owned.
local new=${REPLACED_BY_VERSION%-r*}
[[ -n ${new} && ${new/_p/-}-cachyos-eac == "${MY_KV}" ]] && return
if [[ -z ${ROOT} && $(uname -r) == "${MY_KV}" ]]; then
elog "Kept ${EROOT}${MODULES_DIR}/${MY_KV}: it belongs to the running kernel. Remove it after a reboot."
return
fi
rm -rf "${EROOT}${MODULES_DIR:-/lib/modules}/${MY_KV}"
}