File rsync-backup.spec of Package rsync-backup

#
# spec file for package rsync-backup
#
# Copyright (c) 2020 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 _distconfdir}
  %define _distconfdir /usr/share
%endif

Name:           rsync-backup
Version:        1.1
Release:        0
Summary:        Backup remote systems via rsync on btrfs
License:        GPL-2.0-or-later
URL:            https://github.com/thkukuk/rsync-backup
Source:         rsync-backup-%{version}.tar.xz
Source99:       rsync-backup-rpmlintrc
BuildRequires:  pkgconfig
BuildRequires:  sudo
BuildRequires:  sysuser-tools
BuildRequires:  pkgconfig(systemd)
Requires:       rsync
Requires:       snapper
Requires:       gnu_parallel
Requires:       netcat-openbsd
BuildArch:      noarch
%sysusers_requires

%description
Scripts to backup remote clients via rsync and ssh to an local
btrfs subvolume using snapper to store and manage the backups.

%package client
Summary:        Client script and user for rsync-backup
BuildArch:      noarch

%description client
This package contains the client part of rsync-backup and
creates the necessary user and directories.

%prep
%setup -q

%build
%configure --enable-vendordir=%{_distconfdir}
%make_build
%sysusers_generate_pre client/rsync-backup-user.conf rsync-backup

%install
%make_install

%pre client -f rsync-backup.pre

%post client
chsh -s /bin/bash rsync-backup
%tmpfiles_create rsync-backup-home.conf

%pre
%service_add_pre rsync-backup.timer

%post
%service_add_post rsync-backup.timer

%preun
%service_del_preun rsync-backup.timer

%postun
%service_del_postun rsync-backup.timer

%files
%license COPYING
%doc README.md
%{_distconfdir}/rsync-backup.conf
%{_sbindir}/rsync-backup
%{_prefix}/lib/systemd/system/rsync-backup.service
%{_prefix}/lib/systemd/system/rsync-backup.timer

%files client
%license COPYING
%doc README.md
%{_libexecdir}/rsync-backup-client
%{_prefix}/lib/sysusers.d/rsync-backup-user.conf
%{_prefix}/lib/tmpfiles.d/rsync-backup-home.conf
%config %{_sysconfdir}/sudoers.d/rsync-backup-sudoers
%dir %{_datadir}/rsync-backup
%dir %{_datadir}/rsync-backup/.ssh
%{_datadir}/rsync-backup/.ssh/authorized_keys.template
%{_mandir}/man1/rsync-backup.1*

%changelog
openSUSE Build Service is sponsored by