Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 May 2026 15:03:22 +0000
From:      Mateusz Piotrowski <0mp@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Cc:        Derek Schrock <dereks@lifeofadishwasher.com>
Subject:   git: 3d5723cdc929 - main - www/tt-rss: Run ttrssd as ttrssd user and move data to /var
Message-ID:  <6a0c7bba.40b62.3eb4a9cb@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by 0mp:

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

commit 3d5723cdc92963d879b8978a96a81c5adc255ac2
Author:     Derek Schrock <dereks@lifeofadishwasher.com>
AuthorDate: 2026-05-19 14:58:17 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2026-05-19 15:02:54 +0000

    www/tt-rss: Run ttrssd as ttrssd user and move data to /var
    
    - Create a ttrssd user and group to run ttrssd.
    - Move log file to /var/log/tt-rss directorie.
    - Move pid files to /var/run/tt-rss directorie.
    - Move on disk data to /var/tt-rss/.
    
    PR:             282245
    Approved by:    maintainer
    Differential Revision:  https://reviews.freebsd.org/D49128
---
 GIDs                              |  2 +-
 UIDs                              |  2 +-
 www/tt-rss/Makefile               | 26 ++++++++++++++++++++--
 www/tt-rss/files/config.php.in    |  8 +++++++
 www/tt-rss/files/newsyslog.sample |  2 +-
 www/tt-rss/files/start.sh.in      | 12 +++++++++++
 www/tt-rss/files/ttrssd.in        | 32 ++++++++++++++++++++--------
 www/tt-rss/pkg-plist              | 45 +++++++++++++++++++++++----------------
 8 files changed, 97 insertions(+), 32 deletions(-)

diff --git a/GIDs b/GIDs
index 667f4b2c7287..1c59c25fb85c 100644
--- a/GIDs
+++ b/GIDs
@@ -512,7 +512,7 @@ polkitd:*:565:
 # free: 568
 # free: 569
 # free: 570
-# free: 571
+ttrssd:*:571:
 # free: 572
 # free: 573
 # free: 574
diff --git a/UIDs b/UIDs
index 9a78d86ae02f..0e6ddb206356 100644
--- a/UIDs
+++ b/UIDs
@@ -518,7 +518,7 @@ polkitd:*:565:565::0:0:Polkit Daemon User:/var/empty:/usr/sbin/nologin
 # free: 568
 # free: 569
 # free: 570
-# free: 571
+ttrssd:*:571:571::0:0:ttrssd user:/nonexistent:/usr/sbin/nologin
 # free: 572
 # free: 573
 # free: 574
diff --git a/www/tt-rss/Makefile b/www/tt-rss/Makefile
index 03d20a7fd54d..ce46b3639153 100644
--- a/www/tt-rss/Makefile
+++ b/www/tt-rss/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	tt-rss
 DISTVERSION=	g20260501
+PORTREVISION=	1
 PORTEPOCH=	2
 CATEGORIES=	www
 PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
@@ -27,9 +28,12 @@ SHEBANG_FILES=	update.php update_daemon2.php
 NO_ARCH=	yes
 NO_BUILD=	yes
 
-SUB_FILES=	config.php httpd-tt-rss.conf pkg-message
+SUB_FILES=	config.php httpd-tt-rss.conf pkg-message start.sh
 SUB_LIST=	WWWOWN=${WWWOWN}
 
+USERS=		ttrssd
+GROUPS=		ttrssd
+
 PLIST_SUB=	WWWGRP=${WWWGRP} \
 		WWWOWN=${WWWOWN}
 
@@ -50,12 +54,30 @@ do-install:
 	(cd ${WRKSRC} && ${COPYTREE_SHARE} "*" ${STAGEDIR}${WWWDIR} \
 		"! -name LICENSE ! -name .empty ! -name docker-compose.yml")
 	${INSTALL_DATA} ${WRKDIR}/httpd-tt-rss.conf ${STAGEDIR}${DATADIR}
-	${ECHO} "${OPSYS}:${PORTVERSION}:${GH_TAGNAME:C/^(.{11}).*$/\1/W}}" > \
+	${ECHO} "${OPSYS}:${PORTVERSION}:${GH_TAGNAME:C/^(.{11}).*$/\1/W}" > \
 		"${STAGEDIR}${WWWDIR}/version_static.txt"
 	${RM} ${STAGEDIR}${WWWDIR}/config.php-dist
 	${INSTALL_DATA} ${WRKDIR}/config.php \
 		${STAGEDIR}${WWWDIR}/config.php.sample
 	${INSTALL_DATA} ${FILESDIR}/newsyslog.sample \
 		${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKDIR}/start.sh ${STAGEDIR}${WWWDIR}
