git: f58c457a7794 - main - irc/soju: Update to 0.6.1

From: Ashish SHUKLA <ashish_at_FreeBSD.org>
Date: Sun, 28 May 2023 15:01:58 UTC
The branch main has been updated by ashish:

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

commit f58c457a779464a0911dffcb735fc7edde25191c
Author:     Ashish SHUKLA <ashish@FreeBSD.org>
AuthorDate: 2023-05-28 04:15:29 +0000
Commit:     Ashish SHUKLA <ashish@FreeBSD.org>
CommitDate: 2023-05-28 14:59:30 +0000

    irc/soju: Update to 0.6.1
    
    - Switch to using upstream Makefile
    - Add rc.d script
    - Specify a user/group
    - Purge patches which don't apply anymore
    
    PR:             271388
---
 GIDs                                    |   2 +-
 UIDs                                    |   2 +-
 irc/soju/Makefile                       |  57 ++++++++++-----
 irc/soju/distinfo                       |  14 ++--
 irc/soju/files/patch-go.mod             |  43 ------------
 irc/soju/files/patch-go.sum             |  38 ----------
 irc/soju/files/patch-vendor_modules.txt | 119 --------------------------------
 irc/soju/files/soju.in                  |  32 +++++++++
 8 files changed, 81 insertions(+), 226 deletions(-)

diff --git a/GIDs b/GIDs
index 141ef8ef9ffd..8b150392a8f7 100644
--- a/GIDs
+++ b/GIDs
@@ -263,7 +263,7 @@ rustdesk:*:319:
 teleirc:*:320:
 caldera:*:321:
 tlsc:*:322:
-# free: 323
+soju:*:323:
 # free: 324
 dkfilter:*:325:
 smfs:*:326:
diff --git a/UIDs b/UIDs
index caedab37601e..468b6a0ba4b9 100644
--- a/UIDs
+++ b/UIDs
@@ -268,7 +268,7 @@ rustdesk:*:319:319::0:0:rustdesk-server user:/nonexistent:/usr/sbin/nologin
 teleirc:*:320:320::0:0:Telegram and IRC bridge:/nonexistent:/usr/sbin/nologin
 caldera:*:321:321::0:0:Caldera Mitre user:/nonexistent:/usr/sbin/nologin
 tlsc:*:322:322::0:0:TLS connect daemon:/nonexistent:/usr/sbin/nologin
-# free: 323
+soju:*:323:323::0:0:soju:/nonexistent:/usr/sbin/nologin
 # free: 324
 dkfilter:*:325:325::0:0:DK Filter Owner:/nonexistent:/usr/sbin/nologin
 smfs:*:326:326::0:0:SMFSAV Owner:/nonexistent:/usr/sbin/nologin
diff --git a/irc/soju/Makefile b/irc/soju/Makefile
index 6a6dc9c4dfd6..e34e793ebe68 100644
--- a/irc/soju/Makefile
+++ b/irc/soju/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	soju
 DISTVERSIONPREFIX=	v
-DISTVERSION=	0.5.2
-PORTREVISION=	8
+DISTVERSION=	0.6.1
 CATEGORIES=	irc
 
 MAINTAINER=	ashish@FreeBSD.org
@@ -11,38 +10,62 @@ WWW=		https://soju.im
 LICENSE=	AGPLv3
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-USES=		go:modules sqlite:3
+USES=		go:modules,no_targets sqlite:3
 USE_GITHUB=	nodefault
 GH_TUPLE=	golang:sys:v0.6.0:sys
 
 OPTIONS_DEFAULT=	DOCS
 OPTIONS_DEFINE=		DOCS
 
+USERS=			soju
+GROUPS=			soju
+SUB_LIST=		USER=${USERS}
+USE_RC_SUBR=		${PORTNAME}
 GO_BUILDFLAGS+=	-tags=libsqlite3
