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