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