1 |
# $Id$ |
2 |
# Authority: vip-ire |
3 |
# Name: Daniel Berteaud |
4 |
|
5 |
%if %{?fedora}%{?rhel} >= 5 |
6 |
%define useselinux 1 |
7 |
%else |
8 |
%define useselinux 0 |
9 |
%endif |
10 |
|
11 |
Name: BackupPC |
12 |
Version: 3.1.0 |
13 |
Release: 3%{?dist} |
14 |
Summary: BackupPC - high-performance backup system |
15 |
|
16 |
Group: Applications/System |
17 |
License: GPLv2+ |
18 |
URL: http://backuppc.sourceforge.net/ |
19 |
Source0: http://dl.sourceforge.net/backuppc/%{name}-%{version}.tar.gz |
20 |
Source1: BackupPC.htaccess |
21 |
Source2: BackupPC.logrotate |
22 |
Source3: BackupPC-README.fedora |
23 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
24 |
BuildArch: noarch |
25 |
|
26 |
BuildRequires: /bin/cat |
27 |
BuildRequires: /bin/df |
28 |
BuildRequires: /bin/gtar |
29 |
BuildRequires: %{_bindir}/nmblookup |
30 |
BuildRequires: %{_bindir}/rsync |
31 |
BuildRequires: %{_sbindir}/sendmail |
32 |
BuildRequires: %{_bindir}/smbclient |
33 |
BuildRequires: %{_bindir}/split |
34 |
BuildRequires: %{_bindir}/ssh |
35 |
BuildRequires: perl(Compress::Zlib) |
36 |
|
37 |
Requires: httpd |
38 |
Requires: perl-suidperl |
39 |
Requires: perl(File::RsyncP) |
40 |
Requires: perl(Compress::Zlib) |
41 |
Requires: perl(Archive::Zip) |
42 |
Requires: perl-Time-modules |
43 |
Requires: perl(XML::RSS) |
44 |
Requires: rsync |
45 |
Requires: samba-client |
46 |
Requires(pre): %{_sbindir}/useradd |
47 |
Requires(preun): initscripts, chkconfig |
48 |
Requires(post): initscripts, chkconfig, %{_sbindir}/usermod |
49 |
Requires(postun): initscripts |
50 |
%if %{useselinux} |
51 |
Requires: policycoreutils |
52 |
BuildRequires: selinux-policy-devel, checkpolicy |
53 |
%endif |
54 |
Provides: backuppc = %{version} |
55 |
|
56 |
%description |
57 |
BackupPC is a high-performance, enterprise-grade system for backing up Linux |
58 |
and WinXX PCs and laptops to a server's disk. BackupPC is highly configurable |
59 |
and easy to install and maintain. |
60 |
|
61 |
%prep |
62 |
%setup -q |
63 |
sed -i "s|\"backuppc\"|\"$LOGNAME\"|g" configure.pl |
64 |
iconv -f ISO-8859-1 -t UTF-8 ChangeLog > ChangeLog.utf && mv ChangeLog.utf ChangeLog |
65 |
pushd doc |
66 |
iconv -f ISO-8859-1 -t UTF-8 BackupPC.pod > BackupPC.pod.utf && mv BackupPC.pod.utf BackupPC.pod |
67 |
iconv -f ISO-8859-1 -t UTF-8 BackupPC.html > BackupPC.html.utf && mv BackupPC.html.utf BackupPC.html |
68 |
popd |
69 |
cp %{SOURCE3} README.fedora |
70 |
|
71 |
%if %{useselinux} |
72 |
%{__mkdir} selinux |
73 |
pushd selinux |
74 |
|
75 |
cat >%{name}.te <<EOF |
76 |
policy_module(%{name},0.0.3) |
77 |
require { |
78 |
type var_log_t; |
79 |
type httpd_t; |
80 |
class sock_file write; |
81 |
type initrc_t; |
82 |
class unix_stream_socket connectto; |
83 |
type ssh_exec_t; |
84 |
type ping_exec_t; |
85 |
type sendmail_exec_t; |
86 |
class file getattr; |
87 |
type httpd_sys_content_t; |
88 |
class sock_file getattr; |
89 |
} |
90 |
|
91 |
allow httpd_t httpd_sys_content_t:sock_file write; |
92 |
allow httpd_t initrc_t:unix_stream_socket connectto; |
93 |
allow httpd_t ping_exec_t:file getattr; |
94 |
allow httpd_t sendmail_exec_t:file getattr; |
95 |
allow httpd_t ssh_exec_t:file getattr; |
96 |
allow httpd_t httpd_sys_content_t:sock_file getattr; |
97 |
EOF |
98 |
|
99 |
cat >%{name}.fc <<EOF |
100 |
%{_sysconfdir}/%{name} system_u:object_r:httpd_sys_content_t:s0 |
101 |
%{_sysconfdir}/%{name}/pc system_u:object_r:httpd_sys_script_rw_t:s0 |
102 |
%{_sysconfdir}/%{name}/config.pl system_u:object_r:httpd_sys_content_t:s0 |
103 |
%{_sysconfdir}/%{name}/hosts system_u:object_r:httpd_sys_content_t:s0 |
104 |
%{_localstatedir}/log/%{name} system_u:object_r:httpd_sys_content_t:s0 |
105 |
EOF |
106 |
%endif |
107 |
|
108 |
%build |
109 |
%if %{useselinux} |
110 |
# SElinux |
111 |
pushd selinux |
112 |
make -f %{_datadir}/selinux/devel/Makefile |
113 |
popd |
114 |
%endif |
115 |
|
116 |
|
117 |
|
118 |
%install |
119 |
rm -rf $RPM_BUILD_ROOT |
120 |
perl configure.pl \ |
121 |
--batch \ |
122 |
--dest-dir $RPM_BUILD_ROOT \ |
123 |
--config-dir %{_sysconfdir}/%{name}/ \ |
124 |
--cgi-dir %{_datadir}/%{name}/sbin/ \ |
125 |
--data-dir %{_localstatedir}/lib/%{name}/ \ |
126 |
--html-dir %{_datadir}/%{name}/html/ \ |
127 |
--html-dir-url /%{name}/images \ |
128 |
--log-dir %{_localstatedir}/log/%{name} \ |
129 |
--install-dir %{_datadir}/%{name} \ |
130 |
--hostname localhost \ |
131 |
--uid-ignore |
132 |
|
133 |
for f in `find $RPM_BUILD_ROOT` |
134 |
do |
135 |
if [ -f $f ] |
136 |
then |
137 |
sed -i s,$LOGNAME,backuppc,g $f |
138 |
fi |
139 |
done |
140 |
sed -i s,$LOGNAME,backuppc,g init.d/linux-backuppc |
141 |
|
142 |
%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir} |
143 |
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ |
144 |
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ |
145 |
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name} |
146 |
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/pc |
147 |
|
148 |
%{__cp} init.d/linux-backuppc $RPM_BUILD_ROOT%{_initrddir}/backuppc |
149 |
%{__cp} %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/%{name}.conf |
150 |
%{__cp} %{SOURCE2} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name} |
151 |
|
152 |
%{__chmod} 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/bin/* |
153 |
%{__chmod} 755 $RPM_BUILD_ROOT%{_initrddir}/backuppc |
154 |
|
155 |
sed -i 's/^\$Conf{XferMethod}\ =.*/$Conf{XferMethod} = "rsync";/' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/config.pl |
156 |
sed -i 's|^\$Conf{CgiURL}\ =.*|$Conf{CgiURL} = "http://localhost/BackupPC";|' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/config.pl |
157 |
|
158 |
%if %{useselinux} |
159 |
# SElinux |
160 |
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name} |
161 |
%{__install} -m644 selinux/%{name}.pp $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/%{name}.pp |
162 |
%endif |
163 |
|
164 |
|
165 |
%clean |
166 |
rm -rf $RPM_BUILD_ROOT |
167 |
|
168 |
|
169 |
%pre |
170 |
%{_sbindir}/useradd -d %{_localstatedir}/lib/%{name} -r -s /sbin/nologin backuppc 2> /dev/null || : |
171 |
|
172 |
|
173 |
%preun |
174 |
if [ $1 = 0 ]; then |
175 |
service backuppc stop > /dev/null 2>&1 || : |
176 |
chkconfig --del backuppc || : |
177 |
fi |
178 |
|
179 |
%post |
180 |
%if %{useselinux} |
181 |
# Install/update Selinux policy |
182 |
semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp |
183 |
# files owned by RPM |
184 |
fixfiles -R %{name} restore |
185 |
# files created by app |
186 |
restorecon -R %{_sysconfdir}/%{name} |
187 |
restorecon -R %{_localstatedir}/lib/%{name} |
188 |
restorecon -R %{_localstatedir}/log/%{name} |
189 |
%endif |
190 |
chkconfig --add backuppc || : |
191 |
service httpd condrestart > /dev/null 2>&1 || : |
192 |
#%{_sbindir}/usermod -a -G backuppc apache || : |
193 |
|
194 |
|
195 |
%postun |
196 |
service httpd condrestart > /dev/null 2>&1 || : |
197 |
%if %{useselinux} |
198 |
if [ "$1" -eq "0" ]; then |
199 |
# Remove the SElinux policy. |
200 |
semodule -r %{name} || : |
201 |
fi |
202 |
%endif |
203 |
|
204 |
|
205 |
%files |
206 |
%defattr(-,root,root,-) |
207 |
%doc README README.fedora ChangeLog LICENSE doc/ |
208 |
|
209 |
%dir %attr(-,backuppc,backuppc) %{_localstatedir}/log/%{name} |
210 |
%dir %attr(-,backuppc,backuppc) %{_sysconfdir}/%{name}/ |
211 |
|
212 |
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf |
213 |
%config(noreplace) %attr(-,backuppc,backuppc) %{_sysconfdir}/%{name}/* |
214 |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
215 |
|
216 |
%dir %{_datadir}/%{name} |
217 |
%dir %{_datadir}/%{name}/sbin |
218 |
%{_datadir}/%{name}/[^s]* |
219 |
%{_initrddir}/backuppc |
220 |
|
221 |
%attr(4750,backuppc,root) %{_datadir}/%{name}/sbin/BackupPC_Admin |
222 |
%attr(-,backuppc,root) %{_localstatedir}/lib/%{name}/ |
223 |
|
224 |
%if %{useselinux} |
225 |
%{_datadir}/selinux/packages/%{name}/%{name}.pp |
226 |
%endif |
227 |
|
228 |
%changelog |
229 |
* Tue Dec 09 2008 Daniel B <daniel@firewall-services.com> 3.1.0-3 |
230 |
- Small changes for SME Server (apache -> www) |
231 |
|
232 |
* Sat Apr 05 2008 Johan Cwiklinski <johan AT x-tnd DOT be> 3.1.0-2 |
233 |
- correcting nologin path |
234 |
|
235 |
* Thu Nov 29 2007 Johan Cwiklinski <johan AT x-tnd DOT be> 3.1.0-1 |
236 |
- New upstream version |
237 |
- Added samba-client as a dependency |
238 |
- Added readme.fedora |
239 |
- Changed CGI admin path in default config file |
240 |
|
241 |
* Fri Sep 21 2007 Johan Cwiklinski <johan AT x-tnd DOT be> 3.0.0-3 |
242 |
- Fixed SELinux policy module |
243 |
|
244 |
* Wed Sep 12 2007 Johan Cwiklinski <johan AT x-tnd DOT be> 3.0.0-2 |
245 |
- Added SELinux policy module |
246 |
|
247 |
* Tue Jan 30 2007 Johan Cwiklinski <johan AT x-tnd DOT be> 3.0.0-1 |
248 |
- Rebuild RPM for v 3.0.0 |
249 |
|
250 |
* Sat Aug 16 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-7 |
251 |
- Release bump for rebuild |
252 |
|
253 |
* Tue Jul 25 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-6 |
254 |
- One more config change |
255 |
|
256 |
* Sun Jul 23 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-5 |
257 |
- Added upstream patch for better support for rsync |
258 |
|
259 |
* Sun Jul 23 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-4 |
260 |
- Properly marking config files as such |
261 |
|
262 |
* Sun Jul 23 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-3 |
263 |
- Changes to defaults in config.pl |
264 |
- Added Requires: rsync |
265 |
|
266 |
* Fri Jul 21 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-2 |
267 |
- Added requires: perl(File::RsyncP) |
268 |
|
269 |
* Tue Jul 18 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-1 |
270 |
- Initial Fedora Packaging |