+	${MKDIR} ${STAGEDIR}/var/log/ttrssd
+	${MKDIR} ${STAGEDIR}/var/run/ttrssd
+
+	${MKDIR} ${STAGEDIR}/var/tt-rss
+	${MV}	${STAGEDIR}${WWWDIR}/cache \
+		${STAGEDIR}${WWWDIR}/lock \
+			${STAGEDIR}/var/tt-rss
+
+	${MKDIR} ${STAGEDIR}/var/tt-rss/local/
+	${MV}	${STAGEDIR}${WWWDIR}/plugins.local \
+		${STAGEDIR}${WWWDIR}/templates.local \
+		${STAGEDIR}${WWWDIR}/themes.local \
+			${STAGEDIR}/var/tt-rss/local
+
+	${MKDIR} ${STAGEDIR}/var/tt-rss/local/plugins/af_comics
+	${MV} ${STAGEDIR}${WWWDIR}/plugins/af_comics/filters.local \
+		${STAGEDIR}/var/tt-rss/local/plugins/af_comics
 
 .include <bsd.port.mk>
diff --git a/www/tt-rss/files/config.php.in b/www/tt-rss/files/config.php.in
index 75cf4aa9c350..6a629758aa6a 100644
--- a/www/tt-rss/files/config.php.in
+++ b/www/tt-rss/files/config.php.in
@@ -21,6 +21,14 @@
 	# Required for plugin installer usage of git
 	putenv("PATH=%%LOCALBASE%%/bin/:" . getenv("PATH"));
 
+	putenv('TTRSS_CACHE_DIR=/var/tt-rss/cache');
+	putenv('TTRSS_ICONS_DIR=/var/tt-rss/feed-icons');
+	putenv('TTRSS_LOCK_DIRECTORY=/var/tt-rss/lock');
+
+	putenv('TTRSS_LOCAL_PLUGINS_DIR=/var/tt-rss/local/plugins.local');
+	putenv('TTRSS_LOCAL_TEMPLATES_DIR=/var/tt-rss/local/templates.local');
+	putenv('TTRSS_LOCAL_THEMES_DIR=/var/tt-rss/local/themes.local');
+
 	#putenv('TTRSS_SINGLE_USER_MODE=true');
 
 	#putenv('TTRSS_SELF_URL_PATH=');
diff --git a/www/tt-rss/files/newsyslog.sample b/www/tt-rss/files/newsyslog.sample
index 7b02a07fafad..2794dfa7df45 100644
--- a/www/tt-rss/files/newsyslog.sample
+++ b/www/tt-rss/files/newsyslog.sample
@@ -1 +1 @@
-/var/log/ttrssd.log root:wheel 644 3 * $W0 JC /var/run/ttrssd.pid
+/var/log/ttrssd/ttrssd.log ttrssd:ttrssd 660 3 * $W0 JC /var/run/ttrssd/ttrssd.pid
diff --git a/www/tt-rss/files/start.sh.in b/www/tt-rss/files/start.sh.in
new file mode 100644
index 000000000000..68ad495f89f7
--- /dev/null
+++ b/www/tt-rss/files/start.sh.in
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+trap 'kill -INT $child' INT
+trap 'kill -TERM $child' TERM
+
+%%WWWDIR%%/update.php --update-schema=force-yes
+%%WWWDIR%%/update_daemon2.php &
+
+child="$!"
+
+wait "$child"
+
diff --git a/www/tt-rss/files/ttrssd.in b/www/tt-rss/files/ttrssd.in
index 6fdd8b6ea1f3..c951af69780b 100644
--- a/www/tt-rss/files/ttrssd.in
+++ b/www/tt-rss/files/ttrssd.in
@@ -17,23 +17,37 @@ rcvar=ttrssd_enable
 
 # read settings, set default values
 load_rc_config "${name}"
-: ${ttrssd_enable="NO"}
+: ${ttrssd_enable=NO}
+: ${ttrssd_user="$name"}
+: ${ttrssd_group="$name"}
 
 long_name="Tiny Tiny RSS updating feeds daemon."
 required_files="%%WWWDIR%%/config.php"
-pidfile="/var/run/${name}.pid"
-cpidfile="/var/run/${name}_child.pid"
+pidfile="/var/run/${name}/${name}.pid"
+cpidfile="/var/run/${name}/${name}_child.pid"
 phpcli="%%LOCALBASE%%/bin/php"
 
 initdb_php="%%WWWDIR%%/update.php"
 phpupd="%%WWWDIR%%/update_daemon2.php"
