pkgsrc-WIP-changes archive

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

Add rc.d script for sftpgo



Module Name:	pkgsrc-wip
Committed By:	Bartosz Kuzma <bartosz.kuzma%gmail.com@localhost>
Pushed By:	bartosz.kuzma
Date:		Sat Feb 14 10:44:59 2026 +0100
Changeset:	313cc1876e24af12b6b71fcfe270864ce1a95c26

Modified Files:
	sftpgo/Makefile
	sftpgo/files/sftpgo.sh
Removed Files:
	sftpgo/TODO

Log Message:
Add rc.d script for sftpgo

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

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

diffstat:
 sftpgo/Makefile        |  5 +++++
 sftpgo/TODO            |  1 -
 sftpgo/files/sftpgo.sh | 55 ++++++++++++++++++++++++++++----------------------
 3 files changed, 36 insertions(+), 25 deletions(-)

diffs:
diff --git a/sftpgo/Makefile b/sftpgo/Makefile
index 33ccb7b6c2..7ca0eb1fce 100644
--- a/sftpgo/Makefile
+++ b/sftpgo/Makefile
@@ -16,6 +16,8 @@ EGDIR=			${PREFIX}/share/examples/sftpgo
 USE_LANGUAGES=		c
 USE_TOOLS=		tar
 
+DEPENDS+=		daemonize>=1.7.8:../../sysutils/daemonize
+
 GO_BUILD_PATTERN=
 
 CONF_FILES=		${EGDIR}/sftpgo.json ${PKG_SYSCONFDIR}/sftpgo.json
@@ -43,6 +45,9 @@ SUBST_SED.set-path=	-e 's|"openapi"|"${PREFIX}/share/sftpgo/openapi"|g'
 SUBST_SED.set-path+=	-e 's|"static"|"${PREFIX}/share/sftpgo/static"|g'
 SUBST_SED.set-path+=	-e 's|"templates"|"${PREFIX}/share/sftpgo/templates"|g'
 
+RCD_SCRIPTS+=		sftpgo
+FILES_SUBST+=		SFTPGO_USER=${SFTPGO_USER:Q}
+
 .include "go-modules.mk"
 
 post-build:
diff --git a/sftpgo/TODO b/sftpgo/TODO
deleted file mode 100644
index 04ded3b90a..0000000000
--- a/sftpgo/TODO
+++ /dev/null
@@ -1 +0,0 @@
-Add rc.d script
diff --git a/sftpgo/files/sftpgo.sh b/sftpgo/files/sftpgo.sh
index 146d0f4b4f..c438aa1685 100644
--- a/sftpgo/files/sftpgo.sh
+++ b/sftpgo/files/sftpgo.sh
@@ -1,32 +1,39 @@
 #!@RCD_SCRIPTS_SHELL@
-
+#
+# $NetBSD$
+#
 # PROVIDE: sftpgo
 # REQUIRE: DAEMON
-
-if [ -f /etc/rc.subr ]; then
-	. /etc/rc.subr
-fi
+# KEYWORD: shutdown
 
 name="sftpgo"
-rcvar=$name
-command="@PREFIX@/sbin/bitlbee"
-pidfile="@VARBASE@/run/${name}/pid"
-command_args="-F"	# run as a fork daemon
-start_precmd="bitlbee_precmd"
-
-bitlbee_precmd()
-{
-	if [ ! -d "@VARBASE@/run/${name}" ]; then
-		@MKDIR@ "@VARBASE@/run/${name}"
-		@CHMOD@ 0700 "@VARBASE@/run/${name}"
-		@CHOWN@ @BITLBEE_USER@:@BITLBEE_GROUP@ "@VARBASE@/run/${name}"
-	fi
-}
-
-if [ -f /etc/rc.subr ]; then
-	load_rc_config $name
+
+command="@PREFIX@/sbin/daemonize"
+
+pidfile="@VARBASE@/run/${name}.pid"
+
+task="@PREFIX@/bin/${name}"
+task_args="serve --config-dir @VARBASE@/sftpgo --config-file @PKG_SYSCONFDIR@/sftpgo.json"
+
+procname="${task}"
+
+command_args="-p ${pidfile} \
+	-u @SFTPGO_USER@ \
+	-c @VARBASE@/${name} \
+	-e @VARBASE@/${name}/${name}.stderr \
+	-o @VARBASE@/${name}/${name}.stdout \
+	${task} ${task_args}"
+
+if [ -f @SYSCONFBASE@/rc.subr ]; then
+    	. @SYSCONFBASE@/rc.subr
+
+	rcvar=${name}
+	pidfile="@VARBASE@/run/${name}.pid"
+
+	load_rc_config ${name}
 	run_rc_command "$1"
 else
-	echo -n "${name}"
-	${command} ${bitlbee_flags} ${command_args}
+        @ECHO@ -n " ${name}"
+
+	${command} ${command_args}
 fi


Home | Main Index | Thread Index | Old Index