From nobody Sun Oct 31 21:29:58 2021
X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D52781814F13;
	Sun, 31 Oct 2021 21:29:58 +0000 (UTC)
	(envelope-from git@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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Hj8T25dpWz4wLD;
	Sun, 31 Oct 2021 21:29:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A146C24D34;
	Sun, 31 Oct 2021 21:29:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19VLTwH8039624;
	Sun, 31 Oct 2021 21:29:58 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19VLTwRt039623;
	Sun, 31 Oct 2021 21:29:58 GMT
	(envelope-from git)
Date: Sun, 31 Oct 2021 21:29:58 GMT
Message-Id: <202110312129.19VLTwRt039623@gitrepo.freebsd.org>
To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org,
        dev-commits-ports-branches@FreeBSD.org
From: Yasuhiro Kimura <yasu@FreeBSD.org>
Subject: git: fd8c82b8e2f6 - 2021Q4 - databases/go-pgweb: Add rc.d script
List-Id: Commit messages for all branches of the ports repository <dev-commits-ports-all.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all
List-Help: <mailto:dev-commits-ports-all+help@freebsd.org>
List-Post: <mailto:dev-commits-ports-all@freebsd.org>
List-Subscribe: <mailto:dev-commits-ports-all+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-ports-all+unsubscribe@freebsd.org>
Sender: owner-dev-commits-ports-all@freebsd.org
X-BeenThere: dev-commits-ports-all@freebsd.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: yasu
X-Git-Repository: ports
X-Git-Refname: refs/heads/2021Q4
X-Git-Reftype: branch
X-Git-Commit: fd8c82b8e2f62e02385f9f024b453653b224c716
Auto-Submitted: auto-generated
X-ThisMailContainsUnwantedMimeParts: N

The branch 2021Q4 has been updated by yasu:

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

commit fd8c82b8e2f62e02385f9f024b453653b224c716
Author:     Daniel Morante <daniel@morante.net>
AuthorDate: 2021-10-31 21:11:51 +0000
Commit:     Yasuhiro Kimura <yasu@FreeBSD.org>
CommitDate: 2021-10-31 21:29:29 +0000

    databases/go-pgweb: Add rc.d script
    
    * Pass maintainership to submitter
    * Pet portclippy
    * Re-format Makefile with portfmt
    
    PR:             257074
    Approved by:    portmgr (blanket: unmaintained port)
    MFH:            2021Q4
    
    (cherry picked from commit 990c482dfe4354a5ab7b6e0c8c5437f55511fcef)
---
 databases/go-pgweb/Makefile             | 14 ++++++++-
 databases/go-pgweb/files/pgweb.in       | 50 +++++++++++++++++++++++++++++++++
 databases/go-pgweb/files/pkg-message.in | 22 +++++++++++++++
 3 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/databases/go-pgweb/Makefile b/databases/go-pgweb/Makefile
index b8113f84e8a0..6e751f9fe1f8 100644
--- a/databases/go-pgweb/Makefile
+++ b/databases/go-pgweb/Makefile
@@ -1,10 +1,11 @@
 PORTNAME=	pgweb
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.11.7
+PORTREVISION=	1
 CATEGORIES=	databases www
 PKGNAMEPREFIX=	go-
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	daniel@morante.net
 COMMENT=	Web-based database browser for PostgreSQL
 
 LICENSE=	MIT
@@ -12,7 +13,18 @@ LICENSE=	MIT
 USES=		go
 USE_GITHUB=	yes
 GH_ACCOUNT=	sosedoff
+USE_RC_SUBR=	${PORTNAME}
+
 GO_PKGNAME=	github.com/sosedoff/pgweb
+
+SUB_FILES+=	pkg-message
+SUB_LIST+=	PGWEBGROUP=${GROUPS} \
+		PGWEBUSER=${USERS} \
+		PORTNAME=${PORTNAME}
+
 PLIST_FILES=	bin/pgweb
 
+USERS=		www
+GROUPS=		www
+
 .include <bsd.port.mk>
diff --git a/databases/go-pgweb/files/pgweb.in b/databases/go-pgweb/files/pgweb.in
new file mode 100644
index 000000000000..e945d0de9c26
--- /dev/null
+++ b/databases/go-pgweb/files/pgweb.in
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+#
+# PROVIDE: %%PORTNAME%%
+# REQUIRE: NETWORKING
+# KEYWORD:
+#
+# Add the following lines to /etc/rc.conf to enable %%PORTNAME%%:
+# %%PORTNAME%%_enable="YES"
+#
+# %%PORTNAME%%_enable (bool):		Set to YES to enable %%PORTNAME%%
+#					Default: NO
+# %%PORTNAME%%_bind (str):		HTTP server host
+#					Default: localhost
+# %%PORTNAME%%_listen (str):	HTTP server listen port
+#					Default: 8081
+# %%PORTNAME%%_user (str):		%%PORTNAME%% daemon user
+#					Default: %%PGWEBUSER%%
+# %%PORTNAME%%_group (str):		%%PORTNAME%% daemon group
+#					Default: %%PGWEBGROUP%%
+
+. /etc/rc.subr
+
+name="%%PORTNAME%%"
+rcvar="%%PORTNAME%%_enable"
+load_rc_config $name
+
+: ${%%PORTNAME%%_user:="www"}
+: ${%%PORTNAME%%_group:="www"}
+: ${%%PORTNAME%%_enable:="NO"}
+: ${%%PORTNAME%%_bind:="localhost"}
+: ${%%PORTNAME%%_flags=""}
+: ${%%PORTNAME%%_facility:="daemon"}
+: ${%%PORTNAME%%_priority:="debug"}
+: ${%%PORTNAME%%_listen:="8081"}
+
+procname="%%PREFIX%%/bin/${name}"
+pidfile="/var/run/${name}.pid"
+start_precmd="${name}_precmd"
+command=/usr/sbin/daemon
+command_args="-S -l ${%%PORTNAME%%_facility} -s ${%%PORTNAME%%_priority} -T ${name} -t ${name} -p ${pidfile} \
+	${procname} --bind=${%%PORTNAME%%_bind} --listen=${%%PORTNAME%%_listen} ${%%PORTNAME%%_flags}"
+
+%%PORTNAME%%_precmd()
+{
+	install -o ${%%PORTNAME%%_user} /dev/null ${pidfile}
+}
+
+run_rc_command "$1"
+
diff --git a/databases/go-pgweb/files/pkg-message.in b/databases/go-pgweb/files/pkg-message.in
new file mode 100644
index 000000000000..c391e85d3cd2
--- /dev/null
+++ b/databases/go-pgweb/files/pkg-message.in
@@ -0,0 +1,22 @@
+[
+{ type: install
+  message: <<EOM
+
+To run Pgweb at startup, enable it in your /etc/rc.conf:
+sysrc pgweb_enable="YES"
+
+To start Pgweb:
+service pgweb start
+
+Pgweb will listen on port 8081 and bind to localhost.  
+This can be changed by setting "pgweb_bind" and "pgweb_listen" 
+in /etc/rc.conf.
+
+sysrc pgweb_bind="0.0.0.0" pgweb_listen="80"
+
+Additional options can be set using "pgweb_flags". See 'pgweb --help' for a list
+of all options.
+
+EOM
+}
+]