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