File rear.spec of Package rear

#
# spec file for package rear
#
# Copyright (c) 2013 SUSE LINUX Products 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/
#


%bcond_without	use_mkisofs

Name:           rear
Version:        1.14
Release:        0
Summary:        Relax and Recover (ReaR) is a Linux Disaster Recovery framework
License:        GPL-2.0+
Group:          Productivity/Archiving/Backup

Url:            http://relax-and-recover.org/
Source0:        https://github.com/downloads/rear/rear/%{name}-%{version}.tar.gz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# all RPM based systems seem to have this and call it the same
Requires:       binutils
Requires:       ethtool
Requires:       gzip
Requires:       iproute2
Requires:       iputils
Requires:       lsb
%if 0%{?suse_version} >= 1230
Requires:       %{_sbindir}/agetty
%else
Requires:       /sbin/mingetty
%endif
%if %{with use_mkisofs}
Requires:       %{_bindir}/mkisofs
%else
Requires:       %{_bindir}/genisoimage
%endif
# recent SuSE versions have an extra nfs-client package
Requires:       nfs-client
# openSUSE from 11.1 and SLES from 11 uses rpcbind instead of portmap
Requires:       rpcbind
Requires:       syslinux
Requires:       tar

%description
Relax and Recover (abbreviated rear) is a highly modular disaster recovery
framework for GNU/Linux based systems, but can be easily extended to other
UNIX alike systems. The disaster recovery information (and maybe the backups)
can be stored via the network, local on hard disks or USB devices, DVD/CD-R,
tape, etc. The result is also a bootable image that is capable of booting via
PXE, DVD/CD and USB media.

Relax and Recover integrates with other backup software and provides integrated
bare metal disaster recovery abilities to the compatible backup software.

%prep
%setup -q

%build
# no code to compile - all bash scripts

%install
find . -type f -name .gitignore -delete

# create directories
mkdir -vp \
	$RPM_BUILD_ROOT%{_mandir}/man8 \
	$RPM_BUILD_ROOT%{_datadir} \
	$RPM_BUILD_ROOT%{_sysconfdir} \
	$RPM_BUILD_ROOT%{_sbindir} \
	$RPM_BUILD_ROOT%{_localstatedir}/lib/rear

# copy rear components into directories
cp -av usr/share/rear $RPM_BUILD_ROOT%{_datadir}/
cp -av usr/sbin/rear $RPM_BUILD_ROOT%{_sbindir}/
cp -av etc/rear $RPM_BUILD_ROOT%{_sysconfdir}/

# patch rear main script with correct locations for rear components
sed -i  -e 's#^CONFIG_DIR=.*#CONFIG_DIR="%{_sysconfdir}/rear"#' \
	-e 's#^SHARE_DIR=.*#SHARE_DIR="%{_datadir}/rear"#' \
	-e 's#^VAR_DIR=.*#VAR_DIR="%{_localstatedir}/lib/rear"#' \
	$RPM_BUILD_ROOT%{_sbindir}/rear

# update man page with correct locations
sed     -e 's#/etc#%{_sysconfdir}#' \
	-e 's#/usr/sbin#%{_sbindir}#' \
	-e 's#/usr/share#%{_datadir}#' \
	-e 's#/usr/share/doc/packages#%{_docdir}#' \
	doc/rear.8 >$RPM_BUILD_ROOT%{_mandir}/man8/rear.8

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING README doc/user-guide doc/rear-presentation.txt doc/rear-release-notes.txt
%{_sbindir}/rear
%{_datadir}/rear
%{_localstatedir}/lib/rear
%{_mandir}/man8/rear*
%config(noreplace) %{_sysconfdir}/rear

%changelog
openSUSE Build Service is sponsored by