File urbackup-server.spec of Package urbackup-server
#
# spec file for package urbackup-server
#
# 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/
#
%if ! %{defined _fillupdir}
%define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
Name: urbackup-server
Version: 2.4.13
Release: 0
Summary: Efficient Client-Server backup system for Linux and Windows
License: AGPL-3.0-or-later
URL: https://www.urbackup.org/
Source0: https://hndl.urbackup.org/Server/%{version}/%{name}-%{version}.tar.gz
Source1: %{name}-apache.conf
Patch1: %{name}-fhs.patch
BuildRequires: apache-rpm-macros
BuildRequires: fuse-devel
BuildRequires: gcc-c++
BuildRequires: libcurl-devel
BuildRequires: zlib-devel
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: fdupes
%systemd_requires
Requires: guestfs-tools
Requires: libcurl4 >= 7.20.0
Requires: libz1
Requires: fuse >= 2.8.0
Requires: logrotate
PreReq: %fillup_prereq
PreReq: permissions
%description
Efficient Client-Server Backup system for Linux and Windows
with GPT and UEFI partition. A client for Windows lets you
backup open files and complete partition images. Backups
are stored to disks in a efficient way (deduplication)
on either Windows or Linux servers.
%package apache
Summary: Apache configuration for %{name}
Group: Productivity/Networking/Web/Utilities
BuildRequires: apache2
Requires: apache2
Supplements: apache2:%name
%description apache
This subpackage contains the Apache configuration files
%prep
%autosetup -p1
%build
export SUID_CFLAGS=-fPIE
export SUID_LDFLAGS=-fpie
export CFLAGS="%{optflags} -fPIE -pie"
export CXXFLAGS="%{optflags} -fPIE -pie"
%ifarch %{ix86}
export CXXFLAGS="-msse2 -O2 -g"
%endif
%configure \
--prefix=%{_prefix} \
--enable-packaging \
--with-mountvhd \
--enable-embedded-cryptopp
%make_build
%install
%make_install
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/
mkdir -p %{buildroot}%{_localstatedir}/log
mkdir -p %{buildroot}%{_localstatedir}/log/urbackup
mkdir -p %{buildroot}%{_localstatedir}/lib/
mkdir -p %{buildroot}%{_localstatedir}/lib/urbackup
# Fix log path
sed -i -e 's|\/var\/log\/urbackup.log|\/var\/log\/urbackup\/urbackup.log|g' defaults_server
sed -i -e 's|\/var\/log\/urbackup.log|\/var\/log\/urbackup\/urbackup.log|g' logrotate_urbackupsrv
# apache
install -d -m0755 %{buildroot}/%{_sysconfdir}/%{name}
install -D -m0644 %{SOURCE1} %{buildroot}/%{apache_sysconfdir}/conf.d/%{name}.conf
mkdir -p %{buildroot}%{_fillupdir}
mkdir -p %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
mkdir -p %{buildroot}%{_prefix}/lib/firewalld/services
sed -i "s@%{_sysconfdir}/default/urbackupsrv@%{_sysconfdir}/sysconfig/%{name}@g" %{_builddir}/%{name}-%{version}/%{name}.service
install -m 644 defaults_server %{buildroot}%{_fillupdir}/sysconfig.%{name}
install -m 640 %{_builddir}/%{name}-%{version}/urbackup-server-firewalld.xml %{buildroot}%{_prefix}/lib/firewalld/services/%{name}.xml
install -m 755 %{_builddir}/%{name}-%{version}/urbackup-server.service %{buildroot}%{_unitdir}/%{name}.service
install -m 644 %{_builddir}/%{name}-%{version}/docs/urbackupsrv.1 %{buildroot}%{_mandir}/man1/%{name}.1
install -m 644 %{_builddir}/%{name}-%{version}/logrotate_urbackupsrv %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%fdupes %{buildroot}%{_prefix}
%pre
getent group urbackup > /dev/null || groupadd -r urbackup
:
getent passwd urbackup > /dev/null || useradd -r -g urbackup \
-s /sbin/nologin urbackup >/dev/null 2>&1
:
%service_add_pre %{name}.service
%post
/sbin/ldconfig
%fillup_only -n %{name}
%service_add_post %{name}.service
%set_permissions /usr/bin/urbackup_mount_helper
%set_permissions /usr/bin/urbackup_snapshot_helper
%verifyscript
%verify_permissions -e /usr/bin/urbackup_mount_helper
%verify_permissions -e /usr/bin/urbackup_snapshot_helper
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
/sbin/ldconfig
%posttrans
%if 0%{?have_systemd}
if systemctl --quiet is-enabled %{name}.service 2>/dev/null
then
/bin/systemctl --quiet --force reenable %{name} 2>/dev/null || :
else
/bin/systemctl --quiet --force reenable %{name} 2>/dev/null || :
/bin/systemctl --quiet disable %{name} 2>/dev/null || :
fi
%endif
%files
%license COPYING server-license.txt
%doc AUTHORS ChangeLog README
%attr(4755,root,root) %{_bindir}/urbackup_snapshot_helper
%attr(4755,root,root) %{_bindir}/urbackup_mount_helper
%{_bindir}/*
%{_mandir}/man1/*
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_fillupdir}/sysconfig.%{name}
%{_localstatedir}/log
%dir %attr(0755,urbackup,urbackup) %{_localstatedir}/log/urbackup
%dir %attr(0755,urbackup,urbackup) %{_localstatedir}/lib/urbackup
%attr(-,urbackup,urbackup) %{_localstatedir}/lib/urbackup/dataplan_db.txt
%{_sysconfdir}/logrotate.d/*
%attr(0644,root,root) %{_unitdir}/%{name}.service
%{_sbindir}/rcurbackup-server
%dir %attr(0755,urbackup,urbackup) %{_datadir}/urbackup
%defattr(0644,urbackup,urbackup,0755)
%{_datadir}/urbackup/*
%{_prefix}/lib/firewalld/services/%{name}.xml
%files apache
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%changelog