-CGO_LDFLAGS+=	-lsqlite3
-GO_MODULE=	git.sr.ht/~emersion/soju
-GO_PKGNAME=	./cmd/soju ./cmd/sojuctl ./contrib/znc-import
-PLIST_FILES=	bin/soju \
-		bin/sojuctl \
-		bin/soju-znc-import \
-		${DOCSDIR_REL}/getting-started.md
-
+CGO_LDFLAGS+=		-lsqlite3
+GO_MODULE=		git.sr.ht/~emersion/soju
+CONTRIBS=		./contrib/znc-import ./contrib/migrate-db \
+			./contrib/migrate-logs
+MAKE_ENV+=		${GO_ENV} \
+			MANDIR=man \
+			PREFIX=${PREFIX} \
+			RUNDIR=/var/run \
+			SYSCONFDIR=${ETCDIR}/..
+PLIST_FILES=		${CONTRIBS:T:C/^/bin\/soju-/g} \
+			${DOCSDIR_REL}/getting-started.md \
+			"@sample ${ETCDIR_REL}/config.sample" \
+			"@dir(${USERS},${GROUPS},0711) /var/db/soju" \
+			bin/soju \
+			bin/sojuctl \
+			bin/sojudb
 DOCS_BUILD_DEPENDS=	scdoc:textproc/scdoc
 DOCS_PLIST_FILES=	man/man1/soju.1.gz \
+			man/man1/sojuctl.1.gz
 
 pre-patch:
 	${RM} -r ${WRKSRC}/vendor/golang.org/x/sys
 	${LN} -s ${WRKDIR}/sys-* ${WRKSRC}/vendor/golang.org/x/sys
 
-post-build-DOCS-on:
-	${LOCALBASE}/bin/scdoc <${WRKSRC}/doc/${PORTNAME}.1.scd >${WRKSRC}/doc/${PORTNAME}.1
+post-patch:
+	@${REINPLACE_CMD} -r -e 's,/var/lib/soju,/var/db/soju,g' \
+		${WRKSRC}/config.in
+	@${REINPLACE_CMD} -r -e 's,[$$]\(([^)]+)\),$${\1},g' \
+		-e 's,(/cmd/sojuctl)$$,\1 ${CONTRIBS},' \
+		-e '/^config_path/s,=.*$$,= ${ETCDIR}/config,' \
+		-e '/^commands/s,$$, ${CONTRIBS:T},' \
+		-e '/^sojudb/s,^,${CONTRIBS:T} ,' \
+		-e '/^\.PHONY/s,$$, ${CONTRIBS:T},' \
+		-e '/^sharedstatedir/s,/var/lib,/var/db,' ${WRKSRC}/Makefile
+
+post-patch-DOCS-off:
+	@${REINPLACE_CMD} -e 's,[$$]{man_pages},,' -e '/man1$$/d' ${WRKSRC}/Makefile
 
 post-install:
 	${MKDIR} ${STAGEDIR}${DOCSDIR}
-	${MV} ${STAGEDIR}${PREFIX}/bin/znc-import ${STAGEDIR}${PREFIX}/bin/soju-znc-import
 	${INSTALL_MAN} ${WRKSRC}/doc/getting-started.md ${STAGEDIR}${DOCSDIR}
-
-post-install-DOCS-on:
-	${INSTALL_MAN} ${WRKSRC}/doc/${PORTNAME}.1 ${STAGEDIR}${PREFIX}/man/man1
+.for EXE in ${CONTRIBS:T}
+	${MV} ${STAGEDIR}${PREFIX}/bin/${EXE} ${STAGEDIR}${PREFIX}/bin/soju-${EXE}
+.endfor
+	${MV} ${STAGEDIR}${ETCDIR}/config ${STAGEDIR}${ETCDIR}/config.sample
 
 .include <bsd.port.mk>
