pkgsrc-WIP-changes archive

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

mosquitto: Add rc.d script



Module Name:	pkgsrc-wip
Committed By:	Greg Troxel <gdt%lexort.com@localhost>
Pushed By:	gdt
Date:		Sun Jun 30 19:20:24 2019 -0400
Changeset:	d77143ffe3e6a5d2e8e9b39acfca8edf6cd57ca7

Modified Files:
	mosquitto/Makefile
	mosquitto/distinfo
	mosquitto/patches/patch-mosquitto.conf
Added Files:
	mosquitto/files/mosquitto.sh

Log Message:
mosquitto: Add rc.d script

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

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

diffstat:
 mosquitto/Makefile                     | 20 +++++++++++++++++---
 mosquitto/distinfo                     |  2 +-
 mosquitto/files/mosquitto.sh           | 30 ++++++++++++++++++++++++++++++
 mosquitto/patches/patch-mosquitto.conf | 24 ++++++++++--------------
 4 files changed, 58 insertions(+), 18 deletions(-)

diffs:
diff --git a/mosquitto/Makefile b/mosquitto/Makefile
index c72ddd9351..6168d2cf0d 100644
--- a/mosquitto/Makefile
+++ b/mosquitto/Makefile
@@ -1,7 +1,7 @@
 # $NetBSD$
 
 VERSION=	1.6.3
-PKGREVISION=	2
+PKGREVISION=	3
 DISTNAME=	mosquitto-${VERSION}
 CATEGORIES=	net
 MASTER_SITES=	https://mosquitto.org/files/source/
@@ -21,13 +21,27 @@ USE_TOOLS+=	gmake
 
 CMAKE_ARGS+=	-DCMAKE_INSTALL_SYSCONFDIR=${PREFIX}/share/examples
 
+MOSQUITTO_USER=		mosquitto
+MOSQUITTO_GROUP=	mosquitto
+
+PKG_USERS=	${MOSQUITTO_USER}:${MOSQUITTO_GROUP}
+PKG_GROUPS=	${MOSQUITTO_GROUP}
+
 # \todo The example file is vast and arguably should not be installed.
 # However, we need to set a few things to make automatic startup work.
 CONF_FILES=	${PREFIX}/share/examples/mosquitto/mosquitto.conf \
 		${PKG_SYSCONFDIR}/mosquitto.conf
 
-PKG_USERS=	mosquitto:mosquitto
-PKG_GROUPS=	mosquitto
+SUBST_CLASSES+=		paths
+SUBST_STAGE.paths=	pre-configure
+SUBST_MESSAGE.paths=	Substituting paths
+SUBST_FILES.paths=	mosquitto.conf
+SUBST_SED.paths=	-e 's,@VAR_RUN@,/var/run,g'
+
+RCD_SCRIPTS=	mosquitto
+FILES_SUBST+=	MOSQUITTO_USER=${MOSQUITTO_USER}
+FILES_SUBST+=	MOSQUITTO_GROUP=${MOSQUITTO_GROUP}
+FILES_SUBST+=	PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
 
 # Fails; see https://github.com/eclipse/mosquitto/issues/1242
 TEST_TARGET=	test
diff --git a/mosquitto/distinfo b/mosquitto/distinfo
index d19a24a987..8ad2c9b544 100644
--- a/mosquitto/distinfo
+++ b/mosquitto/distinfo
@@ -7,5 +7,5 @@ Size (mosquitto-1.6.3.tar.gz) = 578952 bytes
 SHA1 (patch-CMakeLists.txt) = fb04da93970ccca17657021597b8311875473242
 SHA1 (patch-lib_CMakeLists.txt) = cddb8803a759820c8059028f924b56c22689ee54
 SHA1 (patch-lib_net__mosq.c) = a38294cdfea98f2da0879ea93373c5f04aebdb20
-SHA1 (patch-mosquitto.conf) = 3db0e0bb4ca25bb12f539b604a957453268712bf
+SHA1 (patch-mosquitto.conf) = 0adade307e11e32b84013fbad9a00ae6c3a90e0f
 SHA1 (patch-src_CMakeLists.txt) = 2346ee3f13ab7f7e2c34492a4271e0b1adcae4fb
diff --git a/mosquitto/files/mosquitto.sh b/mosquitto/files/mosquitto.sh
new file mode 100644
index 0000000000..857051818d
--- /dev/null
+++ b/mosquitto/files/mosquitto.sh
@@ -0,0 +1,30 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: $
+#
+# PROVIDE: mosquitto
+# REQUIRE: DAEMON
+
+. /etc/rc.subr
+
+name="mosquitto"
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+piddir="/var/run/${name}"
+pidfile="${piddir}/${name}.pid"
+config="@PKG_SYSCONFDIR@/${name}.conf"
+
+command_args="-d -c $config"
+
+start_precmd="mosquitto_precmd"
+test_cmd="mosquitto_test"
+extra_commands=""
+
+mosquitto_precmd()
+{
+    mkdir -p ${piddir}
+    chown @MOSQUITTO_USER@ ${piddir}
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mosquitto/patches/patch-mosquitto.conf b/mosquitto/patches/patch-mosquitto.conf
index df99fd6f98..698cbe9b1a 100644
--- a/mosquitto/patches/patch-mosquitto.conf
+++ b/mosquitto/patches/patch-mosquitto.conf
@@ -2,23 +2,19 @@ $NetBSD$
 
 Log to syslog, instead of (perhaps) not logging.
 
-\todo Figure out what happens if port is not defined, and why we set it.
+Set a pid_file for use by rc.d/mosquitto.
 
-\todo Think about pidfile; because this can be run in various modes
-that seems like it should perhaps be command-line, not config.
-
---- mosquitto.conf.orig	2019-04-26 16:07:59.000000000 +0000
+--- mosquitto.conf.orig	2019-06-18 11:45:59.000000000 +0000
 +++ mosquitto.conf
-@@ -216,7 +216,7 @@
- #bind_address
- 
- # Port to use for the default listener.
--#port 1883
-+port 1883
+@@ -159,6 +159,7 @@
+ # being run automatically on boot with an init script and
+ # start-stop-daemon or similar.
+ #pid_file
++pid_file @VAR_RUN@/mosquitto/mosquitto.pid
  
- # Bind the listener to a specific interface. This is similar to
- # bind_address above but is useful when an interface has multiple addresses or
-@@ -594,6 +594,7 @@
+ # Set to true to queue messages with QoS 0 when a persistent client is
+ # disconnected. These messages are included in the limit imposed by
+@@ -586,6 +587,7 @@
  # "log_dest none" and neither stdout nor stderr logging is available.
  # Use "log_dest none" if you wish to disable logging.
  #log_dest stderr


Home | Main Index | Thread Index | Old Index