-ttrssd_log="/var/log/${name}.log"
+ttrssd_log="/var/log/${name}/${name}.log"
 
+ttrssd_cmd="%%WWWDIR%%/start.sh"
+ttrssd_umask="0003"
 command="/usr/sbin/daemon"
-command_args="-rR 10 -H -u %%WWWOWN%% \
-		-P $pidfile -p $cpidfile \
-		-o $ttrssd_log sh -c \
-		'$initdb_php --update-schema=force-yes; \
-			$phpupd;'"
+command_args="-rR 10 -H -P $pidfile -p $cpidfile \
+		-o $ttrssd_log $ttrssd_cmd"
+
+start_precmd="${name}_start_precmd"
+
+ttrssd_start_precmd()
+{
+    # daemon defaults to 0600 when using -o
+    if [ -f "$ttrssd_log" ]; then
+	if ! chown "$ttrssd_user" "$ttrssd_log"; then
+		echo "Setting ${ttrssd_log} owner failed"
+		exit 1
+	fi
+    fi
+}
 
 run_rc_command "$1"
diff --git a/www/tt-rss/pkg-plist b/www/tt-rss/pkg-plist
index 07651bc017b1..b06394d31f7a 100644
--- a/www/tt-rss/pkg-plist
+++ b/www/tt-rss/pkg-plist
@@ -1,28 +1,39 @@
 %%DATADIR%%/httpd-tt-rss.conf
+@dir /var/tt-rss
 @sample %%EXAMPLESDIR%%/newsyslog.sample etc/newsyslog.conf.d/ttrssd.conf
-@group %%WWWGRP%%
-@mode ug=rx
+@dir etc/newsyslog.conf.d
+@group ttrssd
+@mode 0454
+%%WWWDIR%%/start.sh
+@owner %%WWWOWN%%
 %%WWWDIR%%/update.php
 %%WWWDIR%%/update_daemon2.php
-@group
 @mode
-@owner %%WWWOWN%%
-@mode 0400
+@mode 0440
 @sample %%WWWDIR%%/config.php.sample
-@mode
-@dir %%WWWDIR%%/cache
-@dir %%WWWDIR%%/cache/export
-@dir %%WWWDIR%%/cache/feeds
-@dir %%WWWDIR%%/cache/images
-@dir %%WWWDIR%%/cache/upload
-@dir %%WWWDIR%%/lock
-@dir %%WWWDIR%%/plugins.local
-@dir %%WWWDIR%%/plugins/af_comics/filters.local
-@dir %%WWWDIR%%/templates.local
-@dir %%WWWDIR%%/themes.local
+@mode 0770
+@dir /var/tt-rss/cache
+@dir /var/tt-rss/cache/export
+@dir /var/tt-rss/cache/feeds
+@dir /var/tt-rss/cache/images
+@dir /var/tt-rss/cache/upload
+@dir /var/tt-rss/lock
+@dir /var/tt-rss/local/plugins.local
+@dir /var/tt-rss/local/plugins/af_comics/filters.local
+@dir /var/tt-rss/local/templates.local
+@dir /var/tt-rss/local/themes.local
 @owner
+@group ttrssd
+@mode 775
+@dir /var/log/ttrssd
+@dir /var/run/ttrssd
+@dir /var/tt-rss/local
+@dir /var/tt-rss/local/plugins
+@dir /var/tt-rss/local/plugins/af_comics
 @group
 @mode
+/var/tt-rss/local/plugins.local/index.html
+/var/tt-rss/local/templates.local/index.html
 %%WWWDIR%%/CONTRIBUTING.md
 %%WWWDIR%%/COPYING
 %%WWWDIR%%/README.md
@@ -2008,7 +2019,6 @@
 %%WWWDIR%%/package.json
 %%WWWDIR%%/phpstan.neon
 %%WWWDIR%%/phpunit.xml
-%%WWWDIR%%/plugins.local/index.html
 %%WWWDIR%%/plugins/af_comics/af_comics_template.php
 %%WWWDIR%%/plugins/af_comics/filter_base.php
 %%WWWDIR%%/plugins/af_comics/filters/af_comics_cad.php
@@ -2209,7 +2219,6 @@
 %%WWWDIR%%/sql/pgsql/migrations/150.sql
 %%WWWDIR%%/sql/pgsql/migrations/151.sql
 %%WWWDIR%%/sql/pgsql/schema.sql
-%%WWWDIR%%/templates.local/index.html
 %%WWWDIR%%/templates/digest_template.txt
 %%WWWDIR%%/templates/digest_template_html.txt
 %%WWWDIR%%/templates/email_article_template.txt


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a0c7bba.40b62.3eb4a9cb>