diff --git a/irc/soju/distinfo b/irc/soju/distinfo
index 1ae35e5fd797..79517fabd118 100644
--- a/irc/soju/distinfo
+++ b/irc/soju/distinfo
@@ -1,7 +1,7 @@
-TIMESTAMP = 1679708642
-SHA256 (go/irc_soju/soju-v0.5.2/v0.5.2.mod) = df14df99d21c43fb592a5be28ac8751c8a967b17c53488ad281a00c5b4f3d4bb
-SIZE (go/irc_soju/soju-v0.5.2/v0.5.2.mod) = 883
-SHA256 (go/irc_soju/soju-v0.5.2/v0.5.2.zip) = 4e1a0fb83e42c7a86f6121d51468fc3c9d0ae195a6d785501611ea20e9ad694d
-SIZE (go/irc_soju/soju-v0.5.2/v0.5.2.zip) = 166549
-SHA256 (go/irc_soju/soju-v0.5.2/golang-sys-v0.6.0_GH0.tar.gz) = b4f6d17c7a128f76169964b437cb66b3f2dbf9a33361928ec19dfecf7b03fc54
-SIZE (go/irc_soju/soju-v0.5.2/golang-sys-v0.6.0_GH0.tar.gz) = 1434234
+TIMESTAMP = 1684747647
+SHA256 (go/irc_soju/soju-v0.6.1/v0.6.1.mod) = cc7b31aaa68731f05deeeda682dbba98c927279ccd75b3140e75b2977f360fe0
+SIZE (go/irc_soju/soju-v0.6.1/v0.6.1.mod) = 2050
+SHA256 (go/irc_soju/soju-v0.6.1/v0.6.1.zip) = d565834f4983e1ab8a0b0971a4333820dfc21304fa38002336b29117d9513abf
+SIZE (go/irc_soju/soju-v0.6.1/v0.6.1.zip) = 190111
+SHA256 (go/irc_soju/soju-v0.6.1/golang-sys-v0.6.0_GH0.tar.gz) = b4f6d17c7a128f76169964b437cb66b3f2dbf9a33361928ec19dfecf7b03fc54
+SIZE (go/irc_soju/soju-v0.6.1/golang-sys-v0.6.0_GH0.tar.gz) = 1434234
diff --git a/irc/soju/files/patch-go.mod b/irc/soju/files/patch-go.mod
deleted file mode 100644
index 3fb639ac33f3..000000000000
--- a/irc/soju/files/patch-go.mod
+++ /dev/null
@@ -1,43 +0,0 @@
---- go.mod.orig	2023-03-25 01:47:31 UTC
-+++ go.mod
-@@ -1,23 +1,34 @@
- module git.sr.ht/~emersion/soju
- 
--go 1.15
-+go 1.17
- 
- require (
- 	git.sr.ht/~emersion/go-scfg v0.0.0-20211215104734-c2c7a15d6c99
- 	git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9
- 	github.com/SherClockHolmes/webpush-go v1.2.0
- 	github.com/emersion/go-sasl v0.0.0-20211008083017-0b9dcfb154ac
--	github.com/klauspost/compress v1.15.6 // indirect
- 	github.com/lib/pq v1.10.6
- 	github.com/mattn/go-sqlite3 v1.14.13
- 	github.com/pires/go-proxyproto v0.6.2
- 	github.com/prometheus/client_golang v1.12.2
--	github.com/prometheus/common v0.34.0 // indirect
- 	golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
--	golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d // indirect
--	golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
- 	golang.org/x/time v0.0.0-20220609170525-579cf78fd858
--	google.golang.org/protobuf v1.28.0 // indirect
- 	gopkg.in/irc.v3 v3.1.4
- 	nhooyr.io/websocket v1.8.7
-+)
-+
-+require (
-+	github.com/beorn7/perks v1.0.1 // indirect
-+	github.com/cespare/xxhash/v2 v2.1.2 // indirect
-+	github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
-+	github.com/golang/protobuf v1.5.2 // indirect
-+	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
-+	github.com/klauspost/compress v1.15.6 // indirect
-+	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
-+	github.com/prometheus/client_model v0.2.0 // indirect
-+	github.com/prometheus/common v0.34.0 // indirect
-+	github.com/prometheus/procfs v0.7.3 // indirect
-+	golang.org/x/sys v0.6.0 // indirect
-+	golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
-+	google.golang.org/protobuf v1.28.0 // indirect
- )
diff --git a/irc/soju/files/patch-go.sum b/irc/soju/files/patch-go.sum
deleted file mode 100644
index 121c5dc45f55..000000000000
--- a/irc/soju/files/patch-go.sum
+++ /dev/null
@@ -1,38 +0,0 @@
---- go.sum.orig	2023-03-25 01:47:34 UTC
-+++ go.sum
-@@ -82,7 +82,6 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o
- github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
- github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
- github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
--github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
- github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
- github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
- github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
-@@ -178,10 +177,8 @@ github.com/klauspost/compress v1.15.6/go.mod h1:PhcZ0M
- github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
- github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
- github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
--github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
- github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
- github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
--github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
- github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
- github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
- github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
-@@ -384,6 +381,8 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go
- golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
- golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d h1:Zu/JngovGLVi6t2J3nmAf3AoTDwuzw85YZ3b9o4yU7s=
- golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-+golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
-+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
- golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
- golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
- golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM=
-@@ -525,7 +524,6 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L5
- gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
- gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
--gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
- gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
- gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
- gopkg.in/irc.v3 v3.1.4 h1:DYGMRFbtseXEh+NadmMUFzMraqyuUj4I3iWYFEzDZPc=
diff --git a/irc/soju/files/patch-vendor_modules.txt b/irc/soju/files/patch-vendor_modules.txt
deleted file mode 100644
index d03c655ad319..000000000000
--- a/irc/soju/files/patch-vendor_modules.txt
+++ /dev/null
@@ -1,119 +0,0 @@
---- vendor/modules.txt.orig	2023-03-25 01:48:07 UTC
-+++ vendor/modules.txt
-@@ -1,80 +1,88 @@
- # git.sr.ht/~emersion/go-scfg v0.0.0-20211215104734-c2c7a15d6c99
--## explicit
-+## explicit; go 1.15
- git.sr.ht/~emersion/go-scfg
- # git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9
--## explicit
-+## explicit; go 1.14
- git.sr.ht/~sircmpwn/go-bare
- # github.com/SherClockHolmes/webpush-go v1.2.0
--## explicit
-+## explicit; go 1.13
- github.com/SherClockHolmes/webpush-go
- # github.com/beorn7/perks v1.0.1
-+## explicit; go 1.11
- github.com/beorn7/perks/quantile
- # github.com/cespare/xxhash/v2 v2.1.2
-+## explicit; go 1.11
- github.com/cespare/xxhash/v2
- # github.com/emersion/go-sasl v0.0.0-20211008083017-0b9dcfb154ac
--## explicit
-+## explicit; go 1.12
- github.com/emersion/go-sasl
- # github.com/golang-jwt/jwt v3.2.2+incompatible
-+## explicit
- github.com/golang-jwt/jwt
- # github.com/golang/protobuf v1.5.2
-+## explicit; go 1.9
- github.com/golang/protobuf/proto
- github.com/golang/protobuf/ptypes/timestamp
- # github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
-+## explicit; go 1.13
- github.com/google/shlex
- # github.com/klauspost/compress v1.15.6
--## explicit
-+## explicit; go 1.16
- github.com/klauspost/compress/flate
- # github.com/lib/pq v1.10.6
--## explicit
-+## explicit; go 1.13
- github.com/lib/pq
- github.com/lib/pq/oid
- github.com/lib/pq/scram
- # github.com/mattn/go-sqlite3 v1.14.13
--## explicit
-+## explicit; go 1.12
- github.com/mattn/go-sqlite3
- # github.com/matttproud/golang_protobuf_extensions v1.0.1
-+## explicit
- github.com/matttproud/golang_protobuf_extensions/pbutil
- # github.com/pires/go-proxyproto v0.6.2
--## explicit
-+## explicit; go 1.13
- github.com/pires/go-proxyproto
- # github.com/prometheus/client_golang v1.12.2
--## explicit
-+## explicit; go 1.13
- github.com/prometheus/client_golang/prometheus
- github.com/prometheus/client_golang/prometheus/collectors
- github.com/prometheus/client_golang/prometheus/internal
- github.com/prometheus/client_golang/prometheus/promauto
- github.com/prometheus/client_golang/prometheus/promhttp
- # github.com/prometheus/client_model v0.2.0
-+## explicit; go 1.9
- github.com/prometheus/client_model/go
- # github.com/prometheus/common v0.34.0
--## explicit
-+## explicit; go 1.15
- github.com/prometheus/common/expfmt
- github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
- github.com/prometheus/common/model
- # github.com/prometheus/procfs v0.7.3
-+## explicit; go 1.13
- github.com/prometheus/procfs
- github.com/prometheus/procfs/internal/fs
- github.com/prometheus/procfs/internal/util
- # golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
--## explicit
-+## explicit; go 1.17
- golang.org/x/crypto/bcrypt
- golang.org/x/crypto/blowfish
- golang.org/x/crypto/hkdf
- golang.org/x/crypto/ssh/terminal
--# golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d
--## explicit
-+# golang.org/x/sys v0.6.0
-+## explicit; go 1.17
- golang.org/x/sys/internal/unsafeheader
- golang.org/x/sys/plan9
- golang.org/x/sys/unix
- golang.org/x/sys/windows
- # golang.org/x/term v0.0.0-20220526004731-065cf7ba2467
--## explicit
-+## explicit; go 1.17
- golang.org/x/term
- # golang.org/x/time v0.0.0-20220609170525-579cf78fd858
- ## explicit
- golang.org/x/time/rate
- # google.golang.org/protobuf v1.28.0
--## explicit
-+## explicit; go 1.11
- google.golang.org/protobuf/encoding/prototext
- google.golang.org/protobuf/encoding/protowire
- google.golang.org/protobuf/internal/descfmt
-@@ -104,10 +112,10 @@ google.golang.org/protobuf/runtime/protoimpl
- google.golang.org/protobuf/types/descriptorpb
- google.golang.org/protobuf/types/known/timestamppb
- # gopkg.in/irc.v3 v3.1.4
--## explicit
-+## explicit; go 1.13
- gopkg.in/irc.v3
- # nhooyr.io/websocket v1.8.7
--## explicit
-+## explicit; go 1.13
- nhooyr.io/websocket
- nhooyr.io/websocket/internal/bpool
- nhooyr.io/websocket/internal/errd
diff --git a/irc/soju/files/soju.in b/irc/soju/files/soju.in
new file mode 100644
index 000000000000..f386cb6267d8
--- /dev/null
+++ b/irc/soju/files/soju.in
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+
+# PROVIDE: soju
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add these lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# soju_enable (bool):	Set to NO by default.
+#			Set it to YES to enable soju.
+# soju_config (path):	Set to %%PREFIX%%/etc/soju/config
+#			by default.
+
+. /etc/rc.subr
+
+name="soju"
+rcvar=soju_enable
+desc="Soju IRC bouncer"
+
+: ${soju_enable:=NO}
+: ${soju_config:=%%PREFIX%%/etc/soju/config}
+
+command=/usr/sbin/daemon
+procname="%%PREFIX%%/bin/soju"
+pidfile=/var/run/${name}.pid
+command_args="-P /var/run/daemon_${name}.pid -p $pidfile -u %%USER%% -H -c -f $procname -config ${soju_config}"
+start_precmd="mkdir -p /var/run/soju && chown %%USER%%: /var/run/soju"
+
+load_rc_config $name
+run_rc_command "$1"