git: 79ee4ac44001 - main - www/shiori: Add rc script

From: Jesús Daniel Colmenares Oviedo <dtxdf_at_FreeBSD.org>
Date: Thu, 10 Jul 2025 00:32:18 UTC
The branch main has been updated by dtxdf:

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

commit 79ee4ac44001cbfa9ea62ae058dc3dcafb64a47c
Author:     Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
AuthorDate: 2025-06-24 18:12:30 +0000
Commit:     Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
CommitDate: 2025-07-10 00:29:29 +0000

    www/shiori: Add rc script
    
    - Bump golang version to 1.23
    - Add rc script
    - Create shiori user and group
    
    PR:             287780
    Approved by:    maintainer timeout (15 days)
    Approved by:    acm (mentor)
---
 GIDs                       |  2 +-
 UIDs                       |  2 +-
 www/shiori/Makefile        | 19 +++++++++++++++++--
 www/shiori/files/shiori.in | 32 ++++++++++++++++++++++++++++++++
 4 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/GIDs b/GIDs
index f9fa5c057101..119e457e06f1 100644
--- a/GIDs
+++ b/GIDs
@@ -780,7 +780,7 @@ filebrowser:*:835:
 tinyauth:*:836:
 homebox:*:837:
 # free: 838
-# free: 839
+shiori:*:839:
 netdisco:*:840:
 tcpcryptd:*:841:
 munin:*:842:
diff --git a/UIDs b/UIDs
index e852d87c9771..4f251d5de24f 100644
--- a/UIDs
+++ b/UIDs
@@ -786,7 +786,7 @@ filebrowser:*:835:835::0:0:Web File Browser:/var/db/filebrowser:/usr/sbin/nologi
 tinyauth:*:836:836::0:0:Simplest way to protect your apps with a login screen:/nonexistent:/usr/sbin/nologin
 homebox:*:837:837::0:0:Inventory and organization system built for the Home User:/var/db/homebox:/usr/sbin/nologin
 # free: 838
-# free: 839
+shiori:*:839:839::0:0:Simple bookmark manager built with Go:/var/db/shiori:/usr/sbin/nologin
 netdisco:*:840:840::0:0:netdisco daemon:/usr/local/etc/netdisco:/bin/sh
 tcpcryptd:*:841:841::0:0:tcpcrypt daemon:/nonexistent:/usr/sbin/nologin
 munin:*:842:842::0:0:Munin:/var/munin:/usr/sbin/nologin
diff --git a/www/shiori/Makefile b/www/shiori/Makefile
index a8bafe630a2e..b70a02b7be85 100644
--- a/www/shiori/Makefile
+++ b/www/shiori/Makefile
@@ -10,11 +10,23 @@ WWW=		https://github.com/go-shiori/shiori
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-USES=		go:1.22,modules
+USES=		go:1.23,modules
+USE_RC_SUBR=	${PORTNAME}
 
 GO_MODULE=	github.com/go-shiori/shiori
 
-PLIST_FILES=	bin/${PORTNAME}
+SUB_LIST=	USER=${USERS:[1]} \
+		HOMEDIR=${SHIORI_HOMEDIR}
+
+USERS=		${SHIORI_USER}
+GROUPS=		${SHIORI_GROUP}
+
+PLIST_FILES=	bin/${PORTNAME} \
+		"@dir(${SHIORI_USER},${SHIORI_GROUP},0700) ${SHIORI_HOMEDIR}"
+
+SHIORI_HOMEDIR=	/var/db/${SHIORI_USER}
+SHIORI_USER=	${PORTNAME}
+SHIORI_GROUP=	${SHIORI_USER}
 
 BUILD_DATE=	%FT%T
 
@@ -27,4 +39,7 @@ post-patch:
 		${WRKSRC}/main.go \
 		${WRKSRC}/internal/model/main.go
 
+post-install:
+	@${MKDIR} ${STAGEDIR}${SHIORI_HOMEDIR}
+
 .include <bsd.port.mk>
diff --git a/www/shiori/files/shiori.in b/www/shiori/files/shiori.in
new file mode 100644
index 000000000000..4237867a73e7
--- /dev/null
+++ b/www/shiori/files/shiori.in
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# PROVIDE: shiori
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Configuration settings for shiori in /etc/rc.conf
+#
+# shiori_enable (bool):    Enable shiori. (default=NO)
+# shiori_log (str):        Log output. (default=/var/log/shiori.log)
+# shiori_runas (str):      User to run shiori as. (default=%%USER%%)
+#
+
+. /etc/rc.subr
+
+name="shiori"
+desc="Simple bookmark manager built with Go"
+rcvar="${name}_enable"
+
+load_rc_config $name
+
+: ${shiori_enable:="NO"}
+: ${shiori_log:="/var/log/shiori.log"}
+: ${shiori_runas:="%%USER%%"}
+: ${shiori_datadir:="%%HOMEDIR%%"}
+
+pidfile="/var/run/${name}.pid"
+procname="%%LOCALBASE%%/bin/${name}"
+command="/usr/sbin/daemon"
+command_args="-c -u '${shiori_runas}' -p '${pidfile}' -t '${desc}' -o '${shiori_log}' '${procname}' server --storage-directory '${shiori_datadir}' ${shiori_args}"
+
+run_rc_command "$1"