hiawatha: added rc script
authorKevin Bloom <kevin.bloom@posteo.net>
Mon, 25 Mar 2024 15:07:49 +0000 (11:07 -0400)
committerKevin Bloom <kevin.bloom@posteo.net>
Mon, 25 Mar 2024 15:07:49 +0000 (11:07 -0400)
hiawatha/Makefile
hiawatha/PLIST
hiawatha/TODO
hiawatha/files/hiawatha.sh [new file with mode: 0644]

index dd4990f334fc56ed36feef855cd19d4d08bf9313..400dc7157a66bf0a8d91b00d2f969f2a9c216fae 100644 (file)
@@ -11,8 +11,6 @@ LICENSE=      gnu-gpl-v2
 
 USE_CMAKE=     yes
 
-EGDIR= ${PREFIX}/share/examples/hiawatha
-
 CMAKE_ARGS+=   -DUSE_SHARED_MBEDTLS_LIBRARY=OFF
 CMAKE_ARGS+=   -DUSE_STATIC_MBEDTLS_LIBRARY=ON
 CMAKE_ARGS+=   -DWEBROOT_DIR="${PREFIX}/var/hiawatha"
@@ -30,8 +28,9 @@ REPLACE_PHP+= extra/letsencrypt/lefh.in
 # TODO: having issues requiring PHP
 CHECK_INTERPRETER_SKIP+=       sbin/lefh
 
-
+EGDIR= ${PREFIX}/share/examples/hiawatha
 ETCDIR=        ${PKG_SYSCONFDIR}/hiawatha
+FILESDIR=      ${PKGDIR}/../../wip/hiawatha/files
 
 CONF_FILES+=   ${EGDIR}/error.xslt ${ETCDIR}/error.xslt
 CONF_FILES+=   ${EGDIR}/hiawatha.conf ${ETCDIR}/hiawatha.conf
@@ -39,7 +38,9 @@ CONF_FILES+=  ${EGDIR}/index.xslt ${ETCDIR}/index.xslt
 CONF_FILES+=   ${EGDIR}/mimetype.conf ${ETCDIR}/mimetype.conf
 CONF_FILES+=   ${EGDIR}/cgi-wrapper.conf ${ETCDIR}/cgi-wrapper.conf
 
-INSTALLATION_DIRS+=    ${EGDIR}
+INSTALLATION_DIRS+=    ${EGDIR} ${RCDIR}
+
+RCD_SCRIPTS=   hiawatha
 
 post-install:
        ${MV} ${DESTDIR}${ETCDIR}/hiawatha.conf ${DESTDIR}${EGDIR}
index 7a5a8f3898428d0249e26815219f52915d591747..afe46371b803b66f262bacf11d25593ed2525378 100644 (file)
@@ -122,6 +122,7 @@ share/examples/hiawatha/error.xslt
 share/examples/hiawatha/hiawatha.conf
 share/examples/hiawatha/index.xslt
 share/examples/hiawatha/mimetype.conf
+share/examples/rc.d/hiawatha
 var/hiawatha/index.html
 @pkgdir var/run
 @pkgdir var/log/hiawatha
index 87511982fab9c837cb1b95a734a735e062a650d8..397c9504ff20a09c1547e10b19f6a24b244b0f9d 100644 (file)
@@ -1,2 +1,2 @@
 test
-rc file
+monitor option
diff --git a/hiawatha/files/hiawatha.sh b/hiawatha/files/hiawatha.sh
new file mode 100644 (file)
index 0000000..63c25f9
--- /dev/null
@@ -0,0 +1,39 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: $
+#
+# PROVIDE: hiawatha
+# REQUIRE: DAEMON
+
+pidfile=/usr/pkg/var/run/hiawatha.pid
+
+name="hiawatha"
+command="hiawatha"
+
+cmd=${1:-start}
+
+case ${cmd} in
+       start)
+               echo "Starting ${name}."
+               ${command}&
+               echo $! > ${pidfile}
+               ;;
+
+       stop)
+               echo "Stopping ${name}."
+               kill `cat ${pidfile}`
+               rm ${pidfile}
+               ;;
+
+       restart)
+               ( $0 stop )
+               sleep 5
+               $0 start
+               ;;
+
+       *)
+               echo 1>&2 "Usage: $0 [restart|start|stop]"
+               exit 1
+               ;;
+esac
+exit 0