summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-antivirus/fangfrisch')
-rw-r--r--app-antivirus/fangfrisch/Manifest1
-rw-r--r--app-antivirus/fangfrisch/fangfrisch-1.9.0.ebuild78
-rw-r--r--app-antivirus/fangfrisch/files/fangfrisch-has-news.sh82
-rw-r--r--app-antivirus/fangfrisch/files/fangfrisch.conf7
4 files changed, 168 insertions, 0 deletions
diff --git a/app-antivirus/fangfrisch/Manifest b/app-antivirus/fangfrisch/Manifest
index 0555add138a4..f4f50ec94210 100644
--- a/app-antivirus/fangfrisch/Manifest
+++ b/app-antivirus/fangfrisch/Manifest
@@ -1 +1,2 @@
DIST fangfrisch-1.6.1.gh.tar.gz 113497 BLAKE2B a37b5b29b31a1d0166112b8939e691acc1721a91bda9e364a90c0c8d4ea7b7d3e1a24b8849c9ef4f0632996ed7bbdfc7985ab04c44c8ca4d57df21294867fd32 SHA512 a16b39b6520d80f69c561bc2d56fef28acaca35a9da214be920cdd907f76d3d6674ed4aa1290ad11a9364ede11472594d7e331ecd21924fe23e005ef9501d4ac
+DIST fangfrisch-1.9.0.gh.tar.gz 127572 BLAKE2B c05c68f904a6e7c7d9f9c5b82bb63366f86653cd13a94276108f52e9c523280320c8aa55ba94ecf079ba938a77e11ca7dc557f4c8fd1b1c7f37179c087dd8605 SHA512 08cc36f20884fedb553de905b8faafce99fcef80e3bce7c0b264691b1a8d83b91a582c095b684f6f7a6af77fd4ed0405fa771a74bbeee3f1b255ff74a161d37e
diff --git a/app-antivirus/fangfrisch/fangfrisch-1.9.0.ebuild b/app-antivirus/fangfrisch/fangfrisch-1.9.0.ebuild
new file mode 100644
index 000000000000..ce305afaca14
--- /dev/null
+++ b/app-antivirus/fangfrisch/fangfrisch-1.9.0.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit distutils-r1 readme.gentoo-r1 systemd
+
+DESCRIPTION="Update and verify unofficial Clam Anti-Virus signatures"
+HOMEPAGE="https://github.com/rseichter/fangfrisch https://pypi.org/project/fangfrisch/"
+SRC_URI="https://github.com/rseichter/fangfrisch/archive/${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+MY_CONF="/etc/${PN}.conf"
+MY_DBDIR="/var/lib/${PN}"
+DISABLE_AUTOFORMATTING=1
+DOC_CONTENTS="See https://rseichter.github.io/fangfrisch/ for the official
+documentation.
+
+### Fresh installations:
+
+Modify ${MY_CONF} according to your preferences.
+Assuming you place the database into ${MY_DBDIR}
+(recommended), execute the following commands in a root shell:
+
+mkdir -m 0770 ${MY_DBDIR}
+chgrp clamav ${MY_DBDIR}
+sudo -u clamav -- fangfrisch -c ${MY_CONF} initdb
+
+You can now enable /etc/cron.d/${PN} for periodic updates.
+
+### Updating from a previous release:
+
+Either create a fresh database or manually delete all existing
+database tables, then run the initdb command as shown above."
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="
+ >=dev-python/requests-2.22.0[${PYTHON_USEDEP}]
+ >=dev-python/sqlalchemy-1.4.0[${PYTHON_USEDEP}]
+"
+RDEPEND="${DEPEND}"
+
+distutils_enable_tests unittest
+
+python_prepare_all() {
+ sed -i -e '/SQLAlchemy/d' setup.cfg || die
+ # Mitigate build system warnings, see
+ # https://projects.gentoo.org/python/guide/qawarn.html#stray-top-level-files-in-site-packages
+ cat >>setup.cfg <<EOT
+[options.packages.find]
+exclude =
+ tests
+ tests.*
+EOT
+ distutils-r1_python_prepare_all
+}
+
+python_install_all() {
+ insinto /etc
+ doins "${FILESDIR}/${PN}.conf"
+ insinto /etc/cron.d
+ newins "${FILESDIR}/${PN}.cron" "${PN}"
+ exeinto /etc
+ doexe "${FILESDIR}/${PN}-has-news.sh"
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_dounit "${FILESDIR}/${PN}.timer"
+ distutils-r1_python_install_all
+ readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ FORCE_PRINT_ELOG=1 readme.gentoo_print_elog
+}
diff --git a/app-antivirus/fangfrisch/files/fangfrisch-has-news.sh b/app-antivirus/fangfrisch/files/fangfrisch-has-news.sh
new file mode 100644
index 000000000000..7a018d911d32
--- /dev/null
+++ b/app-antivirus/fangfrisch/files/fangfrisch-has-news.sh
@@ -0,0 +1,82 @@
+#!/usr/bin/env bash
+# vim: ts=4 sw=4 noet ft=sh
+#
+# Example script to process Fangfrisch News.
+
+declare -r MAILFROM="noreply"
+declare -r MAILTO="alice@example.com"
+declare -r SUBJECT="Fangfrisch News are available"
+
+# Pick one of the following options and uncomment the 'declare'
+# statements. Otherwise, the script will not run otherwise.
+
+# Option 1: Mutt
+#declare -r MAILAPP="mutt"
+#declare -r MAILAPP_OPT=( "-s" "$SUBJECT" "$MAILTO" )
+
+# Option 2: sendmail
+#declare -r MAILAPP="sendmail"
+#declare -r MAILAPP_OPT=( "-t" )
+#export PATH="$PATH:/usr/sbin"
+
+# Option 3: swaks
+#declare -r MAILAPP="swaks"
+#declare -r MAILAPP_OPT=( "-d" "-" "-f" "$MAILFROM" "-t" "$MAILTO" )
+
+### No changes required below this line ###
+
+set -euo pipefail
+
+die() {
+ echo >&2 "$@"
+ exit 1
+}
+
+usage() {
+ die "Usage: $(basename "$0") {directory}"
+}
+
+gen_header() {
+ cat <<EOT
+From: Fangfrisch News <$MAILFROM>
+To: $MAILTO
+Subject: $SUBJECT
+
+EOT
+# Mail header must end with an empty line!
+}
+
+declare -a NEWSITEMS=()
+
+report_news() {
+ local dir=$1 ni
+ [ -d "$dir" ] || die "$dir is not a directory"
+ while IFS= read -r -d '' ni; do
+ if [ ${#NEWSITEMS[*]} -eq 0 ] && [ "$MAILAPP" != mutt ]; then
+ # Mutt does not need the header, others do.
+ gen_header
+ fi
+ NEWSITEMS+=( "$ni" )
+ echo -e "\n### $(basename "$ni"):\n"
+ cat "$ni"
+ done < <(find "$dir" -maxdepth 1 -type f -name "fangfrisch*.txt" -print0)
+}
+
+main() {
+ local t
+ [ -n "$MAILAPP" ] || die "MAILAPP is undefined, exiting."
+ if tty -s; then
+ # Running in a terminal session
+ t=$(mktemp)
+ # shellcheck disable=SC2064
+ trap "rm $t" EXIT
+ report_news "$@" | tee "$t" || exit 1
+ [ ! -s "$t" ] || "$MAILAPP" "${MAILAPP_OPT[@]}" >/dev/null <"$t"
+ else
+ report_news "$@" 2>&1 | "$MAILAPP" "${MAILAPP_OPT[@]}" >/dev/null
+ [ ${#NEWSITEMS[*]} -eq 0 ] || rm -v "${NEWSITEMS[@]}"
+ fi
+}
+
+[ $# -ge 1 ] || usage
+main "$@"
diff --git a/app-antivirus/fangfrisch/files/fangfrisch.conf b/app-antivirus/fangfrisch/files/fangfrisch.conf
index ded86b9cc981..0fbc71ec16dc 100644
--- a/app-antivirus/fangfrisch/files/fangfrisch.conf
+++ b/app-antivirus/fangfrisch/files/fangfrisch.conf
@@ -7,6 +7,13 @@ log_method = syslog
log_target = /dev/log
on_update_exec = clamdscan --reload
+[fangfrischnews]
+enabled = yes
+# Uncomment/adapt the following to trigger a script in case of news.
+# The bundled example script needs to be manually modified before
+# it can be used!
+# script = /etc/fangfrisch-has-news.sh
+
[malwarepatrol]
enabled = yes
# Replace with your personal Malwarepatrol receipt