git: 48a5ea0ff025 - main - net/xapsd: New port: Apple push notifications daemon for dovecot

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Mon, 27 Feb 2023 22:49:40 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=48a5ea0ff025ec13a17e6d299829c7e4f9e388ae

commit 48a5ea0ff025ec13a17e6d299829c7e4f9e388ae
Author:     Henry <PopularMoment@protonmail.com>
AuthorDate: 2023-02-21 18:59:48 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-02-27 22:48:03 +0000

    net/xapsd: New port: Apple push notifications daemon for dovecot
    
    Apple push notification daemon for dovecot.
    
    Together with dovecot-xaps-plugin, this will enable push email
    for iOS devices that talk to your dovecot IMAP server.
    
    WWW: https://github.com/freswa/dovecot-xaps-daemon
    
    Submitter becomes maintainer.  Is already maintainer of other ports.
    
    PR:             269748
    Approved by:    flo (mentor)
    Differential Revision: https://reviews.freebsd.org/D38779
---
 GIDs                     |  2 +-
 UIDs                     |  2 +-
 net/Makefile             |  1 +
 net/xapsd/Makefile       | 50 ++++++++++++++++++++++++++++++++++++++++++
 net/xapsd/distinfo       | 45 ++++++++++++++++++++++++++++++++++++++
 net/xapsd/files/xapsd.in | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
 net/xapsd/pkg-descr      |  4 ++++
 net/xapsd/pkg-message    | 13 +++++++++++
 net/xapsd/pkg-plist      |  2 ++
 9 files changed, 173 insertions(+), 2 deletions(-)

diff --git a/GIDs b/GIDs
index c6882f3386e8..6fc638476d57 100644
--- a/GIDs
+++ b/GIDs
@@ -566,7 +566,7 @@ taskd:*:616:
 # free: 622
 # free: 623
 # free: 624
-# free: 625
+xapsd:*:625:
 # free: 626
 # free: 627
 # free: 628
diff --git a/UIDs b/UIDs
index 7326744a45a4..dc3ac10d4abc 100644
--- a/UIDs
+++ b/UIDs
@@ -571,7 +571,7 @@ taskd:*:616:616::0:0:taskd user:/nonexistent:/usr/sbin/nologin
 # free: 622
 # free: 623
 # free: 624
-# free: 625
+xapsd:*:625:625::0:0:xapsd:/var/lib/xapsd:/usr/sbin/nologin
 # free: 626
 # free: 627
 # free: 628
diff --git a/net/Makefile b/net/Makefile
index 5e9c23a1be6d..e08636721161 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1600,6 +1600,7 @@
     SUBDIR += x11vnc
     SUBDIR += x2goclient
     SUBDIR += x2goclient-cli
+    SUBDIR += xapsd
     SUBDIR += xisp
     SUBDIR += xmlrpc-c
     SUBDIR += xmlrpc-epi
