Postforward is a mail forwarding utility which aims to compliment the
Postfix Sender Rewriting Scheme daemon (PostSRSd) by allowing only
certain addresses to be forwarded while leaving leaving non-forwarded
mail unaltered by PostSRSd.
- Create initial ebuild
- Work around upstream not putting their .go files in src/ which
makes "go build" angry
- Work around golang-build complaining about pkg not existing
and just do the install by hand
- Patch default sendmail path to respect EPREFIX and use the
standard postfix install location instead of depending on
it being in the path
- Implement requests made by monsueirp on GitHub:
https://github.com/gentoo/gentoo/pull/5910#pullrequestreview-
83093569
- Implement requests made by mgorny on GitHub:
https://github.com/gentoo/gentoo/pull/5910#pullrequestreview-
103921727
Package-Manager: Portage-2.3.8, Repoman-2.3.3
Closes: https://bugs.gentoo.org/650398
Closes: https://github.com/gentoo/gentoo/pull/5910
--- /dev/null
+DIST postforward-1.1.0.tar.gz 5707 BLAKE2B 2dc994628820b40caf3b9c65ad6be48e220abff8f5a6d6054b109600d9d368fab3e6e642dbc5a98235f440359600a3f4bbc19f7ead06fd84802a8900fa465dc1 SHA512 39d7a33c454b1529a691b24fd69b311ba368caf59168d39146654cfe319ebc3cf73835e66e6c95a43747f389a6b954ac8da0d7e934e562c16cb85dc20c0f4804
--- /dev/null
+--- a/postforward.go
++++ b/postforward.go
+@@ -27,7 +27,7 @@ const (
+ )
+
+ var dryRun = flag.Bool("dry-run", false, "show what would be done, don't actually forward mail")
+-var path = flag.String("path", "", "override $PATH with this value when executing binaries")
++var path = flag.String("path", "@GENTOO_PORTAGE_EPREFIX@/usr/sbin", "override $PATH with this value when executing binaries")
+ var rpHeader = flag.String("rp-header", "Return-Path", "header name containing the return-path (MAIL FROM) value")
+ var sendmailPath = flag.String("sendmail-path", "sendmail", "path to the sendmail binary (deprecated: use --path instead)")
+ var srsAddr = flag.String("srs-addr", "localhost:10001", "TCP address for SRS lookups")
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>gentoo_bugs_peep@parallaxshift.com</email>
+ <name>Philippe Chaintreuil</name>
+ </maintainer>
+
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+
+ <upstream>
+ <remote-id type="github">zoni/postforward</remote-id>
+ </upstream>
+</pkgmetadata>
--- /dev/null
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils golang-build
+
+DESCRIPTION="Postfix Sender Rewriting Scheme forwarding agent"
+EGO_PN="${PN}"
+SRC_URI="https://github.com/zoni/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+HOMEPAGE="https://github.com/zoni/postforward"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="
+ dev-lang/go:0"
+RDEPEND="
+ mail-filter/postsrsd"
+
+PATCHES=( "${FILESDIR}/${PN}_apply-sendmail-path.patch" )
+
+src_prepare() {
+ default
+
+ # Dynamically fix EPREFIX lines made by ${PN}_apply-sendmail-path.patch
+ sed -i -e "s/@GENTOO_PORTAGE_EPREFIX@/${EPREFIX}/" *.go || die
+
+ # go build assumes files will be in src dir, but
+ # source files are in root in this package, so move
+ # them.
+ local new_src_dir="${S}/src/${EGO_PN}"
+ # Freak out if there's already something there because
+ # it means the package has changed and we'll need to
+ # adjust to it.
+ [[ ! -e "${new_src_dir}" ]] || die "${new_src_dir} already exists"
+ mkdir -p "${new_src_dir}" || die
+ mv *.go "${new_src_dir}" || die
+}
+
+# Standard golang-build src_install complains about pkg not
+# existing, so we go custom.
+src_install() {
+ einstalldocs
+ dosbin "${PN}"
+}