207 lines
6.1 KiB
RPMSpec
207 lines
6.1 KiB
RPMSpec
%define name dl
|
|
%define version 0.18.1
|
|
%define release 5
|
|
%define httpuser apache
|
|
|
|
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 5
|
|
%global useselinux 1
|
|
%else
|
|
%global useselinux 0
|
|
%endif
|
|
|
|
Summary: Temporary file hosting
|
|
Name: %{name}
|
|
Version: %{version}
|
|
Release: %{release}%{?dist}
|
|
License: GPLv2
|
|
URL: http://www.thregr.org/~wavexx/software/dl/
|
|
Group: Applications/Internet
|
|
Source: http://www.thregr.org/~wavexx/software/dl/releases/%{name}-%{version}.zip
|
|
Source1: httpd.conf
|
|
Source2: logrotate.conf
|
|
Patch0: dl-0.18.1-pre0.19changes20210316.patch
|
|
Patch1: dl-0.18.1-add-in-help-html.patch
|
|
|
|
BuildArch: noarch
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}
|
|
|
|
Requires: php >= 5.3
|
|
Requires: php-mbstring
|
|
Requires: httpd
|
|
Requires: gettext
|
|
Requires(post): sqlite
|
|
%if %{useselinux}
|
|
Requires: %{_sbindir}/semanage
|
|
%endif
|
|
|
|
BuildRequires: php-cli >= 5.3
|
|
BuildRequires: php-mbstring
|
|
BuildRequires: gettext
|
|
BuildRequires: python3-docutils
|
|
|
|
%package cli
|
|
Summary: A command line client for dl
|
|
Group: Applications/Internet
|
|
Requires: python-pycurl
|
|
|
|
%description
|
|
"dl" is a file exchange service that allows you to upload any
|
|
file to a web server and generate a unique ticket for others
|
|
to download. The ticket is automatically expired according to
|
|
the specified rules, so that you don't need to keep track or
|
|
cleanup afterward. "dl" also allows you to grant an anonymous,
|
|
one-time upload for others to send you a file, without the
|
|
requirement of account management.
|
|
|
|
%description cli
|
|
A command-line client to the REST interface of dl
|
|
|
|
%prep
|
|
%setup -q -n %{name}-%{version}
|
|
%patch0 -p1
|
|
%patch1 -p1
|
|
|
|
%build
|
|
# update locales
|
|
pushd ./htdocs/include/scripts
|
|
php ./langupd.php
|
|
popd
|
|
|
|
|
|
%install
|
|
%{__rm} -rf %{buildroot}
|
|
%{__mkdir_p} %{buildroot}/%{_datadir}/%{name}/
|
|
%{__mkdir_p} %{buildroot}/%{_localstatedir}/lib/%{name}/tmp
|
|
%{__mkdir_p} %{buildroot}/%{_localstatedir}/lib/%{name}/data
|
|
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/httpd/conf.d/
|
|
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/logrotate.d/
|
|
%{__mkdir_p} %{buildroot}/%{_bindir}
|
|
|
|
%{__cp} -pr ./htdocs/* %{buildroot}/%{_datadir}/%{name}/
|
|
|
|
# Install conf
|
|
sed -i -e "s|/var/spool/dl/|/%{_localstatedir}/lib/%{name}|g" \
|
|
%{buildroot}/%{_datadir}/%{name}/include/config.php.dist > \
|
|
%{buildroot}/%{_sysconfdir}/%{name}.php
|
|
%{__rm} -f %{buildroot}/%{_datadir}/%{name}/include/config.php.dist
|
|
|
|
# Install apache conf
|
|
%{__install} -m 0640 %{SOURCE1} %{buildroot}/%{_sysconfdir}/httpd/conf.d/%{name}.conf
|
|
|
|
# Install logrotate conf
|
|
%{__install} -m 0640 %{SOURCE2} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
|
|
|
|
# Install cli
|
|
%{__install} -m 0755 client/dl-cli.py %{buildroot}/%{_bindir}/%{name}-cli
|
|
|
|
%clean
|
|
rm -rf %{buildroot}
|
|
|
|
%post
|
|
%if %{useselinux}
|
|
(
|
|
# New File context
|
|
semanage fcontext -a -s system_u -t httpd_sys_script_rw_t -r s0 "%{_localstatedir}/lib/%{name}(/.*)?"
|
|
semanage fcontext -a -s system_u -t httpd_var_lib_t -r s0 "%{_sysconfdir}/%{name}.php"
|
|
semanage fcontext -a -s system_u -t httpd_sys_script_rw_t -r s0 "%{_localstatedir}/log/%{name}.log"
|
|
# files created by app
|
|
restorecon -R %{_sysconfdir}/%{name}.php
|
|
restorecon -R %{_localstatedir}/lib/%{name}
|
|
restorecon -R "%{_localstatedir}/log/%{name}.log"
|
|
) &>/dev/null || :
|
|
%endif
|
|
# Initialize database
|
|
if [ ! -e %{_localstatedir}/lib/%{name}/data.sql ]; then
|
|
cd %{_localstatedir}/lib/%{name}/
|
|
sqlite3 data.sql < %{_datadir}/%{name}/include/scripts/db/sqlite.sql
|
|
chown %{httpuser}:%{httpuser} data.sql
|
|
fi
|
|
# create log file if it doesn't exists
|
|
touch %{_localstatedir}/log/%{name}.log
|
|
chgrp %{httpuser} %{_localstatedir}/log/%{name}.log
|
|
chmod 660 %{_localstatedir}/log/%{name}.log
|
|
|
|
# Flush existing session on upgrades
|
|
%{__rm} -f %{_localstatedir}/lib/%{name}/tmp/sess_*
|
|
|
|
%postun
|
|
%if %{useselinux}
|
|
if [ "$1" -eq "0" ]; then
|
|
# Remove the File Context
|
|
(
|
|
semanage fcontext -d "%{_localstatedir}/lib/%{name}(/.*)?"
|
|
semanage fcontext -d "%{_sysconfdir}/%{name}.php"
|
|
semanage fcontext -d "%{_localstatedir}/log/%{name}.log"
|
|
) &>/dev/null || :
|
|
fi
|
|
%endif
|
|
|
|
|
|
%files
|
|
%defattr(-,root,root)
|
|
%doc AUTHORS.rst NEWS.rst README.rst RESTAPI.rst THANKS.rst COPYING.txt
|
|
#%doc AUTHORS.html NEWS.html README.html RESTAPI.html THANKS.html
|
|
|
|
%{_datadir}/%{name}
|
|
%dir %attr(770,root,%{httpuser}) %{_localstatedir}/lib/%{name}
|
|
%dir %attr(770,root,%{httpuser}) %{_localstatedir}/lib/%{name}/data
|
|
%dir %attr(770,root,%{httpuser}) %{_localstatedir}/lib/%{name}/tmp
|
|
%config(noreplace) %attr(660,root,%{httpuser}) %{_sysconfdir}/%{name}.php
|
|
%config(noreplace) %attr(660,root,root) %{_sysconfdir}/httpd/conf.d/%{name}.conf
|
|
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
|
|
|
|
%files cli
|
|
%defattr(-,root,root)
|
|
%{_bindir}/%{name}-cli
|
|
|
|
%changelog
|
|
* Thu Oct 09 2025 Trevor Batley <trevorb@koozali.org> 0.18.1-5.sme
|
|
- changed BuildRequires to python3-docutils
|
|
|
|
* Thu Oct 09 2025 BogusDateBot
|
|
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
|
by assuming the date is correct and changing the weekday.
|
|
|
|
* Fri Oct 01 2021 Brian Read <brianr@bjsystems.co.uk> 0.18.1-4.sme
|
|
- Add in missing help files [SME: 11565]
|
|
|
|
* Sun Apr 18 2021 Jean-Philippe Pialasse <tests@pialasse.com> 0.18.1-3.sme
|
|
- first build for SME10 [SME: 11565]
|
|
- patch with git update up to pre 0.19 release as per 20210316
|
|
- cvs admin -ko on patch
|
|
|
|
* Wed Sep 6 2017 Daniel Berteaud <daniel@firewall-services.com> 0.18.1-1
|
|
- Update to 0.18.1
|
|
|
|
* Tue Sep 5 2017 Daniel Berteaud <daniel@firewall-services.com> 0.18-1
|
|
- Update to 0.18
|
|
- Remove the clamd patch
|
|
|
|
* Sun May 29 2016 Daniel Berteaud <daniel@firewall-services.com> 0.17.1-2
|
|
- Create the data dir and grant httpd user access
|
|
|
|
* Mon May 9 2016 Daniel Berteaud <daniel@firewall-services.com> 0.17.1-1
|
|
- Update to 0.17.1
|
|
|
|
* Mon Jun 29 2015 Daniel B. <daniel@firewall-services.com> 0.17-1
|
|
- Update to 0.17
|
|
|
|
* Fri Jan 23 2015 Daniel B. <daniel@firewall-services.com> 0.16-1
|
|
- Update to 0.16
|
|
|
|
* Thu Dec 4 2014 Daniel B. <daniel@firewall-services.com> 0.15-1
|
|
- Upgrade to 0.15
|
|
|
|
* Mon Oct 20 2014 Daniel B. <daniel@firewall-services.com> 0.14-1
|
|
- Upgrade to 0.14
|
|
|
|
* Thu Jul 31 2014 Daniel B. <daniel@firewall-services.com> 0.13-1
|
|
- Upgrade to 0.13
|
|
|
|
* Wed Dec 11 2013 Daniel B. <daniel@firewall-services.com> 0.12-1
|
|
- upgrade to 0.12
|
|
|
|
* Fri Nov 22 2013 Daniel B. <daniel@firewall-services.com> 0.11-1
|
|
- First package
|
|
|