git: 86bb83ce8acd - main - dns/inadyn: fix for pidfile creation on transient /var/run configuration

From: Oleksii Samorukov <samm_at_FreeBSD.org>
Date: Tue, 06 Jun 2023 06:04:26 UTC
The branch main has been updated by samm:

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

commit 86bb83ce8acd6c460fa3f708fd7ac95c6ad7f000
Author:     Oleksii Samorukov <samm@FreeBSD.org>
AuthorDate: 2023-06-06 06:03:07 +0000
Commit:     Oleksii Samorukov <samm@FreeBSD.org>
CommitDate: 2023-06-06 06:04:10 +0000

    dns/inadyn: fix for pidfile creation on transient /var/run configuration
    
    PR: 266106
---
 dns/inadyn/Makefile        | 1 +
 dns/inadyn/files/inadyn.in | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/dns/inadyn/Makefile b/dns/inadyn/Makefile
index a23046619979..abc44df60198 100644
--- a/dns/inadyn/Makefile
+++ b/dns/inadyn/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	inadyn
 PORTVERSION=	2.11.0
+PORTREVISION=	1
 CATEGORIES=	dns
 MASTER_SITES=	https://github.com/troglobit/${PORTNAME}/releases/download/v${PORTVERSION}/
 
diff --git a/dns/inadyn/files/inadyn.in b/dns/inadyn/files/inadyn.in
index 2c1a77815724..a5bf457e9ce4 100644
--- a/dns/inadyn/files/inadyn.in
+++ b/dns/inadyn/files/inadyn.in
@@ -40,6 +40,11 @@ inadyn_checkconfig()
 {
 	echo "Performing sanity check on ${name} configuration:"
 	eval ${command} ${command_args} --check-config
+	piddir="$(dirname ${pidfile})"
+	if [ ! -d "${piddir}" ] && id inadyn >/dev/null 2>&1 ; then
+		mkdir -p "${piddir}"
+		chown inadyn:inadyn "${piddir}"
+	fi
 }
 
 run_rc_command "$1"