File FreshRSS.spec of Package FreshRSS
#
# spec file for package FreshRSS
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define freshrss_webroot /%{name}
%define freshrss_path %{_datadir}/php/%{name}
Name: FreshRSS
Version: 1.24.3
Release: 0
Summary: A free self-hostable aggregator
License: AGPL-3.0-only
Group: Productivity/Networking/Web/Frontends
URL: https://freshrss.org/
Source0: FreshRSS-%{version}.tar.gz
Source1: FreshRSS-apache.conf
Source90: README.SUSE
BuildArch: noarch
BuildRequires: apache-rpm-macros
BuildRequires: fdupes
Requires: cron
Requires: php-curl
Requires: php-gmp
Requires: php-intl
Requires: php-mbstring
Requires: php-xml
Requires: php-zip
Requires: php-sqlite
Requires: php-mysql
Requires: php-pgsql
%description
FreshRSS is a self-hosted RSS feed aggregator.
%package apache
Summary: Apache configuration for %{name}
Group: Productivity/Networking/Web/Frontends
BuildRequires: apache2
Requires: apache2
Requires: mod_php_any >= 7.4.0
Requires: %{name} >= %{version}
Supplements: (apache2 and %{name})
%description apache
This subpackage contains the Apache configuration files
%prep
%setup -q
install %{SOURCE90} .
# rpmlint
find . -type f "(" -name '.gitignore' -o -name '.gitattributes' -o -name '.keep' ")" -delete
find . -type f "(" -name 'README.SUSE' -o -name '*.phtml' ")" | xargs chmod 644
# not needed
rm -rf Docker
# fix env
find -type f -name "*.php" -exec sed -i -e 's|\/usr\/bin\/env php|\/usr\/bin\/php|g' {} \;
find -type f -name "*.sh" -exec sed -i -e 's|\/usr\/bin\/env bash|\/usr\/bin\/bash|g' {} \;
%build
# nothing to build
%install
mkdir -p %{buildroot}%{freshrss_path}
cp -aRf * %{buildroot}%{freshrss_path}
# apache config
mkdir -p %{buildroot}%{apache_sysconfdir}/conf.d/
sed -e "s|@FRESHRSS_PATH@|%{freshrss_path}|g; \
s|@FRESHRSS_WEBROOT@|%{freshrss_webroot}|g;" \
%{SOURCE1} > %{buildroot}%{apache_sysconfdir}/conf.d/%{name}.conf
# use own apache .htacces file for rpmlint
rm %{buildroot}%{freshrss_path}/app/.htaccess
rm %{buildroot}%{freshrss_path}/cli/.htaccess
rm %{buildroot}%{freshrss_path}/data/.htaccess
rm %{buildroot}%{freshrss_path}/lib/.htaccess
rm %{buildroot}%{freshrss_path}/p/.htaccess
rm %{buildroot}%{freshrss_path}/p/api/.htaccess
rm %{buildroot}%{freshrss_path}/p/themes/.htaccess
%fdupes %{buildroot}%{freshrss_path}
%post apache
# only do on install, not on upgrade
if [ $1 -eq 1 ]; then
# enable required apache modules
a2enmod version >/dev/null || :
# enable mod_php if preform MPM is used
if start_apache2 -V | grep -q prefork; then
mod_php=$(php -r "echo 'php' . PHP_MAJOR_VERSION;")
echo "info: adding ${mod_php} to APACHE_MODULES"
a2enmod ${mod_php} >/dev/null || :
fi
fi
%files
%license LICENSE.txt
%doc README.md README.SUSE
%dir %{_datadir}/php
%defattr(-,root,%{apache_group},0755)
%{freshrss_path}/
%defattr(0664,root,%{apache_group},0770)
%{freshrss_path}/data
%files apache
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%changelog