%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
Summary: Download Ticket Service
URL: http://www.thregr.org/~wavexx/software/dl/
Name: dl
Version: 0.13
Group: Applications/Internet
Release: 3%{?dist}
License: GPLv2+
Source0: http://www.thregr.org/~wavexx/software/dl/releases/dl-%{version}.zip
Source1: dl-httpd-conf
Source2: README.fedora.dl
Patch0: dl-0.12-fix-doc-file-dependency.patch
BuildArch: noarch
Requires: php >= 5.3
Requires: php-mbstring
Requires: php-openssl
Requires: php-pdo
Requires: sqlite
Requires: webserver
# Unbundled libraries replaced by system libraries
Requires: php-phpass
Requires: php-php-gettext
Requires(post): policycoreutils-python
Requires(postun): policycoreutils-python
%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.
dl is usually installed as a "email attachments replacement" due to its
simplicity (though can be used in other ways).
%prep
%setup -q
%patch0 -p1
%build
# Cleanup
rm -f client/thunderbird-filelink-dl/.gitignore
rm -f htdocs/include/.htaccess
rm -f htdocs/style/include/.htaccess
%install
# Application
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/dl
cp -pr htdocs/* ${RPM_BUILD_ROOT}%{_datadir}/dl/.
# Unbundle php-phpass
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/dl/include/PasswordHash.php
ln -sf /usr/share/php/phpass/PasswordHash.php ${RPM_BUILD_ROOT}%{_datadir}/dl/include/PasswordHash.php
# Unbundle php-php-gettext
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/dl/include/gettext
ln -sf /usr/share/php/gettext ${RPM_BUILD_ROOT}%{_datadir}/dl/include/gettext
# DL configuration
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/dl
cp -p htdocs/include/config.php.dist ${RPM_BUILD_ROOT}%{_sysconfdir}/dl/config.php
sed -i -e 's:dl.example.com:localhost/dl:g' ${RPM_BUILD_ROOT}%{_sysconfdir}/dl/config.php
ln -sf ../../../../etc/dl/config.php ${RPM_BUILD_ROOT}%{_datadir}/dl/include/config.php
# Apache configuration
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d
cp -p %{SOURCE1} ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d/dl.conf
# Storage
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/spool/dl
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/spool/dl/data
cp -p %{SOURCE2} ./README.fedora
%post
# selinux: allow PHP to read/write data directory
semanage fcontext -a -t httpd_sys_rw_content_t "%{_localstatedir}/spool/dl(/.*)?"
restorecon -R -v %{_localstatedir}/spool/dl > /dev/null
# create sqlite db if it doesn't already exist
if [ ! -f %{_localstatedir}/spool/dl/data.sdb ]; then
su -c 'sqlite3 %{_localstatedir}/spool/dl/data.sdb' -s /bin/sh apache < %{_datadir}/dl/include/scripts/db/sqlite.sql
fi
:
%postun
# selinux: cleanup after uninstall
if [ $1 -eq 0 ]; then
semanage fcontext -d -t httpd_sys_rw_content_t "%{_localstatedir}/spool/dl(/.*)?"
restorecon -R -v %{_localstatedir}/spool/dl > /dev/null
fi
:
%files
%defattr(-,root,root,-)
%doc README.fedora
%doc COPYING
%doc *.html
%doc *.rst
%doc client
%dir %{_sysconfdir}/dl
%config(noreplace) %{_sysconfdir}/dl/config.php
%config(noreplace) %{_sysconfdir}/httpd/conf.d/dl.conf
%{_datadir}/dl
%dir %attr(0700,apache,apache) %{_localstatedir}/spool/dl
%dir %attr(0755,apache,apache) %{_localstatedir}/spool/dl/data
%changelog
* Fri Aug 1 2014 Greg Bailey <gbailey@lxpro.com> - 0.13-3
- Unbundle php-phpass and php-php-gettext
* Fri Aug 1 2014 Greg Bailey <gbailey@lxpro.com> - 0.13-2
- License is GPLv2+ according to AUTHORS.rst
* Thu Jul 31 2014 Greg Bailey <gbailey@lxpro.com> - 0.13-1
- dl 0.13
* Wed Jul 30 2014 Greg Bailey <gbailey@lxpro.com> - 0.12-2
- Patches to remove rpmlint errors/warnings
* Wed Jul 30 2014 Greg Bailey <gbailey@lxpro.com> - 0.12-1
- Initial RPM