File rear.spec of Package rear

#
# spec file for package rear
#
# Copyright (c) 2011 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/
#



Name:           rear
Version:        1.10.0
Release:        1.<RELEASE2>
Summary:        Relax and Recover (ReaR) is a Linux Disaster Recovery framework

Group:          Productivity/Archiving/Backup
License:        GPLv2+
Url:            http://rear.sourceforge.net
Source0:        http://downloads.sourceforge.net/%{name}/%{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:       mingetty binutils iputils tar gzip ethtool syslinux

# if SuSE
%if 0%{?suse_version} != 0
Requires:       iproute2 lsb
# recent SuSE versions have an extra nfs-client package and switched to genisoimage/wodim
%if 0%{?suse_version} >= 1020
Requires:       genisoimage nfs-client
%else
Requires:       mkisofs
%endif
# openSUSE from 11.1 and SLES from 11 uses rpcbind instead of portmap
%if 0%{?suse_version} >= 1110
Requires:       rpcbind
%else
Requires:       portmap
%endif
# end SuSE
%endif

# if Mandriva
%if 0%{?mandriva_version} != 0
Requires:       iproute2 lsb
# Mandriva switched from 2008 away from mkisofs, and as a specialty call the package cdrkit-genisoimage!
%if 0%{?mandriva_version} >= 2008
Requires:       cdrkit-genisoimage rpcbind
%else
Requires:       mkisofs portmap
%endif
# end Mandriva
%endif

# all Red Hat compatible, Scientific Linux and other clones are not yet supported by openSUSE
# Build Server, add more RHEL clones as needed. To make the boolean expression simpler I copy
# this section for each Red Hat OS
%if 0%{?centos_version} != 0
Requires:       iproute redhat-lsb
# Red Hat moved from CentOS/RHEL/SL 6 and Fedora 9 away from mkisofs
%if 0%{?centos_version} >= 600
Requires:       genisoimage rpcbind
%else
Requires:       mkisofs portmap
%endif
# end CentOS
%endif

%if 0%{?rhel_version} != 0
Requires:       iproute redhat-lsb
# Red Hat moved from CentOS/RHEL/SL 6 and Fedora 9 away from mkisofs
%if 0%{?rhel_version} >= 600 
Requires:       genisoimage rpcbind
%else
Requires:       mkisofs portmap
%endif
# end Red Hat Enterprise Linux
%endif

%if 0%{?fedora_version} != 0
Requires:       iproute redhat-lsb
# Red Hat moved from CentOS/RHEL/SL 6 and Fedora 9 away from mkisofs
%if 0%{?fedora_version} >= 9
Requires:       genisoimage rpcbind
%else
Requires:       mkisofs portmap
%endif
# end Fedora
%endif

%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

# 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

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc COPYING CHANGES README doc/*
%{_sbindir}/rear
%{_datadir}/rear
%{_localstatedir}/lib/rear
%{_mandir}/man8/rear*
%config(noreplace) %{_sysconfdir}/rear

%changelog
openSUSE Build Service is sponsored by