cfed32d
%if %{?fedora}%{?rhel} >= 5
cfed32d
%define useselinux 1
cfed32d
%else
cfed32d
%define useselinux 0
cfed32d
%endif
cfed32d
cfed32d
Name:           BackupPC
3b7cf04
Version:        3.1.0
1169744
Release:        6%{?dist}
74068ba
Summary:        High-performance backup system
cfed32d
cfed32d
Group:          Applications/System
cfed32d
License:        GPLv2+
cfed32d
URL:            http://backuppc.sourceforge.net/
cfed32d
Source0:        http://dl.sourceforge.net/backuppc/%{name}-%{version}.tar.gz
cfed32d
Source1:        BackupPC.htaccess
cfed32d
Source2:        BackupPC.logrotate
3b7cf04
Source3:        BackupPC-README.fedora
8391b9d
Patch0:         BackupPC-TopDir_change.patch
cfed32d
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
cfed32d
BuildArch:      noarch
cfed32d
cfed32d
BuildRequires:  /bin/cat
cfed32d
BuildRequires:  /bin/df
cfed32d
BuildRequires:  /bin/gtar
cfed32d
BuildRequires:  %{_bindir}/nmblookup
cfed32d
BuildRequires:  %{_bindir}/rsync
cfed32d
BuildRequires:  %{_sbindir}/sendmail
cfed32d
BuildRequires:  %{_bindir}/smbclient
cfed32d
BuildRequires:  %{_bindir}/split
cfed32d
BuildRequires:  %{_bindir}/ssh
cfed32d
BuildRequires:  perl(Compress::Zlib)
cfed32d
cfed32d
Requires:       httpd
cfed32d
Requires:       perl-suidperl
cfed32d
Requires:       perl(File::RsyncP)
cfed32d
Requires:       perl(Compress::Zlib)
cfed32d
Requires:       perl(Archive::Zip)
cfed32d
Requires:       perl-Time-modules
cfed32d
Requires:       perl(XML::RSS)
cfed32d
Requires:       rsync
3b7cf04
Requires:       samba-client
cfed32d
Requires(pre):  %{_sbindir}/useradd
cfed32d
Requires(preun): initscripts, chkconfig
cfed32d
Requires(post): initscripts, chkconfig, %{_sbindir}/usermod
cfed32d
Requires(postun): initscripts
cfed32d
%if %{useselinux}
cfed32d
Requires:       policycoreutils
cfed32d
BuildRequires:  selinux-policy-devel, checkpolicy
cfed32d
%endif
cfed32d
Provides:       backuppc = %{version}
93e12e4
93e12e4
%description
93e12e4
BackupPC is a high-performance, enterprise-grade system for backing up Linux
93e12e4
and WinXX PCs and laptops to a server's disk. BackupPC is highly configurable
93e12e4
and easy to install and maintain.
93e12e4
93e12e4
%prep
93e12e4
%setup -q
8391b9d
%patch0 -p1
cfed32d
sed -i "s|\"backuppc\"|\"$LOGNAME\"|g" configure.pl
cfed32d
iconv -f ISO-8859-1 -t UTF-8 ChangeLog > ChangeLog.utf && mv ChangeLog.utf ChangeLog
cfed32d
pushd doc
cfed32d
iconv -f ISO-8859-1 -t UTF-8 BackupPC.pod > BackupPC.pod.utf && mv BackupPC.pod.utf BackupPC.pod
cfed32d
iconv -f ISO-8859-1 -t UTF-8 BackupPC.html > BackupPC.html.utf && mv BackupPC.html.utf BackupPC.html
cfed32d
popd
3b7cf04
cp %{SOURCE3} README.fedora
cfed32d
cfed32d
%if %{useselinux}
cfed32d
%{__mkdir} selinux
cfed32d
pushd selinux
cfed32d
cfed32d
cat >%{name}.te <
cfed32d
policy_module(%{name},0.0.3)
cfed32d
require {
3b7cf04
        type var_log_t;
3b7cf04
        type httpd_t;
3b7cf04
        class sock_file write;
cfed32d
        type initrc_t;
cfed32d
        class unix_stream_socket connectto;
3b7cf04
        type ssh_exec_t;
3b7cf04
        type ping_exec_t;
3b7cf04
        type sendmail_exec_t;
3b7cf04
        class file getattr;
3b7cf04
        type httpd_sys_content_t;
3b7cf04
        class sock_file getattr;
cfed32d
}
cfed32d
cfed32d
allow httpd_t httpd_sys_content_t:sock_file write;
cfed32d
allow httpd_t initrc_t:unix_stream_socket connectto;
cfed32d
allow httpd_t ping_exec_t:file getattr;
cfed32d
allow httpd_t sendmail_exec_t:file getattr;
cfed32d
allow httpd_t ssh_exec_t:file getattr;
cfed32d
allow httpd_t httpd_sys_content_t:sock_file getattr;
cfed32d
EOF
cfed32d
cfed32d
cat >%{name}.fc <
1169744
%{_sysconfdir}/%{name}(/.*)?            gen_context(system_u:object_r:httpd_sys_content_t,s0)
1169744
%{_sysconfdir}/%{name}/pc(/.*)?         gen_context(system_u:object_r:httpd_sys_script_rw_t,s0)
1169744
%{_localstatedir}/log/%{name}(/.*)?     gen_context(system_u:object_r:httpd_sys_content_t,s0)
cfed32d
EOF
cfed32d
%endif
cfed32d
cfed32d
%build
cfed32d
%if %{useselinux}
cfed32d
     # SElinux 
