git: 6fad55550cbc - main - audio/hpsjam: Add rc.d file for starting HpsJam server similar to Jamulus.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Tue, 15 Nov 2022 09:58:42 UTC
The branch main has been updated by hselasky:

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

commit 6fad55550cbc4e851bd06ca4f58b1a727d9ec7d5
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-11-15 09:53:34 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-11-15 09:58:11 +0000

    audio/hpsjam: Add rc.d file for starting HpsJam server similar to Jamulus.
    
    Approved by:    pi (implicit)
---
 audio/hpsjam/Makefile               |  5 +++++
 audio/hpsjam/files/hpsjam_server.in | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/audio/hpsjam/Makefile b/audio/hpsjam/Makefile
index e73f33c4d587..604108589ff8 100644
--- a/audio/hpsjam/Makefile
+++ b/audio/hpsjam/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	hpsjam
 DISTVERSIONPREFIX=	v
 DISTVERSION=		1.2.6
+PORTREVISION=		1
 CATEGORIES=	audio
 
 MAINTAINER=	hselasky@FreeBSD.org
@@ -20,6 +21,10 @@ USE_GITHUB=	yes
 GH_ACCOUNT=	hselasky
 GH_TUPLE=	mborgerding:kissfft:131.1.0:a/kissfft
 
+USER=           nobody
+SUB_LIST=       USER=${USER}
+USE_RC_SUBR=    ${PORTNAME}_server
+
 PLIST_FILES= \
 	bin/HpsJam \
 	share/pixmaps/HpsJam.png \
diff --git a/audio/hpsjam/files/hpsjam_server.in b/audio/hpsjam/files/hpsjam_server.in
new file mode 100644
index 000000000000..e96f569ad279
--- /dev/null
+++ b/audio/hpsjam/files/hpsjam_server.in
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# PROVIDE: hpsjam_server
+# REQUIRE: DAEMON NETWORKING
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf to enable hpsjam_server:
+# hpsjam_server_enable   : set to "YES" to enable the daemon, default is "NO"
+# hpsjam_server_uname    : user to run hpsjam_server as, default is "%%USER%%"
+# hpsjam_server_flags    : extra flags to pass to daemon(8), default is ""
+# hpsjam_server_args     : any arguments to pass to hpsjam_server, default is ""
+#
+# See output from HpsJam --help for more options
+#
+
+. /etc/rc.subr
+
+name=hpsjam_server
+rcvar=hpsjam_server_enable
+
+load_rc_config $name
+
+hpsjam_server_enable=${hpsjam_server_enable:-"NO"}
+hpsjam_server_uname=${hpsjam_server_uname:-"%%USER%%"}
+hpsjam_server_flags=${hpsjam_server_flags:-""}
+hpsjam_server_args=${hpsjam_server_args:-""}
+
+logfile="/var/log/${name}.log"
+
+procname=%%PREFIX%%/bin/HpsJam
+command="/usr/sbin/daemon"
+command_args="-u ${hpsjam_server_uname} -o ${logfile} -t ${name} ${procname} --server ${hpsjam_server_args}"
+
+run_rc_command "$1"