pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

soju: Makefile: soju user, /var/{lib,run}/soju, rc.d script



Module Name:	pkgsrc-wip
Committed By:	Iris <iris000%duck.com@localhost>
Pushed By:	iris
Date:		Tue Aug 6 10:59:40 2024 +0000
Changeset:	43578d596d354b5166f5be106e7c8f145130f780

Modified Files:
	soju/Makefile
Added Files:
	soju/files/soju.sh

Log Message:
soju: Makefile: soju user, /var/{lib,run}/soju, rc.d script

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=43578d596d354b5166f5be106e7c8f145130f780

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 soju/Makefile      | 14 ++++++++++++--
 soju/files/soju.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 2 deletions(-)

diffs:
diff --git a/soju/Makefile b/soju/Makefile
index 6eb9438439..b6c7e10207 100644
--- a/soju/Makefile
+++ b/soju/Makefile
@@ -14,7 +14,7 @@ SUBST_CLASSES+=		man
 SUBST_STAGE.man=	post-build
 SUBST_MESSAGE.man=	Fixing /run path in man page
 SUBST_FILES.man=	doc/soju.1.scd
-SUBST_SED.man=		-e 's;/run/soju/admin;${VARBASE}/run/soju.sock;g'
+SUBST_SED.man=		-e 's;/run/soju/admin;${VARBASE}/run/soju/admin;g'
 
 TOOL_DEPENDS+=	scdoc>=0:../../textproc/scdoc
 
@@ -22,17 +22,27 @@ BUILD_DEFS+=	VARBASE
 
 GO_BUILD_PATTERN+=	-ldflags ' \
 			-X codeberg.org/emersion/soju/config.DefaultPath=${PKG_SYSCONFDIR}/config \
-			-X codeberg.org/emersion/soju/config.DefaultUnixAdminPath=${VARBASE}/run/soju.sock'
+			-X codeberg.org/emersion/soju/config.DefaultUnixAdminPath=${VARBASE}/run/soju/admin'
 GO_BUILD_PATTERN+=	./cmd/soju ./cmd/sojuctl ./cmd/sojudb \
 			./contrib/migrate-db ./contrib/migrate-logs \
 			./contrib/znc-import
 
 INSTALLATION_DIRS+=	bin ${PKGMANDIR}/man1 ${PREFIX}/share/examples/soju
 
+SOJU_USER?=		soju
+SOJU_GROUP?=		soju
+PKG_GROUPS=		${SOJU_GROUP}
+PKG_USERS=		${SOJU_USER}:${SOJU_GROUP}
+
+OWN_DIRS_PERMS+=	${VARBASE}/lib/soju ${SOJU_USER} ${SOJU_GROUP} 0750
+OWN_DIRS_PERMS+=	${VARBASE}/run/soju ${SOJU_USER} ${SOJU_GROUP} 0700
+
 PKG_SYSCONFSUBDIR=	soju
 CONF_FILES=		${PREFIX}/share/examples/soju/config \
 			${PKG_SYSCONFDIR}/config
 
+RCD_SCRIPTS+=		soju
+
 do-install:
 	${INSTALL_PROGRAM} ${WRKDIR}/.gopath/bin/soju ${DESTDIR}${PREFIX}/bin
 	${INSTALL_PROGRAM} ${WRKDIR}/.gopath/bin/sojuctl ${DESTDIR}${PREFIX}/bin
diff --git a/soju/files/soju.sh b/soju/files/soju.sh
new file mode 100644
index 0000000000..02d0c34d4c
--- /dev/null
+++ b/soju/files/soju.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# $NetBSD$
+#
+# PROVIDE: soju
+# REQUIRE: DAEMON
+#
+# The following lines should be added to /etc/rc.conf:
+#
+# soju=YES
+# soju_user="soju"
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="soju"
+rcvar=$name
+command="/usr/pkg/bin/soju"
+required_files="/usr/pkg/etc/soju/config"
+extra_commands="reload"
+start_precmd=soju_prestart
+
+soju_prestart() {
+	dir="/var/run/soju"
+	if test ! -d $dir; then
+		/bin/mkdir -p $dir
+		/bin/chmod 0700 $dir
+		/usr/sbin/chown soju:soju $dir
+	fi
+}
+
+load_rc_config $name
+run_rc_command "$1"


Home | Main Index | Thread Index | Old Index