1 |
%define name dl |
2 |
%define version 0.18.1 |
3 |
%define release 1 |
4 |
%define httpuser apache |
5 |
|
6 |
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 5 |
7 |
%global useselinux 1 |
8 |
%else |
9 |
%global useselinux 0 |
10 |
%endif |
11 |
|
12 |
Summary: Temporary file hosting |
13 |
Name: %{name} |
14 |
Version: %{version} |
15 |
Release: %{release}%{?dist} |
16 |
License: GPLv2 |
17 |
URL: http://www.thregr.org/~wavexx/software/dl/ |
18 |
Group: Applications/Internet |
19 |
Source: http://www.thregr.org/~wavexx/software/dl/releases/%{name}-%{version}.zip |
20 |
Source1: httpd.conf |
21 |
Source2: logrotate.conf |
22 |
|
23 |
BuildArch: noarch |
24 |
BuildRoot: %{_tmppath}/%{name}-%{version} |
25 |
|
26 |
Requires: php >= 5.3 |
27 |
Requires: php-mbstring |
28 |
Requires: httpd |
29 |
Requires: gettext |
30 |
Requires(post): sqlite |
31 |
%if %{useselinux} |
32 |
Requires: %{_sbindir}/semanage |
33 |
%endif |
34 |
|
35 |
BuildRequires: php-cli >= 5.3 |
36 |
BuildRequires: php-mbstring |
37 |
BuildRequires: gettext |
38 |
BuildRequires: python-docutils |
39 |
|
40 |
%package cli |
41 |
Summary: A command line client for dl |
42 |
Group: Applications/Internet |
43 |
Requires: python-pycurl |
44 |
|
45 |
%description |
46 |
"dl" is a file exchange service that allows you to upload any |
47 |
file to a web server and generate a unique ticket for others |
48 |
to download. The ticket is automatically expired according to |
49 |
the specified rules, so that you don't need to keep track or |
50 |
cleanup afterward. "dl" also allows you to grant an anonymous, |
51 |
one-time upload for others to send you a file, without the |
52 |
requirement of account management. |
53 |
|
54 |
%description cli |
55 |
A command-line client to the REST interface of dl |
56 |
|
57 |
%prep |
58 |
%setup -q -n %{name}-%{version} |
59 |
|
60 |
%build |
61 |
# update locales |
62 |
pushd ./htdocs/include/scripts |
63 |
php ./langupd.php |
64 |
popd |
65 |
|
66 |
|
67 |
%install |
68 |
%{__rm} -rf %{buildroot} |
69 |
%{__mkdir_p} %{buildroot}/%{_datadir}/%{name}/ |
70 |
%{__mkdir_p} %{buildroot}/%{_localstatedir}/lib/%{name}/tmp |
71 |
%{__mkdir_p} %{buildroot}/%{_localstatedir}/lib/%{name}/data |
72 |
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/httpd/conf.d/ |
73 |
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/logrotate.d/ |
74 |
%{__mkdir_p} %{buildroot}/%{_bindir} |
75 |
|
76 |
%{__cp} -pr ./htdocs/* %{buildroot}/%{_datadir}/%{name}/ |
77 |
|
78 |
# Install conf |
79 |
sed -i -e "s|/var/spool/dl/|/%{_localstatedir}/lib/%{name}|g" \ |
80 |
%{buildroot}/%{_datadir}/%{name}/include/config.php.dist > \ |
81 |
%{buildroot}/%{_sysconfdir}/%{name}.php |
82 |
%{__rm} -f %{buildroot}/%{_datadir}/%{name}/include/config.php.dist |
83 |
|
84 |
# Install apache conf |
85 |
%{__install} -m 0640 %{SOURCE1} %{buildroot}/%{_sysconfdir}/httpd/conf.d/%{name}.conf |
86 |
|
87 |
# Install logrotate conf |
88 |
%{__install} -m 0640 %{SOURCE2} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name} |
89 |
|
90 |
# Install cli |
91 |
%{__install} -m 0755 client/dl-cli.py %{buildroot}/%{_bindir}/%{name}-cli |
92 |
|
93 |
%clean |
94 |
rm -rf %{buildroot} |
95 |
|
96 |
%post |
97 |
%if %{useselinux} |
98 |
( |
99 |
# New File context |
100 |
semanage fcontext -a -s system_u -t httpd_sys_script_rw_t -r s0 "%{_localstatedir}/lib/%{name}(/.*)?" |
101 |
semanage fcontext -a -s system_u -t httpd_var_lib_t -r s0 "%{_sysconfdir}/%{name}.php" |
102 |
semanage fcontext -a -s system_u -t httpd_sys_script_rw_t -r s0 "%{_localstatedir}/log/%{name}.log" |
103 |
# files created by app |
104 |
restorecon -R %{_sysconfdir}/%{name}.php |
105 |
restorecon -R %{_localstatedir}/lib/%{name} |
106 |
restorecon -R "%{_localstatedir}/log/%{name}.log" |
107 |
) &>/dev/null || : |
108 |
%endif |
109 |
# Initialize database |
110 |
if [ ! -e %{_localstatedir}/lib/%{name}/data.sql ]; then |
111 |
cd %{_localstatedir}/lib/%{name}/ |
112 |
sqlite3 data.sql < %{_datadir}/%{name}/include/scripts/db/sqlite.sql |
113 |
chown %{httpuser}:%{httpuser} data.sql |
114 |
fi |
115 |
# create log file if it doesn't exists |
116 |
touch %{_localstatedir}/log/%{name}.log |
117 |
chgrp %{httpuser} %{_localstatedir}/log/%{name}.log |
118 |
chmod 660 %{_localstatedir}/log/%{name}.log |
119 |
|
120 |
# Flush existing session on upgrades |
121 |
%{__rm} -f %{_localstatedir}/lib/%{name}/tmp/sess_* |
122 |
|
123 |
%postun |
124 |
%if %{useselinux} |
125 |
if [ "$1" -eq "0" ]; then |
126 |
# Remove the File Context |
127 |
( |
128 |
semanage fcontext -d "%{_localstatedir}/lib/%{name}(/.*)?" |
129 |
semanage fcontext -d "%{_sysconfdir}/%{name}.php" |
130 |
semanage fcontext -d "%{_localstatedir}/log/%{name}.log" |
131 |
) &>/dev/null || : |
132 |
fi |
133 |
%endif |
134 |
|
135 |
|
136 |
%files |
137 |
%defattr(-,root,root) |
138 |
%doc AUTHORS.rst NEWS.rst README.rst RESTAPI.rst THANKS.rst COPYING.txt |
139 |
%doc AUTHORS.html NEWS.html README.html RESTAPI.html THANKS.html |
140 |
%{_datadir}/%{name} |
141 |
%dir %attr(770,root,%{httpuser}) %{_localstatedir}/lib/%{name} |
142 |
%dir %attr(770,root,%{httpuser}) %{_localstatedir}/lib/%{name}/data |
143 |
%dir %attr(770,root,%{httpuser}) %{_localstatedir}/lib/%{name}/tmp |
144 |
%config(noreplace) %attr(660,root,%{httpuser}) %{_sysconfdir}/%{name}.php |
145 |
%config(noreplace) %attr(660,root,root) %{_sysconfdir}/httpd/conf.d/%{name}.conf |
146 |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
147 |
|
148 |
%files cli |
149 |
%defattr(-,root,root) |
150 |
%{_bindir}/%{name}-cli |
151 |
|
152 |
%changelog |
153 |
* Wed Sep 6 2017 Daniel Berteaud <daniel@firewall-services.com> 0.18.1-1 |
154 |
- Update to 0.18.1 |
155 |
|
156 |
* Tue Sep 5 2017 Daniel Berteaud <daniel@firewall-services.com> 0.18-1 |
157 |
- Update to 0.18 |
158 |
- Remove the clamd patch |
159 |
|
160 |
* Sun May 29 2016 Daniel Berteaud <daniel@firewall-services.com> 0.17.1-2 |
161 |
- Create the data dir and grant httpd user access |
162 |
|
163 |
* Mon May 9 2016 Daniel Berteaud <daniel@firewall-services.com> 0.17.1-1 |
164 |
- Update to 0.17.1 |
165 |
|
166 |
* Mon Jun 29 2015 Daniel B. <daniel@firewall-services.com> 0.17-1 |
167 |
- Update to 0.17 |
168 |
|
169 |
* Fri Jan 23 2015 Daniel B. <daniel@firewall-services.com> 0.16-1 |
170 |
- Update to 0.16 |
171 |
|
172 |
* Thu Dec 4 2014 Daniel B. <daniel@firewall-services.com> 0.15-1 |
173 |
- Upgrade to 0.15 |
174 |
|
175 |
* Mon Oct 20 2014 Daniel B. <daniel@firewall-services.com> 0.14-1 |
176 |
- Upgrade to 0.14 |
177 |
|
178 |
* Thu Jul 31 2014 Daniel B. <daniel@firewall-services.com> 0.13-1 |
179 |
- Upgrade to 0.13 |
180 |
|
181 |
* Wed Dec 11 2013 Daniel B. <daniel@firewall-services.com> 0.12-1 |
182 |
- upgrade to 0.12 |
183 |
|
184 |
* Fri Nov 22 2013 Daniel B. <daniel@firewall-services.com> 0.11-1 |
185 |
- First package |
186 |
|