Support PKG_SYSCONFDIR and VARBASE. Add SNIPROXY_{USER,GROUP}, both

defaulting to "sniproxy." Add rc.d script. Bump PKGREVISION.
This commit is contained in:
schmonz 2019-01-11 23:09:53 +00:00
parent 85f9f9aa43
commit 229fce31c7
7 changed files with 137 additions and 2 deletions

View file

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.7 2019/01/08 14:41:16 wiedi Exp $ # $NetBSD: Makefile,v 1.8 2019/01/11 23:09:53 schmonz Exp $
DISTNAME= sniproxy-0.6.0 DISTNAME= sniproxy-0.6.0
PKGREVISION= 1
CATEGORIES= net CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_GITHUB:=dlundquist/} MASTER_SITES= ${MASTER_SITE_GITHUB:=dlundquist/}
@ -22,6 +23,21 @@ CONF_FILES= ${EGDIR}/sniproxy.conf ${PKG_SYSCONFDIR}/sniproxy.conf
CPPFLAGS.SunOS+= -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 CPPFLAGS.SunOS+= -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
LDFLAGS.SunOS+= -lsocket -lnsl LDFLAGS.SunOS+= -lsocket -lnsl
SUBST_CLASSES+= pkgvars
SUBST_STAGE.pkgvars= do-configure
SUBST_FILES.pkgvars= src/sniproxy.c sniproxy.conf \
man/sniproxy.8 man/sniproxy.conf.5
SUBST_VARS.pkgvars= PKG_SYSCONFDIR VARBASE SNIPROXY_USER SNIPROXY_GROUP
PKG_USERS_VARS+= SNIPROXY_USER
PKG_GROUPS_VARS+= SNIPROXY_GROUP
PKG_GROUPS+= ${SNIPROXY_GROUP}
PKG_USERS+= ${SNIPROXY_USER}:${SNIPROXY_GROUP}
RCD_SCRIPTS= sniproxy
BUILD_DEFS+= VARBASE PKG_SYSCONFBASE
pre-configure: pre-configure:
cd ${WRKSRC} && autoreconf --install && automake --add-missing --copy cd ${WRKSRC} && autoreconf --install && automake --add-missing --copy

View file

@ -1,6 +1,10 @@
$NetBSD: distinfo,v 1.7 2019/01/08 14:41:16 wiedi Exp $ $NetBSD: distinfo,v 1.8 2019/01/11 23:09:53 schmonz Exp $
SHA1 (sniproxy-0.6.0.tar.gz) = 26ff187c46eb4f98f9f1731cd26f341383ea6454 SHA1 (sniproxy-0.6.0.tar.gz) = 26ff187c46eb4f98f9f1731cd26f341383ea6454
RMD160 (sniproxy-0.6.0.tar.gz) = 24e9126e100bdc6a04a4dd5fbe7379b642e04ff2 RMD160 (sniproxy-0.6.0.tar.gz) = 24e9126e100bdc6a04a4dd5fbe7379b642e04ff2
SHA512 (sniproxy-0.6.0.tar.gz) = 8a99573673bdd57e528c5781cb166d39c80daed699382b24c3fa18a6011d074a1d9e470fee404d24b4450cf067c9995125910b2941b5216d88d189a1d79ebf73 SHA512 (sniproxy-0.6.0.tar.gz) = 8a99573673bdd57e528c5781cb166d39c80daed699382b24c3fa18a6011d074a1d9e470fee404d24b4450cf067c9995125910b2941b5216d88d189a1d79ebf73
Size (sniproxy-0.6.0.tar.gz) = 78515 bytes Size (sniproxy-0.6.0.tar.gz) = 78515 bytes
SHA1 (patch-man_sniproxy.8) = 6c23fd3a826cfdd37b656e235392263995f0bad0
SHA1 (patch-man_sniproxy.conf.5) = d18a997fe2d3bf570c3c3e8530ec2c6487e35ba0
SHA1 (patch-sniproxy.conf) = 7a7c596ec2947cc94271dbd7298dd3e9896260f7
SHA1 (patch-src_sniproxy.c) = d3aa00bd393ceaeba81ce9d15cdafd24ab63eaf1

View file

