%define debug_package %{nil}

Name:           rear
Version:        2.4
Release:        3
License:        GPLv3
Summary:        Relax-and-Recover is a setup-and-forget Linux bare metal disaster recovery solution
URL:            http://relax-and-recover.org/
Source0:        https://sourceforge.net/projects/rear/files/rear/%{version}/rear-%{version}.tar.gz
ExclusiveArch:  x86_64
Requires:       binutils ethtool gzip iputils parted tar openssl gawk attr bc crontabs iproute
Requires:       genisoimage util-linux syslinux
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

%description
Relax-and-Recover is a setup-and-forget Linux bare metal disaster recovery solution. It is easy to
set up and requires no maintenance so there is no excuse for not using it.

%package        help
Summary:        Help document for the rear
Buildarch:      noarch

%description    help
Help document for the rear package.

%pre
if [ $1 -gt 1 ] ; then
  rm -rf %{_datadir}/rear/output/NETFS
fi

%prep
%autosetup

%build

%install
rm -rf %{buildroot}
make install DESTDIR="%{buildroot}"
echo "30 1 * * * root /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" > rear.cron
install -Dp -m 0644 rear.cron %{buildroot}%{_sysconfdir}/cron.d/rear

%clean
rm -rf %{buildroot}

%files
%doc MAINTAINERS COPYING README.adoc doc/*.txt
%config(noreplace) %{_sysconfdir}/cron.d/rear
%config(noreplace) %{_sysconfdir}/rear/
%config(noreplace) %{_sysconfdir}/rear/cert/
%{_datadir}/rear/
%{_localstatedir}/lib/rear/
%{_sbindir}/rear

%files help
%doc %{_mandir}/man8/rear.8*

%changelog
* Wed Feb 26 2020 Ling Yang <lingyang2@huawei.com> - 2.4-3
- Package Init
