Patches for aports can be sent to this list

1

[alpine-aports] [PATCH] testing/go-dkim: new APKBUILD

Details
Message ID
<20190312002211.10110-1-sir@cmpwn.com>
Sender timestamp
1552350131
DKIM signature
missing
Download raw message
Patch: +107 -0
---
I'm not great at openrc scripts, feedback welcome.

 testing/go-dkim/APKBUILD             | 42 +++++++++++++++++++++++++
 testing/go-dkim/dkim-milter.confd    | 16 ++++++++++
 testing/go-dkim/dkim-milter.initd    | 46 ++++++++++++++++++++++++++++
 testing/go-dkim/go-dkim.post-install |  3 ++
 4 files changed, 107 insertions(+)
 create mode 100644 testing/go-dkim/APKBUILD
 create mode 100644 testing/go-dkim/dkim-milter.confd
 create mode 100644 testing/go-dkim/dkim-milter.initd
 create mode 100644 testing/go-dkim/go-dkim.post-install

diff --git a/testing/go-dkim/APKBUILD b/testing/go-dkim/APKBUILD
new file mode 100644
index 0000000000..0a79c64daf
--- /dev/null
+++ b/testing/go-dkim/APKBUILD
@@ -0,0 +1,42 @@
+# Maintainer: Drew DeVault <sir@cmpwn.com>
+pkgname=go-dkim
+pkgver=0.3.0
+pkgrel=0
+pkgdesc="DKIM verification tool & milter"
+url="https://github.com/emersion/go-dkim"
+arch="all"
+license="MIT"
+makedepends="go"
+source="
+	$pkgname-$pkgver.tar.gz::https://github.com/emersion/$pkgname/archive/v$pkgver.tar.gz
+	dkim-milter.initd
+	dkim-milter.confd
+	"
+install="$pkgname.post-install"
+subpackages="$pkgname-openrc"
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+	cd "$builddir"
+	go build -o dkim-milter cmd/dkim-milter/main.go
+	go build -o dkim-verify cmd/dkim-verify/main.go
+}
+
+check() {
+	cd "$builddir"
+	go test ./...
+}
+
+package() {
+	cd "$builddir"
+	install -Dm755 dkim-milter "$pkgdir"/usr/bin/dkim-milter
+	install -Dm755 dkim-verify "$pkgdir"/usr/bin/dkim-verify
+	install -Dm755 "$srcdir"/dkim-milter.initd \
+		"$pkgdir"/etc/init.d/dkim-milter
+	install -Dm644 "$srcdir"/dkim-milter.confd \
+		"$pkgdir"/etc/conf.d/dkim-milter
+}
+
+sha512sums="bb25ae9e7f3d3db397132b8149a9014a4f76d036352df4a0184dfdf1481052373a4e6208023073b6401806dedeca2fcd560f1ccd738c6fd49b166ccb8471a198  go-dkim-0.3.0.tar.gz
+cbf39406c1f0d0eb6d1d213381d05a5eea5cf19fb6b19ed5e3ac9b2f64b8393ef3a3652a6aac34c5109e9c95930fca205db332b8e8a254811c6cd93e10df6a64  dkim-milter.initd
+24b3d0756e6a2ee741361c224f9064980802f72ca35f402ca0c185ee8dcbd0beaea68f5b9fd86f06c697674b4c752aea45945dd128e98ff97d44f229ba428101  dkim-milter.confd"
diff --git a/testing/go-dkim/dkim-milter.confd b/testing/go-dkim/dkim-milter.confd
new file mode 100644
index 0000000000..a5d9a95280
--- /dev/null
+++ b/testing/go-dkim/dkim-milter.confd
@@ -0,0 +1,16 @@
+# DKIM milter OpenRC configuration
+# 
+
+# Specify the identity of the DKIM server, to be added in the
+# Authentication-Results header. Defaults to hostname.
+#
+#identity="mail.example.org"
+
+# The user & group to run the dkim-milter daemon as.
+# 
+#dkim_user="dkim"
+#dkim_group="dkim"
+
+# The socket to listen for milter messages on.
+#
+#dkim_listen="unix:///tmp/dkim-milter.sock"
diff --git a/testing/go-dkim/dkim-milter.initd b/testing/go-dkim/dkim-milter.initd
new file mode 100644
index 0000000000..72b1faa0fc
--- /dev/null
+++ b/testing/go-dkim/dkim-milter.initd
@@ -0,0 +1,46 @@
+#!/sbin/openrc-run
+name=dkim-milter
+
+: ${user:=dkim}
+: ${group:=dkim}
+: ${identity:=$(hostname)}
+: ${socket:=/run/dkim-milter/milter.sock}
+: ${listen:=unix://$socket}
+
+command="/usr/bin/$name"
+command_background="yes"
+pidfile="/run/$name.pid"
+
+depend() {
+	need net
+	before mta
+	after firewall
+}
+
+start_pre() {
+	if [ "$listen" = "unix://$socket" ]
+	then
+		checkpath -d -o "$user:$group" "${socket%/*}"
+	fi
+}
+
+start() {
+	ebegin "Starting $name"
+	start-stop-daemon --start \
+		--background \
+		--umask 002 \
+		--user "$user" \
+		--group "$group" \
+		--exec "$command" \
+		--pidfile "$pidfile" \
+		-- -i "$identity" -l "$listen"
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping $name"
+	start-stop-daemon --stop \
+		--exec "$command" \
+		--pidfile "$pidfile"
+	eend $?
+}
diff --git a/testing/go-dkim/go-dkim.post-install b/testing/go-dkim/go-dkim.post-install
new file mode 100644
index 0000000000..3b8dc74a50
--- /dev/null
+++ b/testing/go-dkim/go-dkim.post-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+addgroup -S dkim || true
+adduser -SDH -s /sbin/nologin -g dkim dkim || true
-- 
2.21.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Leonardo
Details
Message ID
<5e42d736-364b-2984-6562-378a40836c2f@gmail.com>
In-Reply-To
<20190312002211.10110-1-sir@cmpwn.com> (view parent)
Sender timestamp
1554296158
DKIM signature
missing
Download raw message
Hi,

On 3/12/19 1:22 AM, Drew DeVault wrote:
> ---
> I'm not great at openrc scripts, feedback welcome.

it looks good to me. You can avoid writing start() and stop() functions 
using "command_args" and "start_stop_daemon_args" to pass custom options.

>
>   testing/go-dkim/APKBUILD             | 42 +++++++++++++++++++++++++
>   testing/go-dkim/dkim-milter.confd    | 16 ++++++++++
>   testing/go-dkim/dkim-milter.initd    | 46 ++++++++++++++++++++++++++++
>   testing/go-dkim/go-dkim.post-install |  3 ++
>   4 files changed, 107 insertions(+)
>   create mode 100644 testing/go-dkim/APKBUILD
>   create mode 100644 testing/go-dkim/dkim-milter.confd
>   create mode 100644 testing/go-dkim/dkim-milter.initd
>   create mode 100644 testing/go-dkim/go-dkim.post-install

It seems that the build is not reproducible, since it seems to download 
some dependencies during the build process:

go: downloading github.com/emersion/go-milter 
v0.0.0-20190311184326-c3095a41a6fe
go: downloading github.com/emersion/go-msgauth 
v0.0.0-20190307192406-8646172ce7a5
go: downloading golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2

Am I mistaken?

Thanks!

/eo




---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---