File BackupPC4.spec of Package BackupPC4
#
# spec file for package BackupPC4
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# See also http://en.opensuse.org/openSUSE:Specfile_guidelines
%define srcname BackupPC
Name: BackupPC4
Version: 4.4.0
Release: 0
Summary: A high-performance, enterprise-grade system for backing up
License: GPL-2.0-or-later
Group: Productivity/Networking/System
URL: https://backuppc.github.io/backuppc/
Source0: https://github.com/backuppc/backuppc/releases/download/%{version}/%{srcname}-%{version}.tar.gz
Source1: %{name}.conf
Source2: %{name}.service
Source3: %{name}.logrotate
Source99: %{name}.rpmlintrc
Patch1: %{name}-suse.patch
BuildRequires: apache-rpm-macros
BuildRequires: iputils
BuildRequires: logrotate
BuildRequires: openssh
BuildRequires: perl-CGI
BuildRequires: perl-base >= 5.8.0
BuildRequires: rsync >= 3.1.2.2
BuildRequires: samba-client
BuildRequires: sendmail
BuildRequires: perl(BackupPC::XS) >= 0.62
BuildRequires: perl(CGI)
BuildRequires: perl(File::Listing)
Requires: logrotate
Requires: perl-CGI
Requires: perl-base >= 5.8.0
Requires: rsync >= 3.1.2.2
Requires: rsync-bpc
Requires: samba-client
Requires: tar >= 1.13.20
Requires: perl(Archive::Zip)
Requires: perl(BackupPC::XS) >= 0.53
Requires: perl(CGI)
Requires: perl(Compress::Zlib)
Requires: perl(File::Listing)
Requires: perl(File::RsyncP) >= 0.68
Requires: perl(Net::FTP::AutoReconnect)
Requires: perl(Net::FTP::RetrHandle)
Requires: perl(XML::RSS)
Provides: BackupPC = %{version}
Provides: backuppc = %{version}
Obsoletes: BackupPC < %{version}
Obsoletes: backuppc < %{version}
BuildArch: noarch
%{?systemd_requires}
%description
BackupPC is a high-performance, enterprise-grade system for backing up Linux, WinXX and MacOSX PCs and laptops to a server's disk.
BackupPC is highly configurable and easy to install and maintain.
%package apache
Summary: Apache configuration for %{name}
Group: Productivity/Networking/Web/Utilities
BuildRequires: apache2
Requires: apache2
Requires: apache2-mod_perl
Supplements: (apache2 and %name)
%description apache
This subpackage contains the Apache configuration files
%prep
%setup -q -n %{srcname}-%{version}
%patch -P 1 -p1
# rpmlint: fix incorrect-fsf-address
#find . -type f | xargs sed -i -e 's:59 Temple Place\, Suite 330\, Boston\, MA 02111-1307 USA:51 Franklin Street\, Fifth Floor\, Boston\, MA 02110-1301 USA:g'
#find . -type f | xargs sed -i -e 's:59 Temple Place\, Suite 330\, Boston\, MA 02111-1307 USA:51 Franklin Street\, Fifth Floor\, Boston\, MA 02110-1301 USA:g'
#find . -type f | xargs sed -i -e 's:59 Temple Place\, Suite 330\, Boston\, MA:51 Franklin Street\, Fifth Floor\, Boston\, MA:g'
#find . -type f | xargs sed -i -e 's:02111-1307 USA:02110-1301 USA:g'
%build
# no need for build
%install
perl configure.pl \
--uid-ignore \
--no-set-perms \
--batch \
--dest-dir %{buildroot} \
--backuppc-user=wwwrun \
--config-dir=%{_sysconfdir}/%{name}/ \
--cgi-dir=%{_datadir}/%{name}/cgi-bin \
--data-dir=%{_localstatedir}/lib/%{name} \
--html-dir=%{_datadir}/%{name}/html \
--html-dir-url=/%{name}/images \
--log-dir=%{_localstatedir}/log/%{name} \
--install-dir=%{_datadir}/%{name} \
--hostname=localhost
# install systemd.service or init.d
mkdir %{buildroot}%{_sbindir}
install -d %{buildroot}%{_unitdir}
install -p -m 0644 %{SOURCE2} %{buildroot}/%{_unitdir}/
ln -s service %{buildroot}%{_sbindir}/rc%{name}
# install BackupPC.conf to /etc/apache2/conf.d
install -D -m 0640 %{SOURCE1} %{buildroot}%{apache_sysconfdir}/conf.d/%{name}.conf
# install logrotate
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# folder for pc specific/ individual configuration files
if ! test -d %{buildroot}%{_sysconfdir}/%{name}/pc; then
mkdir %{buildroot}%{_sysconfdir}/%{name}/pc
fi
# create folder for log files
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
# create folder for pid file
mkdir -p %{buildroot}/run/%{name}
%pre
%service_add_pre %{name}.service
%preun
%stop_on_removal %{name}
%service_del_preun %{name}.service
%post
%service_add_post %{name}.service
if ! test -f %{_sysconfdir}/%{name}/passwd; then
echo -ne '\n *** i miss %{_sysconfdir}/%{name}/passwd ...'
echo -ne '\n *** Please set Username and Password (for the HTTP-Frontend) by running'
echo -ne '\n *** htpasswd2 -c %{_sysconfdir}/%{name}/passwd <allowed User/Cgi Admin>\n\n'
fi
if ! grep -v \'\' %{_sysconfdir}/%{name}/config.pl | grep '^$Conf{CgiAdminUsers' ; then
echo ' *** neither CgiAdminUsersGroup, nor CgiAdminUsers ist set in %{_sysconfdir}/%{name}/config.pl'
echo ' *** You will not be able to modify system settings using the CGI interface.'
fi
%post apache
%service_add_post apache2.service
# Activate the Apache required modules
a2enmod -q version || a2enmod version
a2enmod -q perl || a2enmod perl
%postun
%service_del_postun %{name}.service
%postun apache
%service_del_postun apache2.service
%files
%defattr(644,root,root,755)
%doc
#
%dir %attr(0770,root,%{apache_group}) %{_localstatedir}/lib/%{name}
%dir %attr(0770,root,%{apache_group}) %{_localstatedir}/lib/%{name}/pc
%dir %attr(0770,root,%{apache_group}) %{_localstatedir}/lib/%{name}/pool
%dir %attr(0770,root,%{apache_group}) %{_localstatedir}/lib/%{name}/cpool
#
%dir %attr(0770,root,%{apache_group}) %{_sysconfdir}/%{name}
%dir %attr(0770,root,%{apache_group}) %{_sysconfdir}/%{name}/pc
#
%config(noreplace) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
#
%dir %attr(0770,root,%{apache_group}) %{_datadir}/%{name}
%attr(0770,root,%{apache_group}) %{_datadir}/%{name}/bin/*
%attr(0770,root,%{apache_group}) %{_datadir}/%{name}/cgi-bin/*
%{_datadir}/%{name}
#
%ghost /run/%{name}
#
%dir %attr(0770,root,%{apache_group}) %{_localstatedir}/log/%{name}
#
%{_unitdir}/%{name}.service
%{_sbindir}/rc%{name}
%files apache
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%changelog