%global _hardened_build 1 %define backupdir /backup/%{name} %define bpcuser backuppc # tmpfiles.d & systemd support in all supported Fedora now, but not RHEL < 7 %if 0%{?fedora} || 0%{?rhel} >= 7 %global _with_tmpfilesd 1 %global _with_systemd 1 %endif %global _updatedb_conf /etc/updatedb.conf %global ver_major 4 %global ver_minor 1 %global ver_patch 3 %global ver_under %{ver_major}_%{ver_minor}_%{ver_patch} Name: BackupPC Version: %{ver_major}.%{ver_minor}.%{ver_patch} Release: 1%{?dist} Summary: High-performance backup system License: GPLv2+ URL: http://backuppc.github.io/backuppc/index.html Source0: https://github.com/backuppc/backuppc/releases/download/%{version}/%{name}-%{version}.tar.gz Source1: BackupPC.htaccess Source2: BackupPC.logrotate Source3: README.setup #A C wrapper to use since perl-suidperl is no longer provided Source4: BackupPC_Admin.c Source5: backuppc.service Source6: BackupPC.tmpfiles Source7: README.RHEL Patch0: BackupPC-4.1.3-docfix.patch BuildRequires: perl-generators BuildRequires: perl(BackupPC::XS) >= 0.53 BuildRequires: perl(CGI) BuildRequires: perl(Compress::Zlib) BuildRequires: perl(Data::Dumper) BuildRequires: perl(Digest::MD5) BuildRequires: perl(Encode) BuildRequires: perl(File::Listing) BuildRequires: perl(Pod::Usage) BuildRequires: perl(version) %if 0%{?_with_systemd} BuildRequires: systemd %endif BuildRequires: httpd-tools # Unbundled libraries Requires: perl(Net::FTP::AutoReconnect) Requires: perl(Net::FTP::RetrHandle) Requires: bzip2 Requires: httpd Requires: iputils Requires: openssh-clients %if ! 0%{?el6} Requires: par2cmdline %endif Requires: rrdtool Requires: rsync-bpc >= 3.0.9.6 Requires: perl(Archive::Zip) Requires: perl(BackupPC::XS) >= 0.53 Requires: perl(CGI) Requires: perl(Compress::Zlib) Requires: perl(Digest::MD5) Requires: perl(Encode) Requires: perl(File::Listing) Requires: perl-Time-modules Requires: perl(version) Requires: perl(XML::RSS) Requires: samba-client Requires: %{_sbindir}/sendmail Requires(pre): shadow-utils %if 0%{?_with_systemd} Requires(preun): systemd Requires(post): systemd shadow-utils Requires(postun): systemd %else Requires(preun): initscripts chkconfig Requires(post): initscripts chkconfig shadow-utils Requires(postun): initscripts %endif Requires: policycoreutils BuildRequires: selinux-policy-devel checkpolicy Provides: backuppc = %{version} %description BackupPC is a high-performance, enterprise-grade system for backing up Linux and WinXX and Mac OS X PCs and laptops to a server's disk. BackupPC is highly configurable and easy to install and maintain. NOTE: Proper configuration is required after install, see README.setup for more information. %prep %autosetup -p1 for f in ChangeLog; do iconv -f ISO-8859-1 -t UTF-8 $f > $f.utf && mv $f.utf $f done cp %{SOURCE3} . cp %{SOURCE7} . cp %{SOURCE4} . mkdir selinux pushd selinux cat >%{name}.te <%{name}.fc < /dev/null || : %preun %if 0%{?_with_systemd} %systemd_preun %{bpcuser}.service %else if [ $1 = 0 ]; then # Package removal, not upgrade service %{bpcuser} stop > /dev/null 2>&1 || : chkconfig --del %{bpcuser} || : fi %endif %post ( # Install/update Selinux policy semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp # files created by app restorecon -R %{_sysconfdir}/%{name} restorecon -R %{_localstatedir}/log/%{name} ) &>/dev/null %if 0%{?_with_systemd} %systemd_post %{bpcuser}.service %else if [ $1 -eq 1 ]; then # initial installation chkconfig --add %{bpcuser} || : fi %{_sbindir}/usermod -a -G %{bpcuser} apache || : %endif # add BackupPC backup directories to PRUNEPATHS in locate database if [ -w %{_updatedb_conf} ]; then grep ^PRUNEPATHS %{_updatedb_conf} | grep %{_localstatedir}/lib/%{name} > /dev/null if [ $? -eq 1 ]; then sed -i '\@PRUNEPATHS@s@"$@ '%{_localstatedir}/lib/%{name}'"@' %{_updatedb_conf} fi fi : %postun # clear out any BackupPC configuration in apache service httpd condrestart > /dev/null 2>&1 || : if [ $1 -eq 0 ]; then # uninstall # Remove the SElinux policy. semodule -r %{name} &> /dev/null || : # remove BackupPC backup directories from PRUNEPATHS in locate database if [ -w %{_updatedb_conf} ]; then sed -i '\@PRUNEPATHS@s@[ ]*'%{_localstatedir}/lib/%{name}'@@' %{_updatedb_conf} || : fi fi %systemd_postun_with_restart %{bpcuser}.service %files %doc README.md README.setup README.RHEL ChangeLog doc/* %license LICENSE %dir %attr(-,%{bpcuser},%{bpcuser}) %{_localstatedir}/log/%{name} %dir %attr(-,%{bpcuser},%{bpcuser}) %{_sysconfdir}/%{name}/ %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf %config(noreplace) %attr(0640,%{bpcuser},apache) %{_sysconfdir}/%{name}/config.pl %config(noreplace) %attr(0640,%{bpcuser},apache) %{_sysconfdir}/%{name}/config.pl.sample %config(noreplace) %attr(0640,%{bpcuser},apache) %{_sysconfdir}/%{name}/hosts.sample %config(noreplace) %attr(0640,%{bpcuser},apache) %{_sysconfdir}/%{name}/hosts %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{name}/apache.users %dir %attr(0750,%{bpcuser},apache) %{_sysconfdir}/%{name}/pc %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %dir %{_datadir}/%{name} %dir %{_datadir}/%{name}/sbin %{_datadir}/%{name}/[^s]* %attr(750,%{bpcuser},apache) %{_datadir}/%{name}/sbin/BackupPC_Admin %if 0%{?_with_tmpfilesd} %{_tmpfilesdir}/%{name}.conf %endif %dir %attr(0775,%{bpcuser},%{bpcuser}) %{_localstatedir}/run/%{name} %if 0%{?_with_systemd} %{_unitdir}/%{bpcuser}.service %else %attr(0755,root,root) %{_initrddir}/%{bpcuser} %endif %attr(4750,%{bpcuser},apache) %{_libexecdir}/%{name}/BackupPC_Admin %attr(-,%{bpcuser},root) %{backupdir}/ %{_datadir}/selinux/packages/%{name}/%{name}.pp %changelog * Sat Oct 7 2017 Daniel Steiner - 4.1.3-2 - Iniital build.