File btrbk.spec of Package btrbk

#
# spec file for package btrbk
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

Name:           btrbk
Version:        0.32.5
Release:        0
Summary:        Backup Tool using snapshots of btrfs
License:        GPL-3.0+
Group:          Development/Libraries/Perl
Url:            https://github.com/digint/btrbk
Source0:        btrbk-%{version}.tar.gz

BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  perl-MIME-Base64
%if 0%{?suse_version} >= 1140
%{perl_requires}
%else
# syntax for older suse and fedora
Requires:       perl = %{perl_version}
%endif
BuildArch:      noarch
BuildRequires:  systemd
# required for documentation
%if    0%{?suse_version}    >=    1330
BuildRequires:  rubygem(asciidoctor)
%else
BuildRequires:  ruby2.1-rubygem-asciidoctor
%endif
BuildRequires:  libxslt
Recommends:     systemd
Requires:       perl-Date-Calc
Requires:       pv
Requires:       btrfsprogs >= 3.18.2

%define __python %{__python3}

%description
Backup Tool using snaphosts of btrfs with backup rotations and remote backups using ssh.

%prep
%setup -q

%build

%install
%make_install
sed -i '1 s|%{_bindir}/env\ python3|%{_bindir}/python3|' %{buildroot}/%{_datadir}/%{name}/scripts/kdf_pbkdf2.py
mkdir -p %{buildroot}/%{_sbindir}
%__ln_s %{_sbindir}/service "%{buildroot}/%{_sbindir}/rc%{name}"

# fixing DOCDIR for SuSE
%if 0%{?suse_version}
mkdir -p %{buildroot}/%{_docdir}
mv %{buildroot}/%{_datadir}/doc/%{name} %{buildroot}/%{_docdir}
%endif


%pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%files
%defattr(-,root,root)
# documentation
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/*

# man pages
%{_mandir}/man1/*.1*
%{_mandir}/man5/*.5*
# config
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/%{name}.conf.example
# executables
%{_sbindir}/rc%{name}
%attr(700,root,root) %{_bindir}/btrbk
%{_bindir}/lsbtr
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/scripts
%{_datadir}/%{name}/scripts/*
%{_datadir}/bash-completion/completions/*
# systemd
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}.timer

%changelog
openSUSE Build Service is sponsored by