pkgsrc-WIP-changes archive

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

soju: Properly SUBST rc.d file; use sysutils/daemonize



Module Name:	pkgsrc-wip
Committed By:	Iris <iris000%duck.com@localhost>
Pushed By:	iris
Date:		Thu Aug 8 10:07:56 2024 +0000
Changeset:	b3adc4270716b53bba60a7aa5b3b82c27e3e469a

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

Log Message:
soju: Properly SUBST rc.d file; use sysutils/daemonize

Add PKG_USERS_VARS, PKG_GROUPS_VARS
Create /var/log/soju for rc.d service
Use sysutils/daemonize for rc.d service
Properly SUBST rc.d file

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

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 | 21 ++++++++++++---------
 2 files changed, 26 insertions(+), 9 deletions(-)

diffs:
diff --git a/soju/Makefile b/soju/Makefile
index 113146c503..81a08c5ed5 100644
--- a/soju/Makefile
+++ b/soju/Makefile
@@ -29,7 +29,12 @@ SOJU_USER?=		soju
 SOJU_GROUP?=		soju
 PKG_GROUPS=		${SOJU_GROUP}
 PKG_USERS=		${SOJU_USER}:${SOJU_GROUP}
+PKG_GROUPS_VARS+=	SOJU_GROUP
+PKG_USERS_VARS+=	SOJU_USER
 
+FILES_SUBST+=		SOJU_USER=${SOJU_USER}
+
+OWN_DIRS_PERMS+=	${VARBASE}/log/soju ${SOJU_USER} ${SOJU_GROUP} 0750
 OWN_DIRS_PERMS+=	${VARBASE}/lib/soju ${SOJU_USER} ${SOJU_GROUP} 0750
 OWN_DIRS_PERMS+=	${VARBASE}/run/soju ${SOJU_USER} ${SOJU_GROUP} 0700
 
@@ -40,6 +45,15 @@ CONF_FILES=		${PREFIX}/share/examples/soju/config \
 CONF_FILES_PERMS=	/dev/null ${VARBASE}/lib/soju/main.db \
 			${SOJU_USER} ${SOJU_GROUP} 0644
 
+## Including mk/bsd.prefs.mk before lang/go/go-module.mk
+## results in non-working binaries (cf. pkgtools/pkglint/Makefile):
+##	soju: text relocations
+##	soju: Cannot write-enable text segment: Permission denied
+#.include "../../mk/bsd.prefs.mk"
+#.if ${INIT_SYSTEM} == "rc.d"
+#DEPENDS+=		daemonize-[0-9]*:../../sysutils/daemonize
+#.endif
+DEPENDS+=		daemonize-[0-9]*:../../sysutils/daemonize
 RCD_SCRIPTS+=		soju
 
 SUBST_CLASSES+=		man
diff --git a/soju/files/soju.sh b/soju/files/soju.sh
index 02d0c34d4c..b0802c7db6 100644
--- a/soju/files/soju.sh
+++ b/soju/files/soju.sh
@@ -4,23 +4,26 @@
 #
 # 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"
+rcvar=${name}
+pidfile="@VARBASE@/run/${name}.pid"
+procname="@PREFIX@/bin/soju"
+command="@PREFIX@/sbin/daemonize"
+command_args="${command_args} -a"
+command_args="${command_args} -o @VARBASE@/log/soju/stdout.log"
+command_args="${command_args} -e @VARBASE@/log/soju/stderr.log"
+command_args="${command_args} -p ${pidfile}"
+command_args="${command_args} -u @SOJU_USER@"
+command_args="${command_args} ${procname}"
+required_files="@PKG_SYSCONFBASE@/soju/config"
 extra_commands="reload"
 start_precmd=soju_prestart
 
 soju_prestart() {
-	dir="/var/run/soju"
+	dir="@VARBASE@/run/soju"
 	if test ! -d $dir; then
 		/bin/mkdir -p $dir
 		/bin/chmod 0700 $dir


Home | Main Index | Thread Index | Old Index