diff --git a/net/xapsd/Makefile b/net/xapsd/Makefile
new file mode 100644
index 000000000000..510c5b6cbfd1
--- /dev/null
+++ b/net/xapsd/Makefile
@@ -0,0 +1,50 @@
+PORTNAME=	xapsd
+DISTVERSION=	g20230220
+CATEGORIES=	net
+
+MAINTAINER=	PopularMoment@protonmail.com
+COMMENT=	Apple push notifications daemon for dovecot
+WWW=		https://github.com/freswa/dovecot-xaps-daemon
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		go:modules
+USE_RC_SUBR=	xapsd
+USE_GITHUB=	yes
+GH_ACCOUNT=	freswa
+GH_PROJECT=	dovecot-xaps-daemon
+GH_TAGNAME=	e579559
+
+GH_TUPLE=	freswa:go-plist:900e8a7d907d:freswa_go_plist/vendor/github.com/freswa/go-plist \
+		fsnotify:fsnotify:v1.6.0:fsnotify_fsnotify/vendor/github.com/fsnotify/fsnotify \
+		go-ini:ini:v1.67.0:go_ini_ini/vendor/gopkg.in/ini.v1 \
+		go-yaml:yaml:v3.0.1:go_yaml_yaml/vendor/gopkg.in/yaml.v3 \
+		golang-jwt:jwt:v4.5.0:golang_jwt_jwt_v4/vendor/github.com/golang-jwt/jwt/v4 \
+		golang:net:v0.7.0:golang_net/vendor/golang.org/x/net \
+		golang:sys:v0.5.0:golang_sys/vendor/golang.org/x/sys \
+		golang:text:v0.7.0:golang_text/vendor/golang.org/x/text \
+		hashicorp:hcl:v1.0.0:hashicorp_hcl/vendor/github.com/hashicorp/hcl \
+		julienschmidt:httprouter:v1.3.0:julienschmidt_httprouter/vendor/github.com/julienschmidt/httprouter \
+		magiconair:properties:v1.8.7:magiconair_properties/vendor/github.com/magiconair/properties \
+		mitchellh:mapstructure:v1.5.0:mitchellh_mapstructure/vendor/github.com/mitchellh/mapstructure \
+		pelletier:go-toml:v2.0.6:pelletier_go_toml_v2/vendor/github.com/pelletier/go-toml/v2 \
+		sideshow:apns2:v0.23.0:sideshow_apns2/vendor/github.com/sideshow/apns2 \
+		sirupsen:logrus:v1.9.0:sirupsen_logrus/vendor/github.com/sirupsen/logrus \
+		spf13:afero:v1.9.3:spf13_afero/vendor/github.com/spf13/afero \
+		spf13:cast:v1.5.0:spf13_cast/vendor/github.com/spf13/cast \
+		spf13:jwalterweatherman:v1.1.0:spf13_jwalterweatherman/vendor/github.com/spf13/jwalterweatherman \
+		spf13:pflag:v1.0.5:spf13_pflag/vendor/github.com/spf13/pflag \
+		spf13:viper:v1.15.0:spf13_viper/vendor/github.com/spf13/viper \
+		subosito:gotenv:v1.4.2:subosito_gotenv/vendor/github.com/subosito/gotenv
+
+GO_TARGET=	./cmd/xapsd:${PREFIX}/sbin/xapsd
+
+USERS=		${PORTNAME}
+GROUPS=		${PORTNAME}
+
+post-install:
+		${MKDIR} ${STAGEDIR}${PREFIX}/etc/xapsd
+		${INSTALL_DATA} ${WRKSRC}/configs/xapsd/xapsd.yaml ${STAGEDIR}${PREFIX}/etc/xapsd/xapsd.yaml.sample
+
+.include <bsd.port.mk>
diff --git a/net/xapsd/distinfo b/net/xapsd/distinfo
new file mode 100644
index 000000000000..85cbe759d4ea
--- /dev/null
+++ b/net/xapsd/distinfo
@@ -0,0 +1,45 @@
+TIMESTAMP = 1677259042
+SHA256 (freswa-dovecot-xaps-daemon-g20230220-e579559_GH0.tar.gz) = 09da26b0a9b3b4f108f5d2f10f490956487b5f5c03cfb35e48a1bbbbf5c0f247
+SIZE (freswa-dovecot-xaps-daemon-g20230220-e579559_GH0.tar.gz) = 81287
+SHA256 (freswa-go-plist-900e8a7d907d_GH0.tar.gz) = 2b4a06b8805bc1436ab8f34d6fd140645a0a01ccaf9f4b3a7dc3e0e35f5a2e88
+SIZE (freswa-go-plist-900e8a7d907d_GH0.tar.gz) = 47675
+SHA256 (fsnotify-fsnotify-v1.6.0_GH0.tar.gz) = 583b2b399709d04807c5c3185e7d4dc0543d532af91fdeb85eeaf803a0b7703b
+SIZE (fsnotify-fsnotify-v1.6.0_GH0.tar.gz) = 46044
+SHA256 (go-ini-ini-v1.67.0_GH0.tar.gz) = 06ba51234140118d1b6064f1817aa89cc971c6e7ce04cb9d286e6660d89296c8
+SIZE (go-ini-ini-v1.67.0_GH0.tar.gz) = 53531
+SHA256 (go-yaml-yaml-v3.0.1_GH0.tar.gz) = cf05411540d3e6ef8f1fd88434b34f94cedaceb540329031d80e23b74540c4e5
+SIZE (go-yaml-yaml-v3.0.1_GH0.tar.gz) = 91173
+SHA256 (golang-jwt-jwt-v4.5.0_GH0.tar.gz) = 00b1cc127cba09b4e4ea9efa5c0f18a36bb55e08b5eec0a222b8e1599a938077
+SIZE (golang-jwt-jwt-v4.5.0_GH0.tar.gz) = 53049
+SHA256 (golang-net-v0.7.0_GH0.tar.gz) = 4949a0dbdd3c200c8681c18bebd65c8e8b620470189361dac05c89c714d9a59b
+SIZE (golang-net-v0.7.0_GH0.tar.gz) = 1241017
+SHA256 (golang-sys-v0.5.0_GH0.tar.gz) = 810c8f1b7704674971ab6b2b614aba20a5a1765018fd2c639f528dbbcbf88b1f
+SIZE (golang-sys-v0.5.0_GH0.tar.gz) = 1429723
+SHA256 (golang-text-v0.7.0_GH0.tar.gz) = a37dfe82c39f84c57a083da9725dd1bdae59cff6a5cbca3ae4443e446b4a70b8
+SIZE (golang-text-v0.7.0_GH0.tar.gz) = 8361947
+SHA256 (hashicorp-hcl-v1.0.0_GH0.tar.gz) = 50632428210503070fd2fde748c88b7414bf84a6a0eadebf9d8e596a033bead2
+SIZE (hashicorp-hcl-v1.0.0_GH0.tar.gz) = 70658
+SHA256 (julienschmidt-httprouter-v1.3.0_GH0.tar.gz) = 2999dffc23f8ac3872ea37d108ddec0ba570d2780a42876300bdcdb0744908e2
+SIZE (julienschmidt-httprouter-v1.3.0_GH0.tar.gz) = 23889
+SHA256 (magiconair-properties-v1.8.7_GH0.tar.gz) = 09e950df1970975400edc7f6c2f9e3edace4e1ea49f823006387d130fb0f4f03
+SIZE (magiconair-properties-v1.8.7_GH0.tar.gz) = 31425
+SHA256 (mitchellh-mapstructure-v1.5.0_GH0.tar.gz) = 81106cbac93000812c194b4a2069dd32913ec18819b1e99e8436595ce4939413
+SIZE (mitchellh-mapstructure-v1.5.0_GH0.tar.gz) = 30123
+SHA256 (pelletier-go-toml-v2.0.6_GH0.tar.gz) = 90c77524503d123f3a6b64b7dce02d7d94769bd9e05e024b622f63533b00dc5f
+SIZE (pelletier-go-toml-v2.0.6_GH0.tar.gz) = 891667
+SHA256 (sideshow-apns2-v0.23.0_GH0.tar.gz) = 5ad9b2fb211ac9ae9040e09ba5b3b2c74189826e778f874b99aeb174ad22a1ea
+SIZE (sideshow-apns2-v0.23.0_GH0.tar.gz) = 1264203
+SHA256 (sirupsen-logrus-v1.9.0_GH0.tar.gz) = 12446ed9eb96573c2aae4df2db81900a65bfd21d2ce92efde7201614e42134f7
+SIZE (sirupsen-logrus-v1.9.0_GH0.tar.gz) = 49098
+SHA256 (spf13-afero-v1.9.3_GH0.tar.gz) = 3674636a77f5c7c50de561e2b0e9237b3c7fee902ee66cea4adfb5a83da44891
+SIZE (spf13-afero-v1.9.3_GH0.tar.gz) = 93759
+SHA256 (spf13-cast-v1.5.0_GH0.tar.gz) = b5bf72b468a9a9a0509b7d87c984a9b2e653c9b87e9842da385f81c43bd05b9a
+SIZE (spf13-cast-v1.5.0_GH0.tar.gz) = 15287
+SHA256 (spf13-jwalterweatherman-v1.1.0_GH0.tar.gz) = 4fd850a792c5738954c4801cf549d8d0bf53edd17139cd39d179aa5abf7ec68d
+SIZE (spf13-jwalterweatherman-v1.1.0_GH0.tar.gz) = 6871
+SHA256 (spf13-pflag-v1.0.5_GH0.tar.gz) = 9a2cae1f8e8ab0d2cc8ebe468e871af28d9ac0962cf0520999e3ba85f0c7b808
+SIZE (spf13-pflag-v1.0.5_GH0.tar.gz) = 50796
+SHA256 (spf13-viper-v1.15.0_GH0.tar.gz) = bda7c50e3619ac0524425cfd1b797a1c260fd860147eddeea138437d95d83add
+SIZE (spf13-viper-v1.15.0_GH0.tar.gz) = 131720
+SHA256 (subosito-gotenv-v1.4.2_GH0.tar.gz) = b7bafced91bfb64f2f80a78b7c343f0a16099aa0a4049ea6e4d0fa5d62be1741
+SIZE (subosito-gotenv-v1.4.2_GH0.tar.gz) = 10641
diff --git a/net/xapsd/files/xapsd.in b/net/xapsd/files/xapsd.in
new file mode 100644
index 000000000000..df8deac4e369
--- /dev/null
+++ b/net/xapsd/files/xapsd.in
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# PROVIDE: xapsd
+# REQUIRE: DAEMON NETWORKING
+# BEFORE: mail
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf.local, /etc/rc.conf or
+# /etc/rc.conf.d/xapsd to enable this service:
+#
+#  xapsd_enable (bool):	        Set to NO by default.
+#                               Set it to "YES" to enable xapsd.
+#  xapsd_flags (str):		Optional extra flags to pass.
+#                               Empty by default.
+#  xapsd_user (string):         User to run xapsd as
+#                               Set to "xapsd" by default.
+#  xapsd_group (string):        Group to run xapsd as
+#                               Set to "xapsd" by default.
+
+. /etc/rc.subr
+
+name=xapsd
+rcvar=xapsd_enable
+start_precmd="${name}_precmd"
+
+load_rc_config $name
+
+: ${xapsd_enable:="NO"}
+: ${xapsd_flags:=""}
+: ${xapsd_user:="xapsd"}
+: ${xapsd_group:="xapsd"}
+
+pidfile="/var/run/${name}/${name}.pid"
+procname="%%PREFIX%%/sbin/${name}"
+command="/usr/sbin/daemon"
+command_args="-m 3 -t ${name} -T ${name} -p ${pidfile} -c -f -S -u ${xapsd_user} ${procname} -configPath %%PREFIX%%/etc/xapsd ${xapsd_flags}"
+
+required_files=%%PREFIX%%/etc/xapsd/xapsd.yaml
+
+start_cmd=xapsd_start
+
+xapsd_precmd() {
+	/usr/bin/install -d -m 0755 -o ${xapsd_user} /var/run/${name}
+	dbdir=$(/usr/bin/dirname `awk '/^databaseFile/ {print $2}' %%PREFIX%%/etc/xapsd/xapsd.yaml`)
+	if [ ! -d ${dbdir} ]; then
+		install -d -o ${xapsd_user} -g ${xapsd_group} ${dbdir};
+	fi
+}
+
+xapsd_start() {
+	echo "Starting xapsd."
+	umask 007
+	${command} ${command_args}
+}
+
+run_rc_command "$1"
diff --git a/net/xapsd/pkg-descr b/net/xapsd/pkg-descr
new file mode 100644
index 000000000000..c6dc3d513edd
--- /dev/null
+++ b/net/xapsd/pkg-descr
@@ -0,0 +1,4 @@
+Apple push notification daemon for dovecot.
+
+Together with dovecot-xaps-plugin, this will enable push email
+for iOS devices that talk to your dovecot IMAP server.
diff --git a/net/xapsd/pkg-message b/net/xapsd/pkg-message
new file mode 100644
index 000000000000..ca0440d8d009
--- /dev/null
+++ b/net/xapsd/pkg-message
@@ -0,0 +1,13 @@
+[
+{ type: install
+  message: <<EOM
+
+1. Create a new apple id account at https://appleid.apple.com/
+
+2. Use `xapsd -pass` to create the hash of the apple id password
+
+3. Add account information to xapsd.yaml
+
+EOM
+}
+]
diff --git a/net/xapsd/pkg-plist b/net/xapsd/pkg-plist
new file mode 100644
index 000000000000..1fbd41224c17
--- /dev/null
+++ b/net/xapsd/pkg-plist
@@ -0,0 +1,2 @@
+@sample(root,xapsd,640) etc/xapsd/xapsd.yaml.sample
+sbin/xapsd