pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

siproxd: Prepare for running siproxd chrooted on NetBSD.



Module Name:	pkgsrc-wip
Committed By:	Hauke Fath <hauke%NetBSD.org@localhost>
Pushed By:	hauke
Date:		Tue Nov 13 15:18:06 2018 +0100
Changeset:	e64a07ef5bddcccacdf64174f1a42c8a9199d3c9

Modified Files:
	siproxd/Makefile
	siproxd/files/siproxd.sh
Added Files:
	siproxd/MESSAGE
Removed Files:
	siproxd/TODO.siproxd

Log Message:
siproxd: Prepare for running siproxd chrooted on NetBSD.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e64a07ef5bddcccacdf64174f1a42c8a9199d3c9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 siproxd/MESSAGE          |  7 +++++++
 siproxd/Makefile         | 22 +++++++++++++---------
 siproxd/TODO.siproxd     |  4 ----
 siproxd/files/siproxd.sh | 16 ++++++++++++++--
 4 files changed, 34 insertions(+), 15 deletions(-)

diffs:
diff --git a/siproxd/MESSAGE b/siproxd/MESSAGE
new file mode 100644
index 0000000000..b355a0b218
--- /dev/null
+++ b/siproxd/MESSAGE
@@ -0,0 +1,7 @@
+===========================================================================
+$NetBSD$
+
+To run siproxd chrooted on NetBSD, in ${PKG_SYSCONFDIR}/siproxd.conf
+set 'chrootjail', and in /etc/rc.conf set 'siproxd_chroot' accordingly.
+
+===========================================================================
diff --git a/siproxd/Makefile b/siproxd/Makefile
index 66164112a8..dccc42eb9a 100644
--- a/siproxd/Makefile
+++ b/siproxd/Makefile
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.23 2013/12/28 14:42:28 imilh Exp $
 
 DISTNAME=	siproxd-0.8.2
-PKGREVISION=	1
+PKGREVISION=	2
 CATEGORIES=	net
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE:=siproxd/}
 
@@ -19,7 +19,7 @@ BUILD_DEFS+=		VARBASE
 
 SIPROXD_USER?=		siproxd
 SIPROXD_GROUP?=		siproxd
-SIPROXD_HOME?=		${VARBASE}/chroot/${PKGBASE}
+SIPROXD_HOME?=		${VARBASE}/chroot/siproxd
 
 PKG_GROUPS=		${SIPROXD_GROUP}
 PKG_USERS=		${SIPROXD_USER}:${SIPROXD_GROUP}
@@ -34,19 +34,23 @@ FILES_SUBST+=		SIPROXD_USER=${SIPROXD_USER:Q}
 FILES_SUBST+=		SIPROXD_GROUP=${SIPROXD_GROUP:Q}
 FILES_SUBST+=		SIPROXD_HOME=${SIPROXD_HOME:Q}
 
+MESSAGE_SUBST+=		PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}
+
 RCD_SCRIPTS+=		siproxd
 PKG_SYSCONFSUBDIR=	siproxd
 
 CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
 CONFIGURE_ARGS+=	--with-libosip-prefix=${BUILDLINK_PREFIX.libosip2}
 
-DOCDIR=		share/doc/siproxd
-EGDIR=		share/examples/siproxd
+DOCDIR=			share/doc/siproxd
+EGDIR=			share/examples/siproxd
+
+CONF_FILES=		${PREFIX}/${EGDIR}/siproxd.conf.example \
+				${PKG_SYSCONFDIR}/siproxd.conf
+CONF_FILES+=		${PREFIX}/${EGDIR}/siproxd_passwd.cfg \
+				${PKG_SYSCONFDIR}/siproxd_passwd.cfg
 
-CONF_FILES=	${PREFIX}/${EGDIR}/siproxd.conf.example \
-			${PKG_SYSCONFDIR}/siproxd.conf
-CONF_FILES+=	${PREFIX}/${EGDIR}/siproxd_passwd.cfg \
-			${PKG_SYSCONFDIR}/siproxd_passwd.cfg
+OWN_DIRS+=		${SIPROXD_HOME}
 
 INSTALLATION_DIRS=	sbin ${DOCDIR} ${EGDIR}
 
@@ -65,8 +69,8 @@ post-install:
 .endfor
 
 .include "../../mk/pthread.buildlink3.mk"
+# siproxd's configure does not check for PTHREAD_LDFLAGS
 PTHREAD_LIBS+=	${PTHREAD_LDFLAGS}
-# needed since siproxd's configure does not check for PTHREAD_LDFLAGS
 
 .include "../../devel/libosip/buildlink3.mk"
 .include "../../devel/libltdl/buildlink3.mk"
diff --git a/siproxd/TODO.siproxd b/siproxd/TODO.siproxd
deleted file mode 100644
index 4e95582718..0000000000
--- a/siproxd/TODO.siproxd
+++ /dev/null
@@ -1,4 +0,0 @@
-TODOs for wip/siproxd
-
-o optionally install html and pdf documentation (siproxd-doc package?)
-o run in chroot
\ No newline at end of file
diff --git a/siproxd/files/siproxd.sh b/siproxd/files/siproxd.sh
index f1710bf310..e93bad0d86 100644
--- a/siproxd/files/siproxd.sh
+++ b/siproxd/files/siproxd.sh
@@ -6,6 +6,7 @@
 # PROVIDE: siproxd
 # REQUIRE: DAEMON
 # BEFORE:  LOGIN
+# KEYWORD: chrootdir
 
 $_rc_subr_loaded . /etc/rc.subr
 
@@ -21,8 +22,19 @@ siproxd_precmd()
         rc_flags="-p ${pidfile} $rc_flags"
 
         local piddir="$(dirname "${pidfile}")"
-        mkdir -p "${piddir}"
-        chown @SIPROXD_USER@:@SIPROXD_GROUP@ "${piddir}"
+
+        # Make sure @VARBASE@/run/siproxd exists
+        mkdir -p "${siproxd_chrootdir}${piddir}"
+	chown @SIPROXD_USER@:@SIPROXD_GROUP@ "${siproxd_chrootdir}${piddir}"
+
+	# If chrooted, provide a link to the pid and registrations file
+	# Note: siproxd chroots itself, if so configured
+
+        if [ -n "${siproxd_chrootdir}" ]; then
+	        ln -snf "${siproxd_chrootdir}${piddir}" "${piddir}"
+	fi
+
+        return 0
 }
 
 load_rc_config $name


Home | Main Index | Thread Index | Old Index