cfed32d
     pushd selinux
cfed32d
     make -f %{_datadir}/selinux/devel/Makefile
cfed32d
     popd
cfed32d
%endif
cfed32d
93e12e4
93e12e4
93e12e4
%install
cfed32d
rm -rf $RPM_BUILD_ROOT
cfed32d
perl configure.pl \
cfed32d
        --batch \
cfed32d
        --dest-dir $RPM_BUILD_ROOT \
cfed32d
        --config-dir %{_sysconfdir}/%{name}/ \
cfed32d
        --cgi-dir %{_datadir}/%{name}/sbin/ \
cfed32d
        --data-dir %{_localstatedir}/lib/%{name}/ \
cfed32d
        --html-dir %{_datadir}/%{name}/html/ \
cfed32d
        --html-dir-url /%{name}/images \
cfed32d
        --log-dir %{_localstatedir}/log/%{name} \
cfed32d
        --install-dir %{_datadir}/%{name} \
cfed32d
        --hostname localhost \
cfed32d
        --uid-ignore
cfed32d
cfed32d
for f in `find $RPM_BUILD_ROOT`
93e12e4
do
cfed32d
        if [ -f $f ]
cfed32d
        then
cfed32d
                sed -i s,$LOGNAME,backuppc,g $f
cfed32d
        fi
93e12e4
done
93e12e4
sed -i s,$LOGNAME,backuppc,g init.d/linux-backuppc
93e12e4
cfed32d
%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir}
cfed32d
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/
cfed32d
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cfed32d
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
cfed32d
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/pc
93e12e4
cfed32d
%{__cp} init.d/linux-backuppc $RPM_BUILD_ROOT%{_initrddir}/backuppc
cfed32d
%{__cp} %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/%{name}.conf
93e12e4
%{__cp} %{SOURCE2} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
93e12e4
cfed32d
%{__chmod} 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/bin/*
cfed32d
%{__chmod} 755 $RPM_BUILD_ROOT%{_initrddir}/backuppc
93e12e4
cfed32d
sed -i 's/^\$Conf{XferMethod}\ =.*/$Conf{XferMethod} = "rsync";/' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/config.pl
3b7cf04
sed -i 's|^\$Conf{CgiURL}\ =.*|$Conf{CgiURL} = "http://localhost/BackupPC";|' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/config.pl
93e12e4
cfed32d
%if %{useselinux}
cfed32d
     # SElinux 
cfed32d
     %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}
cfed32d
     %{__install} -m644 selinux/%{name}.pp $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/%{name}.pp
cfed32d
%endif
93e12e4
93e12e4
93e12e4
%clean
cfed32d
rm -rf $RPM_BUILD_ROOT
93e12e4
93e12e4
93e12e4
%pre
6dd27cf
%{_sbindir}/useradd -d %{_localstatedir}/lib/%{name} -r -s /sbin/nologin backuppc 2> /dev/null || :
cfed32d
93e12e4
93e12e4
%preun
93e12e4
if [ $1 = 0 ]; then
cfed32d
        service backuppc stop > /dev/null 2>&1 || :
cfed32d
        chkconfig --del backuppc || :
