git: 9884951c508e - main - www/darkhttpd: add rc script
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 06 Oct 2022 16:09:15 UTC
The branch main has been updated by fernape:
URL: https://cgit.FreeBSD.org/ports/commit/?id=9884951c508e52eefb91fac9ea35375a267dcf3e
commit 9884951c508e52eefb91fac9ea35375a267dcf3e
Author: Jesús Daniel Colmenares Oviedo <DtxdF@disroot.org>
AuthorDate: 2022-10-06 06:07:08 +0000
Commit: Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2022-10-06 16:05:41 +0000
www/darkhttpd: add rc script
PR: 266239
Reported by: DtxdF@disroot.org
Approved by: henrichartzer@tuta.io (maintainer, timeout > 1 month)
---
GIDs | 2 +-
UIDs | 2 +-
www/darkhttpd/Makefile | 15 ++++++++++++++-
www/darkhttpd/files/darkhttpd.in | 31 +++++++++++++++++++++++++++++++
www/darkhttpd/pkg-plist | 3 +++
5 files changed, 50 insertions(+), 3 deletions(-)
diff --git a/GIDs b/GIDs
index 743b8d57e5e9..4c31b24ae02b 100644
--- a/GIDs
+++ b/GIDs
@@ -629,7 +629,7 @@ riak:*:667:
# free: 685
# free: 686
# free: 687
-# free: 688
+darkhttpd:*:688:
# free: 689
# free: 690
# free: 691
diff --git a/UIDs b/UIDs
index 1fa5eb54fad1..37aa3204edcd 100644
--- a/UIDs
+++ b/UIDs
@@ -634,7 +634,7 @@ stanchion:*:669:667::0:0:Stanchion user:/usr/local/lib/stanchion:/bin/sh
# free: 685
# free: 686
# free: 687
-# free: 688
+darkhttpd:*:688:688::0:0:Simple, static web server:/nonexistent:/usr/sbin/nologin
# free: 689
# free: 690
# free: 691
diff --git a/www/darkhttpd/Makefile b/www/darkhttpd/Makefile
index f190671eeb20..06b933fec0e4 100644
--- a/www/darkhttpd/Makefile
+++ b/www/darkhttpd/Makefile
@@ -1,6 +1,7 @@
PORTNAME= darkhttpd
DISTVERSIONPREFIX= v
DISTVERSION= 1.13
+PORTREVISION= 1
CATEGORIES= www
MAINTAINER= henrichartzer@tuta.io
@@ -13,12 +14,24 @@ USES= cpe
CPE_VENDOR= darkhttpd_project
+USE_RC_SUBR= darkhttpd
USE_GITHUB= yes
GH_ACCOUNT= emikulic
-PLIST_FILES= bin/darkhttpd
+USERS= darkhttpd
+GROUPS= darkhttpd
+
+SUB_LIST= USER=${USERS:[1]} \
+ GROUP=${GROUPS:[1]}
+
+PLIST_SUB= USER=${USERS:[1]} \
+ GROUP=${GROUPS:[1]}
do-install:
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${PORTNAME} ${STAGEDIR}${LOCALBASE}/bin
+post-install:
+ ${INSTALL} -d ${STAGEDIR}${WWWDIR}
+ ${INSTALL} -d ${STAGEDIR}/var/run/darkhttpd
+
.include <bsd.port.mk>
diff --git a/www/darkhttpd/files/darkhttpd.in b/www/darkhttpd/files/darkhttpd.in
new file mode 100644
index 000000000000..43b7e3d23fb0
--- /dev/null
+++ b/www/darkhttpd/files/darkhttpd.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# PROVIDE: darkhttpd
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Configuration settings for darkhttpd in /etc/rc.conf
+#
+# darkhttpd_enable (bool): Enable darkhttpd. (default=NO)
+# darkhttpd_dir (str): WWW root directory. (default=%%WWWDIR%%)
+# darkhttpd_flags (str): Flags used for darkhttpd. (default=--uid %%USER%% --gid %%GROUP%%)
+#
+
+. /etc/rc.subr
+
+name="darkhttpd"
+rcvar="${name}_enable"
+
+load_rc_config $name
+
+: ${darkhttpd_enable:="NO"}
+: ${darkhttpd_dir:=%%WWWDIR%%}
+: ${darkhttpd_flags=--uid %%USER%% --gid %%GROUP%%}
+
+darkhttpd_flags="${darkhttpd_dir} ${darkhttpd_flags}"
+
+command="%%LOCALBASE%%/bin/darkhttpd"
+pidfile="/var/run/darkhttpd/darkhttpd.pid"
+command_args="--daemon --pidfile ${pidfile}"
+
+run_rc_command "$1"
diff --git a/www/darkhttpd/pkg-plist b/www/darkhttpd/pkg-plist
new file mode 100644
index 000000000000..b4cfa3a1eb4b
--- /dev/null
+++ b/www/darkhttpd/pkg-plist
@@ -0,0 +1,3 @@
+bin/darkhttpd
+@dir %%WWWDIR%%
+@dir(%%USER%%,%%GROUP%%,755) /var/run/darkhttpd