From owner-svn-ports-all@freebsd.org Tue Feb 11 14:16:40 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7338236851; Tue, 11 Feb 2020 14:16:40 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48H4Zw5N84z44MG; Tue, 11 Feb 2020 14:16:40 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3E6D951E; Tue, 11 Feb 2020 14:16:40 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01BEGeVJ022292; Tue, 11 Feb 2020 14:16:40 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01BEGeTR022290; Tue, 11 Feb 2020 14:16:40 GMT (envelope-from mat@FreeBSD.org) Message-Id: <202002111416.01BEGeTR022290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Tue, 11 Feb 2020 14:16:40 +0000 (UTC) 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 X-SVN-Group: ports-head X-SVN-Commit-Author: mat X-SVN-Commit-Paths: in head/net-p2p/btpd: . files X-SVN-Commit-Revision: 525825 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 14:16:41 -0000 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"