93e12e4
fi
93e12e4
93e12e4
%post
cfed32d
%if %{useselinux}
a62932f
(
cfed32d
     # Install/update Selinux policy
cfed32d
     semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp
cfed32d
     # files owned by RPM
cfed32d
     fixfiles -R %{name} restore
cfed32d
     # files created by app
cfed32d
     restorecon -R %{_sysconfdir}/%{name}
cfed32d
     restorecon -R %{_localstatedir}/lib/%{name}
cfed32d
     restorecon -R %{_localstatedir}/log/%{name}
a62932f
) &>/dev/null
cfed32d
%endif
cfed32d
chkconfig --add backuppc || :
cfed32d
service httpd condrestart > /dev/null 2>&1 || :
93e12e4
%{_sbindir}/usermod -a -G backuppc apache || :
93e12e4
cfed32d
93e12e4
%postun
cfed32d
service httpd condrestart > /dev/null 2>&1 || :
cfed32d
%if %{useselinux}
cfed32d
if [ "$1" -eq "0" ]; then
a62932f
     (
cfed32d
     # Remove the SElinux policy.
cfed32d
     semodule -r %{name} || :
a62932f
     )&>/dev/null
cfed32d
fi
cfed32d
%endif
cfed32d
93e12e4
93e12e4
%files
93e12e4
%defattr(-,root,root,-)
3b7cf04
%doc README README.fedora ChangeLog LICENSE doc/
93e12e4
cfed32d
%dir %attr(-,backuppc,backuppc) %{_localstatedir}/log/%{name} 
93e12e4
%dir %attr(-,backuppc,backuppc) %{_sysconfdir}/%{name}/
93e12e4
93e12e4
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
93e12e4
%config(noreplace) %attr(-,backuppc,backuppc) %{_sysconfdir}/%{name}/*
93e12e4
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
93e12e4
cfed32d
%dir %{_datadir}/%{name} 
cfed32d
%dir %{_datadir}/%{name}/sbin
93e12e4
%{_datadir}/%{name}/[^s]*
cfed32d
%{_initrddir}/backuppc
93e12e4
93e12e4
%attr(4750,backuppc,apache) %{_datadir}/%{name}/sbin/BackupPC_Admin
93e12e4
%attr(-,backuppc,root) %{_localstatedir}/lib/%{name}/
93e12e4
cfed32d
%if %{useselinux}
cfed32d
%{_datadir}/selinux/packages/%{name}/%{name}.pp
cfed32d
%endif
93e12e4
93e12e4
%changelog
1169744
* Fri Sep 18 2009 Johan Cwiklinski <johan AT x-tnd DOT be> 3.1.0-6
1169744
- Fix SELinux policy module for UserEmailInfo.pl file
1169744
8391b9d
* Fri Apr 10 2009 Johan Cwiklinski <johan AT x-tnd DOT be> 3.1.0-5
8391b9d
- Fix TopDir change (bug #473944)
8391b9d
9348856
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-4
9348856
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
9348856
a62932f
* Mon Aug 11 2008 Johan Cwiklinski <johan AT x-tnd DOT be> 3.1.0-3
a62932f
- using /dev/null with SELinux policy to avoid broken pipe errors (bug #432149)
a62932f
6dd27cf
* Sat Apr 05 2008 Johan Cwiklinski <johan AT x-tnd DOT be> 3.1.0-2
6dd27cf
- correcting nologin path
6dd27cf
3b7cf04
* Thu Nov 29 2007 Johan Cwiklinski <johan AT x-tnd DOT be> 3.1.0-1
3b7cf04
- New upstream version
3b7cf04
- Added samba-client as a dependency
3b7cf04
- Added readme.fedora
3b7cf04
- Changed CGI admin path in default config file
3b7cf04
3b7cf04
* Fri Sep 21 2007 Johan Cwiklinski <johan AT x-tnd DOT be> 3.0.0-3
cfed32d
- Fixed SELinux policy module
cfed32d
cfed32d
* Wed Sep 12 2007 Johan Cwiklinski <johan AT x-tnd DOT be> 3.0.0-2
cfed32d
- Added SELinux policy module
cfed32d
cfed32d
* Tue Jan 30 2007 Johan Cwiklinski <johan AT x-tnd DOT be> 3.0.0-1
cfed32d
- Rebuild RPM for v 3.0.0
cfed32d
f84ce99
* Sat Aug 16 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-7
f84ce99
- Release bump for rebuild
f84ce99
93e12e4
* Tue Jul 25 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-6
93e12e4
- One more config change
93e12e4
93e12e4
* Sun Jul 23 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-5
93e12e4
- Added upstream patch for better support for rsync
93e12e4
93e12e4
* Sun Jul 23 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-4
93e12e4
- Properly marking config files as such
93e12e4
93e12e4
* Sun Jul 23 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-3
93e12e4
- Changes to defaults in config.pl
93e12e4
- Added Requires: rsync
93e12e4
93e12e4
* Fri Jul 21 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-2
93e12e4
- Added requires: perl(File::RsyncP)
93e12e4
93e12e4
* Tue Jul 18 2006 Mike McGrath <imlinux@gmail.com> 2.1.2-1
93e12e4
- Initial Fedora Packaging