commit: 227444f15e293af9cf85c31c89169aff33c58551 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Thu Jun 26 11:35:02 2025 +0000 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> CommitDate: Thu Jun 26 11:51:40 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=227444f1
mail-filter/postsrsd: New OpenRC init file for version 2.x Many changes in version 2.x. Most configuration options no longer work from the command line but must be set in postsrsd.conf. Therefore, the init.d file must be rewritten from scratch. Install the example config file to /etc where users expect it to be. Install CHANGELOG.rst. Add README.gentoo. Closes: https://bugs.gentoo.org/959104 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> mail-filter/postsrsd/files/postsrsd-2.0.11.confd | 6 ++ mail-filter/postsrsd/files/postsrsd-2.0.11.initd | 14 ++++ mail-filter/postsrsd/postsrsd-2.0.11-r1.ebuild | 85 ++++++++++++++++++++++++ 3 files changed, 105 insertions(+) diff --git a/mail-filter/postsrsd/files/postsrsd-2.0.11.confd b/mail-filter/postsrsd/files/postsrsd-2.0.11.confd new file mode 100644 index 000000000000..99bebd427a14 --- /dev/null +++ b/mail-filter/postsrsd/files/postsrsd-2.0.11.confd @@ -0,0 +1,6 @@ +# Default settings for PostSRSd + +# From the postsrsd-2.0.11 README file: +# "Most configuration options can no longer be configured with command +# line arguments, so you will have to set them in /etc/postsrsd.conf." +#POSTSRSD_OPTS="" diff --git a/mail-filter/postsrsd/files/postsrsd-2.0.11.initd b/mail-filter/postsrsd/files/postsrsd-2.0.11.initd new file mode 100644 index 000000000000..d394202e3bf1 --- /dev/null +++ b/mail-filter/postsrsd/files/postsrsd-2.0.11.initd @@ -0,0 +1,14 @@ +#!/sbin/openrc-run +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the modified BSD license + +description="Sender Rewriting Scheme daemon for Postfix" + +supervisor=supervise-daemon +command=/usr/sbin/postsrsd +command_args=${POSTSRSD_OPTS} + +depend() { + need net + before postfix +} diff --git a/mail-filter/postsrsd/postsrsd-2.0.11-r1.ebuild b/mail-filter/postsrsd/postsrsd-2.0.11-r1.ebuild new file mode 100644 index 000000000000..bb695c72f474 --- /dev/null +++ b/mail-filter/postsrsd/postsrsd-2.0.11-r1.ebuild @@ -0,0 +1,85 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake eapi9-ver readme.gentoo-r1 systemd + +DESCRIPTION="Postfix Sender Rewriting Scheme daemon" +HOMEPAGE="https://github.com/roehling/postsrsd" +SRC_URI="https://github.com/roehling/postsrsd/archive/${PV}.tar.gz -> ${P}.tar.gz" + +# See REUSE.toml; GPL-3 for the main software, BSD for src/sha*. +LICENSE="GPL-3 BSD" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND="dev-libs/confuse:=" +DEPEND=" + ${RDEPEND} + test? ( dev-libs/check ) +" + +CHROOT_DIR="${EPREFIX}/var/lib/postsrsd" + +PATCHES=( + "${FILESDIR}"/${PN}-2.0.11-docdir.patch +) +DOCS=( README.rst CHANGELOG.rst ) + +src_configure() { + local mycmakeargs=( + -DBUILD_TESTING=$(usex test) + + -DPOSTSRSD_CHROOTDIR="${CHROOT_DIR}" + -DSYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" + -DSYSTEMD_SYSUSERSDIR="${EPREFIX}/usr/lib/sysusers.d" + + -DINSTALL_SYSTEMD_SERVICE=ON + # https://github.com/roehling/postsrsd/blob/main/doc/packaging.rst#third-party-dependencies + -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS + # We don't want to run tests with sanitizers. They're + # unreliable under sandbox and don't run on all platforms + -DTESTS_WITH_ASAN=OFF + + -DWITH_MILTER=OFF + -DWITH_SQLITE=OFF + -DWITH_REDIS=OFF + ) + + cmake_src_configure +} + +src_install() { + cmake_src_install + + newinitd "${FILESDIR}"/postsrsd-2.0.11.initd postsrsd + newconfd "${FILESDIR}"/postsrsd-2.0.11.confd postsrsd + keepdir "${CHROOT_DIR}" + + # Move the example config file to /etc + mv "${ED}/usr/share/doc/${PF}/${PN}.conf" "${ED}/etc/" || die + + local DOC_CONTENTS="When updating from version 1.x: + \n\nNote that most configuration options can no longer be set from the + command line, therefore we cannot define them in OpenRC's conf.d file + either. You will have to set them in ${EPREFIX}/etc/postsrsd.conf + instead. + \n\nIn the config file, you must *at least* set the \"domains\" + variable, i.e. the local domain name. In most cases, using the output + of \"postconf -h mydomain\" should be okay. + \n\nAlso note that PostSRSd 2.x by default uses Unix domain sockets + instead of TCP sockets, so you must update \"sender_canonical_maps\" + and \"recipient_canonical_maps\" in ${EPREFIX}/etc/postfix/main.cf. + (Alternatively, you can update \"socketmap\" in postsrsd.conf.) + \n\nSee README.rst and the comments in postsrsd.conf for more detailed + information." + readme.gentoo_create_doc +} + +pkg_postinst() { + ver_replacing -lt 2.0.11-r1 && local FORCE_PRINT_ELOG=1 + readme.gentoo_print_elog +}
