git: c7c143e50fc0 - main - net-mgmt/icingaweb2-module-vspheredb: add rc.d script

From: Dan Langille <dvl_at_FreeBSD.org>
Date: Wed, 26 Oct 2022 17:50:27 UTC
The branch main has been updated by dvl:

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

commit c7c143e50fc09e68bd27d3d87a55abedc993a522
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2022-10-26 17:49:27 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2022-10-26 17:50:24 +0000

    net-mgmt/icingaweb2-module-vspheredb: add rc.d script
    
    While here, some portfmt fixes
    
    Approved by:    maintainer (via private email)
---
 net-mgmt/icingaweb2-module-vspheredb/Makefile      | 12 +++++++----
 .../icingaweb2-module-vspheredb/files/vspheredb.in | 24 ++++++++++++++++++++++
 net-mgmt/icingaweb2-module-vspheredb/pkg-plist     |  1 +
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/net-mgmt/icingaweb2-module-vspheredb/Makefile b/net-mgmt/icingaweb2-module-vspheredb/Makefile
index 400dc4fe5eae..1223546c8595 100644
--- a/net-mgmt/icingaweb2-module-vspheredb/Makefile
+++ b/net-mgmt/icingaweb2-module-vspheredb/Makefile
@@ -1,22 +1,23 @@
 PORTNAME=	icingaweb2-module-vspheredb
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.4.0
+PORTREVISION=	1
 CATEGORIES=	net-mgmt www
 PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
 
 MAINTAINER=	gettoknowmi@yahoo.com
-COMMENT= 	Easily Monitor Vsphere with Icinga
+COMMENT=	Easily Monitor Vsphere with Icinga
 WWW=		https://github.com/Icinga/icingaweb2-module-vspheredb
 
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 RUN_DEPENDS=	icingaweb2${PHP_PKGNAMESUFFIX}>=2.5.0:net-mgmt/icingaweb2@${PHP_FLAVOR} \
-		icingaweb2-module-reactbundle${PHP_PKGNAMESUFFIX}>0:net-mgmt/icingaweb2-module-reactbundle@${PHP_FLAVOR} \
 		icingaweb2-module-incubator${PHP_PKGNAMESUFFIX}>0:net-mgmt/icingaweb2-module-incubator@${PHP_FLAVOR} \
-		icingaweb2-module-ipl${PHP_PKGNAMESUFFIX}>0:net-mgmt/icingaweb2-module-ipl@${PHP_FLAVOR}
+		icingaweb2-module-ipl${PHP_PKGNAMESUFFIX}>0:net-mgmt/icingaweb2-module-ipl@${PHP_FLAVOR} \
+		icingaweb2-module-reactbundle${PHP_PKGNAMESUFFIX}>0:net-mgmt/icingaweb2-module-reactbundle@${PHP_FLAVOR}
 
-USES=		php:web,flavors mysql
+USES=		mysql php:web,flavors
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	icinga
@@ -26,7 +27,10 @@ NO_ARCH=	yes
 
 WWWDIR?=	${PREFIX}/www/icingaweb2/modules/${PORTNAME:C/^.*-//}
 
+SUB_FILES=	vspheredb
+
 do-install:
+	${INSTALL_SCRIPT} ${WRKDIR}/vspheredb ${STAGEDIR}${PREFIX}/etc/rc.d
 	@${MKDIR} ${STAGEDIR}${WWWDIR}
 	(cd ${WRKSRC} && \
 		${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR})
diff --git a/net-mgmt/icingaweb2-module-vspheredb/files/vspheredb.in b/net-mgmt/icingaweb2-module-vspheredb/files/vspheredb.in
new file mode 100755
index 000000000000..0e122458400b
--- /dev/null
+++ b/net-mgmt/icingaweb2-module-vspheredb/files/vspheredb.in
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# PROVIDE: vspheredb
+# REQUIRE: icinga2
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable nsca:
+# vspheredb (bool):    Set to "NO" by default.
+#                      Set it to "YES" to enable .
+#
+
+. /etc/rc.subr
+
+name="vspheredb"
+rcvar=vspheredb_enable
+
+pidfile="/var/run/vspheredb.pid"
+command="/usr/sbin/daemon"
+command_args="-f -P ${pidfile} %%PREFIX%%/bin/icingacli vspheredb daemon run"
+
+load_rc_config "${name}"
+
+run_rc_command "$1"
diff --git a/net-mgmt/icingaweb2-module-vspheredb/pkg-plist b/net-mgmt/icingaweb2-module-vspheredb/pkg-plist
index 6ff9e29c553e..1f47e8f7a4b0 100644
--- a/net-mgmt/icingaweb2-module-vspheredb/pkg-plist
+++ b/net-mgmt/icingaweb2-module-vspheredb/pkg-plist
@@ -1,3 +1,4 @@
+etc/rc.d/vspheredb
 %%WWWDIR%%/.github/ISSUE_TEMPLATE.md
 %%WWWDIR%%/.github/workflows/L10n-update.yml
 %%WWWDIR%%/LICENSE