Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Feb 2020 14:16:40 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r525825 - in head/net-p2p/btpd: . files
Message-ID:  <202002111416.01BEGeTR022290@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mat
Date: Tue Feb 11 14:16:40 2020
New Revision: 525825
URL: https://svnweb.freebsd.org/changeset/ports/525825

Log:
  Add a rc startup script.
  
  Leave the user creation to the end-user.
  
  PR:		243352
  Submitted by:	timp87 gmail com

Added:
  head/net-p2p/btpd/files/
  head/net-p2p/btpd/files/btpd.in   (contents, props changed)
Modified:
  head/net-p2p/btpd/Makefile   (contents, props changed)

Modified: head/net-p2p/btpd/Makefile
==============================================================================
--- head/net-p2p/btpd/Makefile	Tue Feb 11 14:15:01 2020	(r525824)
+++ head/net-p2p/btpd/Makefile	Tue Feb 11 14:16:40 2020	(r525825)
@@ -3,7 +3,7 @@
 PORTNAME=	btpd
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.16
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	net-p2p
 
 MAINTAINER=	mat@FreeBSD.org
@@ -12,9 +12,11 @@ COMMENT=	Bittorrent client consisting of a daemon and 
 LICENSE=	BSD2CLAUSE BSD3CLAUSE
 LICENSE_COMB=	multi
 
+USES=		autoreconf ssl
+
 USE_GITHUB=	yes
+USE_RC_SUBR=	btpd
 
-USES=		autoreconf ssl
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--with-openssl=${OPENSSLBASE}
 

Added: head/net-p2p/btpd/files/btpd.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/btpd/files/btpd.in	Tue Feb 11 14:16:40 2020	(r525825)
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: btpd
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# Add btpd_enable="YES" to /etc/rc.conf to enable btpd
+#
+# btpd_enable (bool): Set to "YES" to enable btpd
+#
+# btpd_flags (str):   Additional flags for btpd
+#
+# btpd_user (str):    Username to run btpd under
+
+. /etc/rc.subr
+
+name=btpd
+desc="BTPD bittorrent daemon startup script"
+rcvar=btpd_enable
+
+load_rc_config "${name}"
+
+start_precmd=btpd_prestart
+
+btpd_enable=${btpd_enable:-NO}
+btpd_program=${btpd_program:-"%%PREFIX%%/bin/${name}"}
+btpd_user=${btpd_user:-}
+
+btpd_prestart()
+{
+	if [ -n "${btpd_user}" ]; then
+		err 3 "btpd: btpd_user unset.  Set it to an existing user and try again."
+	fi
+
+	BTPD_HOME=$( /usr/sbin/pw usershow -7 -n "${btpd_user}" | /usr/bin/cut -d: -f6 )
+	export BTPD_HOME
+}
+
+
+run_rc_command "$1"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002111416.01BEGeTR022290>