www-apps/tt-rss: new package, add 20230505
This commit is contained in:
parent
a082239b4e
commit
cc80774c28
1
www-apps/tt-rss/Manifest
Normal file
1
www-apps/tt-rss/Manifest
Normal file
|
@ -0,0 +1 @@
|
|||
DIST tt-rss-20230505.tar.gz 8356703 BLAKE2B e5ebc10caf6935249e538a7b241b27cad8f15991551762c940b73b8669da526270568c178159735854b600108593708c17ab31316c2db3fe13e91b022abbb50f SHA512 cda1dc759e99a1a55760426bf6acc4e5272e75c0c37fc4f51857b3a3800c759b852de2d846d32f5fd2f0c9fc06d19d4c3f1b43c00edd77fe809b6123dbf868d5
|
24
www-apps/tt-rss/files/permissions-r1
Normal file
24
www-apps/tt-rss/files/permissions-r1
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
cd "${MY_INSTALLDIR}"
|
||||
|
||||
if [[ $1 = install ]]; then
|
||||
# We need to lock down cache/ for the operations below to be
|
||||
# safe. The permissions match the webapp-config defaults but these
|
||||
# can be changed and existing installations may also differ.
|
||||
chown root:root cache/
|
||||
chmod 00755 cache/
|
||||
|
||||
chgrp --no-dereference ttrssd feed-icons/ lock/ cache/*/
|
||||
chmod g+ws feed-icons/ lock/ cache/*/
|
||||
|
||||
# Files within lock/ are exclusively written by the update daemon.
|
||||
# feed-icons/ and cache/ holds files that are modified in place by both
|
||||
# processes and therefore ACLs are required to ensure that the files
|
||||
# themselves are created as group writable.
|
||||
if ! setfacl --modify d:g::rwX feed-icons/ cache/*/; then
|
||||
echo "WARNING: ACLs are not available on this filesystem. Either enable them or set TTRSSD_USER to your PHP user in /etc/conf.d/ttrssd to avoid permission issues."
|
||||
elif [[ -n $(find feed-icons/ cache/ -type f ! -name ".*" ! -name index.html ! \( -group ttrssd -perm -020 \) -print -quit) ]]; then
|
||||
echo "WARNING: Files that are not writable by the ttrssd group found within the cache or feed-icons directories. Either delete them or correct their permissions."
|
||||
fi
|
||||
fi
|
15
www-apps/tt-rss/files/postinstall-en-with-daemon-r1.txt
Normal file
15
www-apps/tt-rss/files/postinstall-en-with-daemon-r1.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
Please read https://tt-rss.org/wiki/GlobalConfig. Note that the configuration
|
||||
syntax changed in 2021.
|
||||
|
||||
Once you have configured TT-RSS, tweak /etc/conf.d/ttrssd to your
|
||||
needs if you have not already done so. If ACLs are unavailable on the
|
||||
filesystem you have just installed to then you will need to set
|
||||
TTRSSD_USER to your PHP user. When everything is ready, (re)start the
|
||||
update daemon like so:
|
||||
|
||||
/etc/init.d/ttrssd restart
|
||||
|
||||
This will periodically update your feeds in the background. Add the
|
||||
daemon to your default runlevel to start it on every boot:
|
||||
|
||||
rc-update add ttrssd default
|
2
www-apps/tt-rss/files/postinstall-en.txt
Normal file
2
www-apps/tt-rss/files/postinstall-en.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Please read https://tt-rss.org/wiki/GlobalConfig. Note that the configuration
|
||||
syntax changed in 2021.
|
26
www-apps/tt-rss/files/tt-rss-no-chmod.patch
Normal file
26
www-apps/tt-rss/files/tt-rss-no-chmod.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
These files may be written and then updated by the web interface user or the
|
||||
update daemon user, so they need to be group writeable. We enforce this with
|
||||
ACLs rather than chmod though.
|
||||
|
||||
diff --color -Naur a/classes/pref/feeds.php b/classes/pref/feeds.php
|
||||
--- a/classes/pref/feeds.php 2022-02-18 13:44:03.000000000 +0000
|
||||
+++ b/classes/pref/feeds.php 2022-02-19 15:37:55.000723992 +0000
|
||||
@@ -490,7 +490,6 @@
|
||||
|
||||
if (file_exists($new_filename)) unlink($new_filename);
|
||||
if (rename($tmp_file, $new_filename)) {
|
||||
- chmod($new_filename, 0644);
|
||||
|
||||
$feed->set([
|
||||
'favicon_avg_color' => null,
|
||||
diff --color -Naur a/classes/rssutils.php b/classes/rssutils.php
|
||||
--- a/classes/rssutils.php 2022-02-18 13:44:03.000000000 +0000
|
||||
+++ b/classes/rssutils.php 2022-02-19 15:37:40.393312123 +0000
|
||||
@@ -1728,7 +1728,6 @@
|
||||
|
||||
fwrite($fp, $contents);
|
||||
fclose($fp);
|
||||
- chmod($icon_file, 0644);
|
||||
clearstatcache();
|
||||
|
||||
return $icon_file;
|
47
www-apps/tt-rss/files/ttrssd.confd-r2
Normal file
47
www-apps/tt-rss/files/ttrssd.confd-r2
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Copyright 1999-2018 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# Space-separated paths of TT-RSS instances that you want to start the
|
||||
# update daemon for. If left empty, these will be automatically
|
||||
# detected using data from /var/db/webapps/tt-rss. Instances without
|
||||
# the update_daemon2.php script present will be skipped.
|
||||
#
|
||||
# Default:
|
||||
# INSTANCE_DIRS=""
|
||||
# Example:
|
||||
# INSTANCE_DIRS="/some/webhost/htdocs/tt-rss /some/otherwebhost/htdocs/newsreader"
|
||||
#
|
||||
INSTANCE_DIRS=""
|
||||
|
||||
# Path to the log files. One log file will be created for each TT-RSS
|
||||
# instance. Update the logrotate file after changing this.
|
||||
#
|
||||
# Default:
|
||||
# LOG_DIR="/var/log/ttrssd"
|
||||
#
|
||||
LOG_DIR="/var/log/ttrssd"
|
||||
|
||||
# User to run the update daemon as. You should not run this as
|
||||
# root. If ACLs are unavailable on the filesystem used by the TT-RSS
|
||||
# instances then choosing the same user that serves the PHP web
|
||||
# interface is recommended to avoid permission issues. You *must* add
|
||||
# this user to the ttrssd group. If the PHP user is not the same as
|
||||
# the web server user (e.g. apache or nginx) then this user must be
|
||||
# added to the ttrssd group too.
|
||||
#
|
||||
# Default:
|
||||
# TTRSSD_USER="ttrssd"
|
||||
#
|
||||
TTRSSD_USER="ttrssd"
|
||||
|
||||
# Additional options to pass to the update daemon. If you want to pass
|
||||
# different options to different TT-RSS instances then create symlinks
|
||||
# of the ttrssd init.d script (e.g. ttrssd.foo, ttrssd.bar) and
|
||||
# configure INSTANCE_DIRS and TTRSSD_OPTS for each of these.
|
||||
#
|
||||
# Default:
|
||||
# TTRSSD_OPTS=""
|
||||
# Example:
|
||||
# TTRSSD_OPTS="--tasks=1 --interval=300"
|
||||
#
|
||||
TTRSSD_OPTS=""
|
119
www-apps/tt-rss/files/ttrssd.initd-r4
Normal file
119
www-apps/tt-rss/files/ttrssd.initd-r4
Normal file
|
@ -0,0 +1,119 @@
|
|||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2022 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
command="/usr/bin/php"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after postgresql mysql
|
||||
}
|
||||
|
||||
PID_DIR="/run/ttrssd"
|
||||
LOG_DIR=${LOG_DIR:-"/var/log/ttrssd"}
|
||||
TTRSSD_USER=${TTRSSD_USER:-"ttrssd"}
|
||||
|
||||
list_instance_dirs() {
|
||||
if [ -z "${INSTANCE_DIRS}" ]; then
|
||||
cut -d" " -f4 /var/db/webapps/tt-rss/*/installs 2>/dev/null
|
||||
else
|
||||
printf "%s\n" ${INSTANCE_DIRS}
|
||||
fi
|
||||
}
|
||||
|
||||
instance_dir_to_name() {
|
||||
local name
|
||||
|
||||
name=${1#/}
|
||||
printf %s "${name}" | awk '{
|
||||
gsub("/", "--");
|
||||
print $0;
|
||||
}'
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
mkdir -p "${PID_DIR}" "${LOG_DIR}" || return 1
|
||||
chown "${TTRSSD_USER}":ttrssd "${LOG_DIR}" || return 1
|
||||
}
|
||||
|
||||
start() {
|
||||
local instance_dir instance_name ret=1
|
||||
|
||||
IFS="
|
||||
"
|
||||
for instance_dir in $(list_instance_dirs); do
|
||||
if [ -d "${instance_dir}" ]; then
|
||||
if [ ! -f "${instance_dir}"/update_daemon2.php ]; then
|
||||
ewarn "TT-RSS instance in ${instance_dir} has no update_daemon2.php script"
|
||||
elif [ ! -f "${instance_dir}"/config.php ]; then
|
||||
eerror "TT-RSS instance in ${instance_dir} is not configured"
|
||||
else
|
||||
instance_name=$(instance_dir_to_name "${instance_dir}")
|
||||
ebegin "Starting TT-RSS update daemon in ${instance_dir}"
|
||||
start-stop-daemon --start --user "${TTRSSD_USER}":ttrssd \
|
||||
--background --wait 2000 \
|
||||
--stdout "${LOG_DIR}/${instance_name}.log" \
|
||||
--stderr "${LOG_DIR}/${instance_name}.log" \
|
||||
--make-pidfile --pidfile "${PID_DIR}/${instance_name}.pid" \
|
||||
--exec /usr/bin/php -- -f "${instance_dir}"/update_daemon2.php \
|
||||
-- ${TTRSSD_OPTS}
|
||||
eend $? && ret=0
|
||||
fi
|
||||
else
|
||||
eerror "TT-RSS instance in ${instance_dir} is missing"
|
||||
fi
|
||||
done
|
||||
unset IFS
|
||||
|
||||
# Succeed if at least one started.
|
||||
return ${ret}
|
||||
}
|
||||
|
||||
stop() {
|
||||
local instance_dir instance_name
|
||||
|
||||
IFS="
|
||||
"
|
||||
for instance_dir in $(list_instance_dirs); do
|
||||
instance_name=$(instance_dir_to_name "${instance_dir}")
|
||||
|
||||
[ -f "${PID_DIR}/${instance_name}.pid" ] ||
|
||||
[ -f "${instance_dir}"/update_daemon2.php ] ||
|
||||
continue
|
||||
|
||||
ebegin "Stopping TT-RSS update daemon in ${instance_dir}"
|
||||
start-stop-daemon --stop --retry 5 --pidfile "${PID_DIR}/${instance_name}.pid" \
|
||||
--exec /usr/bin/php -- -f "${instance_dir}"/update_daemon2.php \
|
||||
-- ${TTRSSD_OPTS}
|
||||
eend $?
|
||||
|
||||
rm -f "${instance_dir}"/lock/*.lock
|
||||
done
|
||||
unset IFS
|
||||
|
||||
# Always succeed.
|
||||
return 0
|
||||
}
|
||||
|
||||
status() {
|
||||
local instance_dir instance_name pid
|
||||
|
||||
IFS="
|
||||
"
|
||||
for instance_dir in $(list_instance_dirs); do
|
||||
instance_name=$(instance_dir_to_name "${instance_dir}")
|
||||
|
||||
[ -f "${PID_DIR}/${instance_name}.pid" ] ||
|
||||
[ -f "${instance_dir}"/update_daemon2.php ] ||
|
||||
continue
|
||||
|
||||
if start-stop-daemon --signal 0 --pidfile "${PID_DIR}/${instance_name}.pid"; then
|
||||
# At least one instance is running
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
unset IFS
|
||||
|
||||
# No instances are running
|
||||
return 3
|
||||
}
|
9
www-apps/tt-rss/files/ttrssd.logrotated-r1
Normal file
9
www-apps/tt-rss/files/ttrssd.logrotated-r1
Normal file
|
@ -0,0 +1,9 @@
|
|||
/var/log/ttrssd/*.log {
|
||||
daily
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
postrotate
|
||||
/etc/init.d/ttrssd restart > /dev/null
|
||||
endscript
|
||||
}
|
12
www-apps/tt-rss/metadata.xml
Normal file
12
www-apps/tt-rss/metadata.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>chewi@gentoo.org</email>
|
||||
<name>James Le Cuirot</name>
|
||||
</maintainer>
|
||||
<stabilize-allarches/>
|
||||
<use>
|
||||
<flag name="daemon">Install additional init scripts for automated RSS updates</flag>
|
||||
</use>
|
||||
</pkgmetadata>
|
90
www-apps/tt-rss/tt-rss-20230505.ebuild
Normal file
90
www-apps/tt-rss/tt-rss-20230505.ebuild
Normal file
|
@ -0,0 +1,90 @@
|
|||
# Copyright 1999-2022 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit webapp
|
||||
|
||||
DESCRIPTION="Tiny Tiny RSS - A web-based news feed (RSS/Atom) aggregator using AJAX"
|
||||
HOMEPAGE="https://tt-rss.org/"
|
||||
SRC_URI="https://herbizarre.swordarmor.fr/garbage/${P}.tar.gz" # Upstream git frontend blocks wget?
|
||||
LICENSE="GPL-3"
|
||||
KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
|
||||
IUSE="+acl daemon gd +mysqli postgres"
|
||||
REQUIRED_USE="|| ( mysqli postgres )"
|
||||
|
||||
PHP_SLOTS="8.0 7.4"
|
||||
PHP_USE="gd?,mysqli?,postgres?,curl,fileinfo,intl,json(+),pdo,unicode,xml"
|
||||
|
||||
php_rdepend() {
|
||||
local slot
|
||||
echo "|| ("
|
||||
for slot in ${PHP_SLOTS}; do
|
||||
echo "(
|
||||
virtual/httpd-php:${slot}
|
||||
dev-lang/php:${slot}[$1]
|
||||
)"
|
||||
done
|
||||
echo ")"
|
||||
}
|
||||
|
||||
DEPEND="
|
||||
daemon? ( acl? ( sys-apps/acl ) )
|
||||
"
|
||||
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
daemon? (
|
||||
acct-user/ttrssd
|
||||
acct-group/ttrssd
|
||||
$(php_rdepend "${PHP_USE},cli,pcntl")
|
||||
)
|
||||
!daemon? (
|
||||
$(php_rdepend "${PHP_USE}")
|
||||
)
|
||||
"
|
||||
|
||||
DEPEND="
|
||||
!vhosts? ( ${DEPEND} )
|
||||
"
|
||||
|
||||
need_httpd_cgi # From webapp.eclass
|
||||
|
||||
S="${WORKDIR}/${PN}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-no-chmod.patch
|
||||
)
|
||||
|
||||
src_install() {
|
||||
webapp_src_preinst
|
||||
|
||||
insinto "${MY_HTDOCSDIR}"
|
||||
doins -r *
|
||||
|
||||
# When updating, grep the plugins directory for additional CACHE_DIR
|
||||
# instances as they cannot be created later due to permissions.
|
||||
dodir "${MY_HTDOCSDIR}"/cache/starred-images
|
||||
|
||||
local dir
|
||||
for dir in "${ED}${MY_HTDOCSDIR}"/{cache/*,feed-icons,lock}/; do
|
||||
webapp_serverowned "${dir#${ED}}"
|
||||
done
|
||||
|
||||
if use daemon; then
|
||||
webapp_hook_script "${FILESDIR}"/permissions-r1
|
||||
webapp_postinst_txt en "${FILESDIR}"/postinstall-en-with-daemon-r1.txt
|
||||
|
||||
newinitd "${FILESDIR}"/ttrssd.initd-r4 ttrssd
|
||||
newconfd "${FILESDIR}"/ttrssd.confd-r2 ttrssd
|
||||
|
||||
insinto /etc/logrotate.d
|
||||
newins "${FILESDIR}"/ttrssd.logrotated-r1 ttrssd
|
||||
|
||||
elog "After upgrading, please restart ttrssd."
|
||||
else
|
||||
webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
|
||||
fi
|
||||
|
||||
webapp_src_install
|
||||
}
|
Loading…
Reference in a new issue