pkgsrc-WIP-changes archive

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

libreddit: add rc service file.



Module Name:	pkgsrc-wip
Committed By:	Paolo Vincenzo Olivo <vms%retrobsd.ddns.net@localhost>
Pushed By:	vms
Date:		Sun Feb 12 17:56:25 2023 +0100
Changeset:	4fee9b32f0e1e61c6c29fa83596905ad2c9c860c

Modified Files:
	libreddit/Makefile
	libreddit/PLIST
Added Files:
	libreddit/files/libreddit.conf
	libreddit/files/libreddit.sh

Log Message:
libreddit: add rc service file.

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

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

diffstat:
 libreddit/Makefile             | 11 ++++++++++-
 libreddit/PLIST                |  1 +
 libreddit/files/libreddit.conf |  2 ++
 libreddit/files/libreddit.sh   | 22 ++++++++++++++++++++++
 4 files changed, 35 insertions(+), 1 deletion(-)

diffs:
diff --git a/libreddit/Makefile b/libreddit/Makefile
index 1fd54b4f99..fb3a5550d2 100644
--- a/libreddit/Makefile
+++ b/libreddit/Makefile
@@ -12,7 +12,15 @@ LICENSE=	gnu-agpl-v3
 
 .include "cargo-depends.mk"
 
-INSTALLATION_DIRS=	bin
+DEPENDS+=	daemonize-[0-9]*:../../sysutils/daemonize
+
+RCD_SCRIPTS=	libreddit
+
+EGDIR=		${PREFIX}/share/examples/${PKGBASE}
+CONF_FILES+=	${EGDIR}/libreddit.conf \
+		${PKG_SYSCONFDIR}/libreddit.conf
+
+INSTALLATION_DIRS=	bin share/examples/${PKGBASE}
 
 MAKE_ENV+=	OPENSSL_DIR=${BUILDLINK_PREFIX.openssl:Q}
 RUSTFLAGS+=	-C link-arg=${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.openssl}/lib
@@ -20,6 +28,7 @@ RUSTFLAGS+=	-C link-arg=${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.openssl}/lib
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/target/release/libreddit \
 		${DESTDIR}${PREFIX}/bin
+	${INSTALL_DATA} ${FILESDIR}/libreddit.conf ${DESTDIR}${EGDIR}
 
 .include "../../lang/rust/cargo.mk"
 .include "../../security/openssl/buildlink3.mk"
diff --git a/libreddit/PLIST b/libreddit/PLIST
index 07b0795d94..608923ea16 100644
--- a/libreddit/PLIST
+++ b/libreddit/PLIST
@@ -1,2 +1,3 @@
 @comment $NetBSD$
 bin/libreddit
+share/examples/libreddit/libreddit.conf
diff --git a/libreddit/files/libreddit.conf b/libreddit/files/libreddit.conf
new file mode 100644
index 0000000000..06294ac96b
--- /dev/null
+++ b/libreddit/files/libreddit.conf
@@ -0,0 +1,2 @@
+ADDRESS=0.0.0.0
+PORT=8080
diff --git a/libreddit/files/libreddit.sh b/libreddit/files/libreddit.sh
new file mode 100644
index 0000000000..80d6eb94ac
--- /dev/null
+++ b/libreddit/files/libreddit.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+
+# PROVIDE: LIBREDDIT
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+$_rc_subr_loaded . @SYSCONFBASE@/rc.subr
+. @PKG_SYSCONFDIR@/libreddit.conf
+
+name="libreddit"
+rcvar=${name}
+command="@PREFIX@/bin/${name}"
+command_args="-a ${ADDRESS} -p ${PORT}"
+pidfile="@VARBASE@/run/${name}.pid"
+logfile="@VARBASE@/log/${name}.log"
+required_files="@PKG_SYSCONFDIR@/libreddit.conf"
+
+start_cmd="@PREFIX@/sbin/daemonize -p ${pidfile} -e ${logfile} $command $command_args"
+
+load_rc_config $name
+run_rc_command "$1"


Home | Main Index | Thread Index | Old Index