unitas-misc/net-proxy/squid-opnsense-fetchacls/squid-opnsense-fetchacls-24.7.12.ebuild

48 lines
1.1 KiB
Bash

# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{9..12} )
inherit python-r1 systemd
DESCRIPTION="fetch url list and build squid acl"
HOMEPAGE="https://opnsense.org/"
SRC_URI="https://raw.githubusercontent.com/opnsense/plugins/refs/tags/${PV}/www/squid/src/opnsense/scripts/proxy/fetchACLs.py -> ${P}.py"
S=${WORKDIR}
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="amd64"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="net-proxy/squid
${PYTHON_DEPS}
dev-python/requests[${PYTHON_USEDEP}]
dev-python/urllib3[${PYTHON_USEDEP}]"
src_unpack() {
cp ${DISTDIR}/${P}.py ${WORKDIR}/
}
src_prepare() {
sed -i \
-e 's|/usr/local/etc/squid/externalACLs.conf|/etc/squid/externalACLs.conf|' \
-e 's|/usr/local/etc/squid/acl|/var/lib/squid/acl|' \
${P}.py || die
eapply_user
}
src_install() {
newbin ${P}.py fetchACLs.py
python_replicate_script "${D}"/usr/bin/fetchACLs.py
systemd_dounit "${FILESDIR}"/fetchACLs.{service,timer}
insinto /etc/squid
doins "${FILESDIR}"/externalACLs.conf "${FILESDIR}"/squid.conf.*
keepdir /var/lib/squid/acl
}