@ -0,0 +1,17 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: sniproxy.sh,v 1.1 2019/01/11 23:09:53 schmonz Exp $
# PROVIDE: sniproxy
# REQUIRE: NETWORKING
. /etc/rc.subr
name="sniproxy"
rcvar=${name}
command="@PREFIX@/sbin/${name}"
required_files="@PKG_SYSCONFDIR@/sniproxy.conf"
pidfile="@VARBASE@/run/${name}.pid"
load_rc_config $name
run_rc_command "$1"

View file

@ -0,0 +1,15 @@
$NetBSD: patch-man_sniproxy.8,v 1.1 2019/01/11 23:09:54 schmonz Exp $
Support PKG_SYSCONFDIR.
--- man/sniproxy.8.orig 2018-12-06 04:14:58.000000000 +0000
+++ man/sniproxy.8
@@ -20,7 +20,7 @@ proxy machine\&.
.TP
-c \fIconfig\fR
-Specify configuration file to use. The default is /etc/sniproxy\&.conf\&.
+Specify configuration file to use. The default is @PKG_SYSCONFDIR@/sniproxy\&.conf\&.
.TP
-f

View file

@ -0,0 +1,20 @@
$NetBSD: patch-man_sniproxy.conf.5,v 1.1 2019/01/11 23:09:54 schmonz Exp $
Support PKG_SYSCONFDIR.
--- man/sniproxy.conf.5.orig 2018-12-06 04:14:58.000000000 +0000
+++ man/sniproxy.conf.5
@@ -6,11 +6,11 @@ sniproxy.conf - sniproxy configuration f
.SH SYNOPSIS
-/etc/sniproxy.conf
+@PKG_SYSCONFDIR@/sniproxy.conf
.SH DESCRIPTION
-/etc/sniproxy.conf is the configuration file for sniproxy. Statements are
+@PKG_SYSCONFDIR@/sniproxy.conf is the configuration file for sniproxy. Statements are
separated by either a new line or semi-colon. Lines starting with \&# are
comments. The configuration is broken down into stanzas delimited by curly
braces. Characters may be escaped using \&\\. Configuration directives may may

View file

@ -0,0 +1,48 @@
$NetBSD: patch-sniproxy.conf,v 1.1 2019/01/11 23:09:54 schmonz Exp $
Support VARBASE and pkgsrc-configurable user and group.
--- sniproxy.conf.orig 2018-12-06 04:14:58.000000000 +0000
+++ sniproxy.conf
@@ -2,11 +2,11 @@
# lines that start with # are comments
# lines with only white space are ignored
-user nobody
-group nogroup
+user @SNIPROXY_USER@
+group @SNIPROXY_GROUP@
# PID file, needs to be placed in directory writable by user
-pidfile /var/run/sniproxy.pid
+pidfile @VARBASE@/run/sniproxy.pid
# The DNS resolver is required for tables configured using wildcard or hostname
# targets. If no resolver is specified, the nameserver and search domain are
@@ -38,7 +38,7 @@ error_log {
syslog daemon
# Alternatively we could log to file
- #filename /var/log/sniproxy.log
+ #filename @VARBASE@/log/sniproxy.log
# Control the verbosity of the log
priority notice
@@ -109,7 +109,7 @@ listen [2001:0db8::10]:80 {
# this will use default table
}
-listen unix:/var/run/proxy.sock {
+listen unix:@VARBASE@/run/proxy.sock {
protocol http
# this will use default table
}
@@ -143,7 +143,7 @@ table https_hosts {
# When proxying to local sockets you should use different tables since the
# local socket server most likely will not detect which protocol is being
# used
- example.org unix:/var/run/server.sock
+ example.org unix:@VARBASE@/run/server.sock
}
# if no table specified the default 'default' table is defined

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_sniproxy.c,v 1.1 2019/01/11 23:09:54 schmonz Exp $
Support PKG_SYSCONFDIR.
--- src/sniproxy.c.orig 2018-12-06 04:14:58.000000000 +0000
+++ src/sniproxy.c
@@ -66,7 +66,7 @@ static struct ev_signal sigterm_watcher;
int
main(int argc, char **argv) {
- const char *config_file = "/etc/sniproxy.conf";
+ const char *config_file = "@PKG_SYSCONFDIR@/sniproxy.conf";
int background_flag = 1;
rlim_t max_nofiles = 65536;
int opt;