Re: net/pfresolved rc startup

2023-11-27 Thread Alexander Bluhm
On Mon, Nov 27, 2023 at 09:29:02AM +, Klemens Nanni wrote:
> Just pass it from the ports Makefile, no patch needed:
> 
> FAKE_FLAGS =  BINDIR=/usr/local/sbin

Portcheck does not like this:

hardcoded paths detected in Makefile, consider using SUBST_VARS and TRUEPREFIX/L
OCALBASE/LOCALSTATEDIR/VARBASE

> > +daemon="${TRUEPREFIX}/sbin/pfresolved"
> 
> Works, but should match what's used for BINDIR:
> 
> daemon="/usr/local/sbin/pfresolved"

I dropped the LOCALBASE patch, but keep TRUEPREFIX in Makefile and
rc script.

Now everything is consistent.  Thanks for feedback.



Re: net/pfresolved rc startup

2023-11-27 Thread Klemens Nanni
On Sun, Nov 26, 2023 at 11:18:43PM +0100, Alexander Bluhm wrote:
> On Sun, Nov 26, 2023 at 09:21:44PM +, Klemens Nanni wrote:
> > On Sun, Nov 26, 2023 at 09:52:57PM +0100, Alexander Bluhm wrote:
> > >   Did I get the TRUEPREFIX and LOCALBASE correct?
> > 
> > I wouldn't bother, really, and just hard-code /usr/local these days.
> > Lots of churn and patching for something practically noone does.
> 
> This makes patch much smaller.
> 
> ok?

OK kn, see inline

> bluhm
> 
> Index: net/pfresolved/Makefile
> ===
> RCS file: /cvs/ports/net/pfresolved/Makefile,v
> diff -u -p -r1.2 Makefile
> --- net/pfresolved/Makefile   26 Nov 2023 19:06:46 -  1.2
> +++ net/pfresolved/Makefile   26 Nov 2023 22:17:05 -
> @@ -1,6 +1,7 @@
>  COMMENT =pf table DNS update daemon
>  
>  VERSION =1.00
> +REVISION =   0
>  DISTNAME =   pfresolved-${VERSION}
>  SUPDISTFILES =   ${DISTFILES}.asc
>  
> Index: net/pfresolved/patches/patch-Makefile
> ===
> RCS file: net/pfresolved/patches/patch-Makefile
> diff -N net/pfresolved/patches/patch-Makefile
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ net/pfresolved/patches/patch-Makefile 26 Nov 2023 22:17:05 -
> @@ -0,0 +1,12 @@
> +Index: Makefile
> +--- Makefile.orig
>  Makefile
> +@@ -3,7 +3,7 @@ SRCS=pfresolved.c
> + SRCS+=  forwarder.c log.c pftable.c proc.c timer.c util.c
> + SRCS+=  parse.y
> + MAN=pfresolved.8 pfresolved.conf.5
> +-BINDIR?=/usr/local/bin
> ++BINDIR?=/usr/local/sbin
> + MANDIR?=/usr/local/man/man

Just pass it from the ports Makefile, no patch needed:

FAKE_FLAGS =BINDIR=/usr/local/sbin

> + 
> + LDADD+= -lutil -levent -lexecinfo -lunbound
> Index: net/pfresolved/pkg/PLIST
> ===
> RCS file: /cvs/ports/net/pfresolved/pkg/PLIST,v
> diff -u -p -r1.1.1.1 PLIST
> --- net/pfresolved/pkg/PLIST  24 Nov 2023 19:45:58 -  1.1.1.1
> +++ net/pfresolved/pkg/PLIST  26 Nov 2023 22:17:05 -
> @@ -1,3 +1,6 @@
> -@bin bin/pfresolved
> +@newgroup _pfresolved:601
> +@newuser _pfresolved:601:_pfresolved::pf DNS daemon:/var/empty:/sbin/nologin
> +@rcscript ${RCDIR}/pfresolved
>  @man man/man5/pfresolved.conf.5
>  @man man/man8/pfresolved.8
> +@bin sbin/pfresolved
> Index: net/pfresolved/pkg/pfresolved.rc
> ===
> RCS file: net/pfresolved/pkg/pfresolved.rc
> diff -N net/pfresolved/pkg/pfresolved.rc
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ net/pfresolved/pkg/pfresolved.rc  26 Nov 2023 22:17:05 -
> @@ -0,0 +1,14 @@
> +#!/bin/ksh
> +
> +daemon="${TRUEPREFIX}/sbin/pfresolved"

Works, but should match what's used for BINDIR:

daemon="/usr/local/sbin/pfresolved"

> +
> +. /etc/rc.d/rc.subr
> +
> +pexp="pfresolved: parent.*"
> +
> +rc_configtest() {
> + # use rc_exec here since daemon_flags may contain arguments with spaces
> + rc_exec "${daemon} -n ${daemon_flags}"
> +}
> +
> +rc_cmd $1
> Index: infrastructure/db/user.list
> ===
> RCS file: /cvs/ports/infrastructure/db/user.list,v
> diff -u -p -r1.432 user.list
> --- infrastructure/db/user.list   18 Nov 2023 13:28:43 -  1.432
> +++ infrastructure/db/user.list   26 Nov 2023 22:17:05 -
> @@ -109,7 +109,7 @@ id  user  group   port
>  598 _iodine  _iodine net/iodine
>  599 _bacula-sd   sysutils/bacula
>  #600 _ntlmaps_ntlmapswww/ntlmaps
> -#601 _unbound_unboundnet/unbound
> +601 _pfresolved  _pfresolved net/pfresolved
>  602 _havp_havp   www/havp
>  603 _argus   _argus  net/argus
>  604 _haproxy _haproxynet/haproxy
> 



