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
This commit is contained in:
Daniel Morante 2021-11-01 06:11:51 +09:00 committed by Yasuhiro Kimura
parent 00fdf52d10
commit 990c482dfe
3 changed files with 85 additions and 1 deletions

View File

@ -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>

View File

@ -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"

View File

@ -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
}
]