Re: net/pfresolved rc startup

2023-11-26 Thread Alexander Bluhm
On Sun, Nov 26, 2023 at 09:21:44PM +, Klemens Nanni wrote:
> On Sun, Nov 26, 2023 at 09:52:57PM +0100, Alexander Bluhm wrote:
> >   Did I get the TRUEPREFIX and LOCALBASE correct?
> 
> I wouldn't bother, really, and just hard-code /usr/local these days.
> Lots of churn and patching for something practically noone does.

This makes patch much smaller.

ok?

bluhm

Index: net/pfresolved/Makefile
===
RCS file: /cvs/ports/net/pfresolved/Makefile,v
diff -u -p -r1.2 Makefile
--- net/pfresolved/Makefile 26 Nov 2023 19:06:46 -  1.2
+++ net/pfresolved/Makefile 26 Nov 2023 22:17:05 -
@@ -1,6 +1,7 @@
 COMMENT =  pf table DNS update daemon
 
 VERSION =  1.00
+REVISION = 0
 DISTNAME = pfresolved-${VERSION}
 SUPDISTFILES = ${DISTFILES}.asc
 
Index: net/pfresolved/patches/patch-Makefile
===
RCS file: net/pfresolved/patches/patch-Makefile
diff -N net/pfresolved/patches/patch-Makefile
--- /dev/null   1 Jan 1970 00:00:00 -
+++ net/pfresolved/patches/patch-Makefile   26 Nov 2023 22:17:05 -
@@ -0,0 +1,12 @@
+Index: Makefile
+--- Makefile.orig
 Makefile
+@@ -3,7 +3,7 @@ SRCS=  pfresolved.c
+ SRCS+=forwarder.c log.c pftable.c proc.c timer.c util.c
+ SRCS+=parse.y
+ MAN=  pfresolved.8 pfresolved.conf.5
+-BINDIR?=  /usr/local/bin
++BINDIR?=  /usr/local/sbin
+ MANDIR?=  /usr/local/man/man
+ 
+ LDADD+=   -lutil -levent -lexecinfo -lunbound
Index: net/pfresolved/pkg/PLIST
===
RCS file: /cvs/ports/net/pfresolved/pkg/PLIST,v
diff -u -p -r1.1.1.1 PLIST
--- net/pfresolved/pkg/PLIST24 Nov 2023 19:45:58 -  1.1.1.1
+++ net/pfresolved/pkg/PLIST26 Nov 2023 22:17:05 -
@@ -1,3 +1,6 @@
-@bin bin/pfresolved
+@newgroup _pfresolved:601
+@newuser _pfresolved:601:_pfresolved::pf DNS daemon:/var/empty:/sbin/nologin
+@rcscript ${RCDIR}/pfresolved
 @man man/man5/pfresolved.conf.5
 @man man/man8/pfresolved.8
+@bin sbin/pfresolved
Index: net/pfresolved/pkg/pfresolved.rc
===
RCS file: net/pfresolved/pkg/pfresolved.rc
diff -N net/pfresolved/pkg/pfresolved.rc
--- /dev/null   1 Jan 1970 00:00:00 -
+++ net/pfresolved/pkg/pfresolved.rc26 Nov 2023 22:17:05 -
@@ -0,0 +1,14 @@
+#!/bin/ksh
+
+daemon="${TRUEPREFIX}/sbin/pfresolved"
+
+. /etc/rc.d/rc.subr
+
+pexp="pfresolved: parent.*"
+
+rc_configtest() {
+   # use rc_exec here since daemon_flags may contain arguments with spaces
+   rc_exec "${daemon} -n ${daemon_flags}"
+}
+
+rc_cmd $1
Index: infrastructure/db/user.list
===
RCS file: /cvs/ports/infrastructure/db/user.list,v
diff -u -p -r1.432 user.list
--- infrastructure/db/user.list 18 Nov 2023 13:28:43 -  1.432
+++ infrastructure/db/user.list 26 Nov 2023 22:17:05 -
@@ -109,7 +109,7 @@ id  usergroup   port
 598 _iodine_iodine net/iodine
 599 _bacula-sd sysutils/bacula
 #600 _ntlmaps  _ntlmapswww/ntlmaps
-#601 _unbound  _unboundnet/unbound
+601 _pfresolved_pfresolved net/pfresolved
 602 _havp  _havp   www/havp
 603 _argus _argus  net/argus
 604 _haproxy   _haproxynet/haproxy



Re: net/pfresolved rc startup

2023-11-26 Thread Klemens Nanni
On Sun, Nov 26, 2023 at 09:52:57PM +0100, Alexander Bluhm wrote:
> Hi,
> 
> I forgot startup framework for my pfresolved port.
> 
> - Better install daemon in sbin.

hier(7) seems to agree.

>   Did I get the TRUEPREFIX and LOCALBASE correct?

I wouldn't bother, really, and just hard-code /usr/local these days.
Lots of churn and patching for something practically noone does.

> - Provide rc script, mostly copied from iked.
> - Add user and group.
>   Can I recycle one of the list?

_unbound/601 certainly looks old enough to recycle, we ship
_unbound/53 in base, so users shouldn't have the ports user anymore.